/etc/resolv.conf is a symlink to /private/var/run/resolv.conf on Mac OS X. Therefore stat("/etc/resolv.conf", &struct) fails, and changes to DNS are not monitored 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. [1]).
[1] https://github.com/emcrisostomo/fswatch/blob/master/libfswatch/src/libfswatch/c%2B%2B/fsevents_monitor.cpp