My Linux man page says open(2) takes an optional 3rd argument - the mode bits that are used if the file is created. The POSIX man pages don't say anything about it, but do leave a ... in the skeleton for open.
The mode argument specifies the file mode bits be applied when a new file is created. This argument must be supplied when O_CREAT or O_TMPFILE is specified in flags; if neither O_CREAT nor O_TMPFILE is specified, then mode is ignored. Is that interesting for refclocks? Is there any case where things like /dev/tty6 get created when opened? If not, any reason I shouldn't remove the 3rd argument? (I'm interested in refclocks, not log files and such which actually might get created.) If there is a good use for it, is 0777 ever the right value? Examples: ntpd/refclock_nmea.c up->ppsapi_fd = open(peer->cfg.ppspath, O_RDWR | O_NOCTTY | O_NONBLOCK, S_IRUSR | S_IWUSR); ntpd/refclock_pps.c up->fddev = open(peer->cfg.ppspath ? peer->cfg.ppspath : device, O_RDWR, 0777); ntpd/ntp_refclock.c fd = open(dev, O_RDWR | O_NONBLOCK | O_NOCTTY, 0777); -- These are my opinions. I hate spam. _______________________________________________ devel mailing list devel@ntpsec.org http://lists.ntpsec.org/mailman/listinfo/devel