summaryrefslogtreecommitdiffstats
path: root/usr.sbin/syslogd
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1996-10-23 20:17:57 +0000
committerjulian <julian@FreeBSD.org>1996-10-23 20:17:57 +0000
commitb9fc5c00e59d52cfef8c165e6a7db0fb77338e50 (patch)
treef7816c581db6e00bc12246c3dac05c8d0b627c85 /usr.sbin/syslogd
parent4efe54c82944db41f906033ed7dd3f733cd641db (diff)
downloadFreeBSD-src-b9fc5c00e59d52cfef8c165e6a7db0fb77338e50.zip
FreeBSD-src-b9fc5c00e59d52cfef8c165e6a7db0fb77338e50.tar.gz
Reviewed by: various (mailing list feedback)
Submitted by: whistle communications move the socket from /dev to /var/run by default TRANSITIONALLY make syslog add a symlink.. I PROMISE I'll remove that as soon as I have the makefiles etc fixed as well.
Diffstat (limited to 'usr.sbin/syslogd')
-rw-r--r--usr.sbin/syslogd/syslogd.817
-rw-r--r--usr.sbin/syslogd/syslogd.c47
2 files changed, 57 insertions, 7 deletions
diff --git a/usr.sbin/syslogd/syslogd.8 b/usr.sbin/syslogd/syslogd.8
index e74b924..c2ea278 100644
--- a/usr.sbin/syslogd/syslogd.8
+++ b/usr.sbin/syslogd/syslogd.8
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)syslogd.8 8.1 (Berkeley) 6/6/93
-.\" $Id: syslogd.8,v 1.3 1996/05/20 17:10:03 wollman Exp $
+.\" $Id: syslogd.8,v 1.4 1996/07/22 16:35:48 pst Exp $
.\"
.Dd October 12, 1995
.Dt SYSLOGD 8
@@ -68,7 +68,7 @@ the default is 20 minutes.
.It Fl p
Specify the pathname of an alternate log socket;
the default is
-.Pa /dev/log .
+.Pa /var/run/log .
.El
.Pp
.Nm Syslogd
@@ -82,7 +82,7 @@ see
reads messages from the
.Tn UNIX
domain socket
-.Pa /dev/log ,
+.Pa /var/run/log ,
from an Internet domain socket specified in
.Pa /etc/services ,
and from the special device
@@ -113,10 +113,13 @@ The configuration file.
.It Pa /var/run/syslog.pid
The process id of current
.Nm syslogd .
-.It Pa /dev/log
+.It Pa /var/run/log
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,4 +139,8 @@ an unauthenticated remote disk-filling service, and should probably be
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.
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 8bff619..5dbfa06 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -39,7 +39,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
*/
static const char rcsid[] =
- "$Id: syslogd.c,v 1.9 1996/07/22 16:35:50 pst Exp $";
+ "$Id: syslogd.c,v 1.10 1996/10/05 15:20:51 peter Exp $";
#endif /* not lint */
/*
@@ -104,11 +104,14 @@ static const char rcsid[] =
#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,6 +243,9 @@ main(argc, argv)
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,6 +298,43 @@ main(argc, argv)
} 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
OpenPOWER on IntegriCloud