syslogd: Drop -a SOCK support, replaced with multiple -p SOCK args
The -p SOCK syntax is what NetBSD syslogd use, so this is more of an alignment with upstream. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
d723574eee
commit
f8e87f143d
@ -14,7 +14,6 @@
|
|||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl ?46Adhnrv
|
.Op Fl ?46Adhnrv
|
||||||
.Op Fl a Ar SOCK
|
|
||||||
.Op Fl b Ar :SVC
|
.Op Fl b Ar :SVC
|
||||||
.Op Fl f Ar FILE
|
.Op Fl f Ar FILE
|
||||||
.Op Fl l Ar HOST[:HOST]
|
.Op Fl l Ar HOST[:HOST]
|
||||||
@ -94,18 +93,6 @@ tries to send the message to only one address even if the host has
|
|||||||
more than one A or AAAA record. If this option is specified,
|
more than one A or AAAA record. If this option is specified,
|
||||||
.Nm
|
.Nm
|
||||||
tries to send the message to all addresses.
|
tries to send the message to all addresses.
|
||||||
.It Fl a Ar SOCK
|
|
||||||
Using this argument you can specify additional sockets from that
|
|
||||||
.Nm
|
|
||||||
has to listen to. This is needed if you're going to let some daemon
|
|
||||||
run within a
|
|
||||||
.Xr chroot 8
|
|
||||||
environment. You can use up to 19 additional sockets. If your
|
|
||||||
environment needs even more, you have to increase the symbol
|
|
||||||
.Ql MAXFUNIX
|
|
||||||
within the
|
|
||||||
.Pa syslogd.c
|
|
||||||
source file.
|
|
||||||
.It Fl b Ar :service
|
.It Fl b Ar :service
|
||||||
Bind to a specific port. The port can be specified as a service name or
|
Bind to a specific port. The port can be specified as a service name or
|
||||||
number. The default service is
|
number. The default service is
|
||||||
@ -159,6 +146,16 @@ The default is
|
|||||||
.It Fl p Ar SOCK
|
.It Fl p Ar SOCK
|
||||||
Specify an alternate UNIX domain socket instead of the default
|
Specify an alternate UNIX domain socket instead of the default
|
||||||
.Pa /dev/log .
|
.Pa /dev/log .
|
||||||
|
When a single
|
||||||
|
.Fl p
|
||||||
|
option is specified, the default pathname is replaced with the specified
|
||||||
|
one. When two or more
|
||||||
|
.Fl p
|
||||||
|
options are specified, the remaining pathnames are treated as additional
|
||||||
|
log sockets. This might be needed when running applications in
|
||||||
|
containers or a
|
||||||
|
.Xr chroot 8
|
||||||
|
environment. In total 20 UNIX domain sockets are supported.
|
||||||
.It Fl R Ar size[:count]
|
.It Fl R Ar size[:count]
|
||||||
Enable built-in support for log rotation of files listed in
|
Enable built-in support for log rotation of files listed in
|
||||||
.Pa /etc/syslog.conf .
|
.Pa /etc/syslog.conf .
|
||||||
|
@ -110,11 +110,9 @@ static int restart = 0;
|
|||||||
|
|
||||||
#define MAXFUNIX 20
|
#define MAXFUNIX 20
|
||||||
|
|
||||||
int nfunix = 1;
|
int nfunix;
|
||||||
char *funixn[MAXFUNIX] = { _PATH_LOG };
|
char *funixn[MAXFUNIX];
|
||||||
int funix[MAXFUNIX] = {
|
int funix[MAXFUNIX];
|
||||||
-1,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Intervals at which we flush out "message repeated" messages,
|
* Intervals at which we flush out "message repeated" messages,
|
||||||
@ -199,12 +197,12 @@ int main(int argc, char *argv[])
|
|||||||
int num_fds, maxfds;
|
int num_fds, maxfds;
|
||||||
int i, ch;
|
int i, ch;
|
||||||
|
|
||||||
for (i = 1; i < MAXFUNIX; i++) {
|
for (i = 0; i < MAXFUNIX; i++) {
|
||||||
funixn[i] = "";
|
funixn[i] = NULL;
|
||||||
funix[i] = -1;
|
funix[i] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "46Aa:b:dhHf:l:m:nP:p:R:rs:v?")) != EOF) {
|
while ((ch = getopt(argc, argv, "46Ab:dhHf:l:m:nP:p:R:rs:v?")) != EOF) {
|
||||||
switch ((char)ch) {
|
switch ((char)ch) {
|
||||||
case '4':
|
case '4':
|
||||||
family = PF_INET;
|
family = PF_INET;
|
||||||
@ -218,13 +216,6 @@ int main(int argc, char *argv[])
|
|||||||
send_to_all++;
|
send_to_all++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'a':
|
|
||||||
if (nfunix < MAXFUNIX)
|
|
||||||
funixn[nfunix++] = optarg;
|
|
||||||
else
|
|
||||||
fprintf(stderr, "Out of descriptors, ignoring %s\n", optarg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
ptr = strchr(optarg, ':');
|
ptr = strchr(optarg, ':');
|
||||||
if (ptr)
|
if (ptr)
|
||||||
@ -269,7 +260,10 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p': /* path to regular log socket */
|
case 'p': /* path to regular log socket */
|
||||||
funixn[0] = optarg;
|
if (nfunix < MAXFUNIX)
|
||||||
|
funixn[nfunix++] = optarg;
|
||||||
|
else
|
||||||
|
fprintf(stderr, "Max log sockets reached, ignoring %s\n", optarg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'R':
|
case 'R':
|
||||||
@ -306,6 +300,10 @@ int main(int argc, char *argv[])
|
|||||||
if ((argc -= optind))
|
if ((argc -= optind))
|
||||||
usage(1);
|
usage(1);
|
||||||
|
|
||||||
|
/* Default to _PATH_LOG for the UNIX domain socket */
|
||||||
|
if (!nfunix)
|
||||||
|
funixn[nfunix++] = _PATH_LOG;
|
||||||
|
|
||||||
if ((!Foreground) && (!Debug)) {
|
if ((!Foreground) && (!Debug)) {
|
||||||
signal(SIGTERM, doexit);
|
signal(SIGTERM, doexit);
|
||||||
chdir("/");
|
chdir("/");
|
||||||
@ -2295,13 +2293,23 @@ void init(void)
|
|||||||
fhead = newf;
|
fhead = newf;
|
||||||
|
|
||||||
for (i = 0; i < nfunix; i++) {
|
for (i = 0; i < nfunix; i++) {
|
||||||
if (funix[i] != -1)
|
/*
|
||||||
/* Don't close the socket, preserve it instead
|
* UNIX domain sockets are given on the command line, so
|
||||||
close(funix[i]);
|
* there's no need to close them if they're already
|
||||||
|
* open. Doing so would only cause loss of any already
|
||||||
|
* buffered messages
|
||||||
*/
|
*/
|
||||||
|
logit("Checking if we should open UNIX socket %s ...", funixn[i]);
|
||||||
|
if (funix[i] != -1) {
|
||||||
|
logit(" nope, already open.\n");
|
||||||
continue;
|
continue;
|
||||||
if ((funix[i] = create_unix_socket(funixn[i])) != -1)
|
}
|
||||||
logit("Opened UNIX socket `%s'.\n", funixn[i]);
|
|
||||||
|
funix[i] = create_unix_socket(funixn[i]);
|
||||||
|
if (funix[i] == -1)
|
||||||
|
logit(" failed, error %d: %s\n", strerror(errno));
|
||||||
|
else
|
||||||
|
logit(" opened successfully\n", funixn[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cffwd() || AcceptRemote) {
|
if (cffwd() || AcceptRemote) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user