Date: Mon, 21 Oct 1996 23:09:40 -0700 From: Julian Elischer <julian@whistle.com> To: hackers@freebsd.org Subject: comments on this change please. Message-ID: <326C6524.41C67EA6@whistle.com>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------446B9B3D2781E494167EB0E7 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I would like to make the following change to syslogd and the syslog system. (better suggestions for names not withstanding) the aim is to get the logging fifo out of the root filesystem so that it can be made read-only. I have added some code to syslogd to help compatibilty by having it TRY make a symlink for /dev/log to /var/run/syslog.socket for those people who want BSDI (or linux?) or older freeBSD binaries to work. In teh case of a read-only root fs, One would hope that whoever set it up would have made the symlink first. please comment. I'm trying to get a production r/o root system out the door and we have to get around syslog somehow.. note that this system also works with devfs because devfs supports symlinks. julian (I'm sure bde will find one style problem per line as usual.. and I'll fix them as per usual I hope) :) --------------446B9B3D2781E494167EB0E7 Content-Type: text/plain; charset=us-ascii; name="xx" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xx" ? usr.sbin/syslogd/syslogd ? usr.sbin/syslogd/syslog.conf.5.gz ? usr.sbin/syslogd/syslogd.8.gz Index: sys/sys/syslog.h =================================================================== RCS file: /cvs/freebsd/src/sys/sys/syslog.h,v retrieving revision 1.6 diff -c -r1.6 syslog.h *** 1.6 1996/03/28 18:29:14 --- syslog.h 1996/10/22 05:57:13 *************** *** 37,43 **** #ifndef _SYS_SYSLOG_H_ #define _SYS_SYSLOG_H_ ! #define _PATH_LOG "/dev/log" /* * priorities/facilities are encoded into a single 32-bit quantity, where the --- 37,44 ---- #ifndef _SYS_SYSLOG_H_ #define _SYS_SYSLOG_H_ ! #define _OLD_PATH_LOG "/dev/log" ! #define _PATH_LOG "/var/run/syslog.socket" /* * priorities/facilities are encoded into a single 32-bit quantity, where the Index: usr.sbin/syslogd/syslogd.8 =================================================================== RCS file: /cvs/freebsd/src/usr.sbin/syslogd/syslogd.8,v retrieving revision 1.4 diff -c -r1.4 syslogd.8 *** 1.4 1996/07/22 16:35:48 --- syslogd.8 1996/10/22 05:57:13 *************** *** 68,74 **** .It Fl p Specify the pathname of an alternate log socket; the default is ! .Pa /dev/log . .El .Pp .Nm Syslogd --- 68,74 ---- .It Fl p Specify the pathname of an alternate log socket; the default is ! .Pa /var/run/syslog.socket . .El .Pp .Nm Syslogd *************** *** 82,88 **** reads messages from the .Tn UNIX domain socket ! .Pa /dev/log , from an Internet domain socket specified in .Pa /etc/services , and from the special device --- 82,88 ---- reads messages from the .Tn UNIX domain socket ! .Pa /var/run/syslog.socket , from an Internet domain socket specified in .Pa /etc/services , and from the special device *************** *** 113,122 **** .It Pa /var/run/syslog.pid The process id of current .Nm syslogd . ! .It Pa /dev/log Name of the .Tn UNIX domain datagram log socket. .It Pa /dev/klog The kernel log device. .El --- 113,125 ---- .It Pa /var/run/syslog.pid The process id of current .Nm syslogd . ! .It Pa /var/run/syslog.socket Name of the .Tn UNIX domain datagram log socket. + .Nm syslogd + might also create a symlink from the location of the old default + socket, (/dev/log) so as to assist backwards compatibility. .It Pa /dev/klog The kernel log device. .El *************** *** 136,139 **** disabled by default. Some sort of .No inter- Ns Nm syslogd authentication mechanism ought to be worked out. ! --- 139,146 ---- disabled by default. Some sort of .No inter- Ns Nm syslogd authentication mechanism ought to be worked out. ! The log socket was moved from /dev to ease the use ! of a read-only root filesystem. This may confuse some old binaries ! and if possible, syslogd will create a symlink to help these programs, ! however if the root filesystem is already read only, and the link is not ! pre-existing, these binaries will not be able to log messages. Index: usr.sbin/syslogd/syslogd.c =================================================================== RCS file: /cvs/freebsd/src/usr.sbin/syslogd/syslogd.c,v retrieving revision 1.10 diff -c -r1.10 syslogd.c *** 1.10 1996/10/05 15:20:51 --- syslogd.c 1996/10/22 05:57:13 *************** *** 104,114 **** #define SYSLOG_NAMES #include <sys/syslog.h> - const char *LogName = _PATH_LOG; const char *ConfFile = _PATH_LOGCONF; const char *PidFile = _PATH_LOGPID; const char ctty[] = _PATH_CONSOLE; #define FDMASK(fd) (1 << (fd)) --- 104,117 ---- #define SYSLOG_NAMES #include <sys/syslog.h> const char *LogName = _PATH_LOG; const char *ConfFile = _PATH_LOGCONF; const char *PidFile = _PATH_LOGPID; const char ctty[] = _PATH_CONSOLE; + #if defined _OLD_PATH_LOG + int alt_fifo; + const char *OldLogName = _OLD_PATH_LOG; + #endif #define FDMASK(fd) (1 << (fd)) *************** *** 240,245 **** --- 243,251 ---- break; case 'p': /* path */ LogName = optarg; + #if defined _OLD_PATH_LOG + alt_fifo = 1; + #endif break; case 'I': /* backwards compatible w/FreeBSD */ case 's': /* no network mode */ *************** *** 292,297 **** --- 298,340 ---- } else created_lsock = 1; + #if defined(_OLD_PATH_LOG) + #define LNKSZ 128 + /* + * don't make a link for the old fifo name if we are just testing + * (presumably the real syslogd might be using it) + */ + if (! alt_fifo ) { + struct stat statb; + char linkbuf[LNKSZ+1]; + + linkbuf[LNKSZ + 1] = '\0'; + if(stat(OldLogName,&statb) == 0) { + switch(statb.st_mode & S_IFMT) { + case S_IFLNK: + /* + * if it's already corrct leave it + * (great for ro filesystems) + */ + if((readlink(OldLogName, linkbuf, LNKSZ) > 0) + && (! strcmp(OldLogName,linkbuf))) + goto linkok; + case S_IFIFO: + /* if the unlink fails the symlink will too */ + unlink(OldLogName); + } + } + if(symlink(LogName,OldLogName)) { + (void) sprintf(line, + "cannot create symlink %s, continuing.", + OldLogName); + logerror(line); + dprintf("warning: cannot create symlink %s (%d)\n", + OldLogName, errno); + } + } + linkok: + #endif if (!SecureMode) finet = socket(AF_INET, SOCK_DGRAM, 0); else --------------446B9B3D2781E494167EB0E7--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?326C6524.41C67EA6>