/etc/resolv.conf is a symlink to /private/var/run/resolv.conf on Mac OS X. Therefore stat("/etc/resolv.conf", &struct) monitors a file that's never modified, and changes to DNS are not discovered on Mac OS X.
I think you need to determine if /etc/resolv.conf is a symlink and then follow it before you try to stat() it.
Alternatively, you could use FSEvents on Mac to be proactively notified about changes to /etc/resolv.conf (see e.g. ).