From nobody Thu Sep 28 15:52:20 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RxHzm38sDz4ty9B; Thu, 28 Sep 2023 15:52:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RxHzm2khbz4JsX; Thu, 28 Sep 2023 15:52:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695916340; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=me8xWwILW21I9F0T/QRmVre8Ri0mT0eBNAZ5Dw2CdaQ=; b=fhgj0wHxpxyHdbeJdyStrIRp3kKcJiXtoKJK7vXmux9QsBECmJB80onIxBJxLT/xepSfNA CnukhTVke5IsW6BYi6/A9IO+MsgVu9cxAzyfcDKKd6XMVLlgdfdWm3OAcnQ+odm6QKJt8c QEZD4pJr8kRAmm1s7JnXHnw+Q/GhM5FSvpgdaLp+5AwfJm+TgnLPU8TMWajzCKNyUarXfL hpsXCZdcNBZlNpZo94kf4OyExfJE9/IPIafiqkeG/wG9qhZWRLZEzsIR/98T+Yam9tzgH9 IPGlV2z+u4a6VxaIkalxV4XKwi2RHL5SId5Kat1/razxQYV8q48nGOQPGng/rA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695916340; a=rsa-sha256; cv=none; b=SaHHryBHovHR4aBPCbUeQTgH0XNq5RMQQ9uiNHaNSl88O4GtqehRDGCcf1It0XGMcDJKtR P0TWb4SS89XI4sLQxFU00fY875MRWTaoi3YPsKkYTPD2UrN5ojXumxn62afbfRI5s2R+c9 dUsXKH8m1M31lZhAaM78AMtcE1RMajWyam/8bNh3zFxIjWSMH13gBNMONW6iQOXNqpRHDS y5J9L0EaRYxJ3X9p6Kbk6aoDRyLD0nhGxHY1ElVEk+fsmdCXFenR1oDM0nOspZAiE8Oijk +X3KXPfYxytFWqInj51jjmr8s2BssM2TZi710UUb9k+DH8vImrQKZvx16y8lzA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695916340; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=me8xWwILW21I9F0T/QRmVre8Ri0mT0eBNAZ5Dw2CdaQ=; b=pxBDMpNbL67ajmtl/vZE3KfrTLb0fv8yUQtEfxPo2VvEFWpVhLFcU3CnSdr/sr/9XKXN8g InU7a/P/PQNXsKSQsnmS31oh/E6VvDhi0ET5Phidegdfek7wpz4KhpMkELCrlYeSvgGxkb 4IZqB9s5cemXU2gQvOJGzy/W5607wQ0sawfQ8Lc0rUk/YL4pjBw42L2K5jFVj/fHfn625B pCFDWFaBnyS9laJUn/sLKjoKxHsfvzkOj2x/z8Y9+DJHcc+eZQHDw+i73fys0Pt6YDqUAQ /i3+kqMqXNPvKasIqlYnw3ZTcxI2oUZHcpkJMznjf8opoo9lY7mKnuu/SfOXvA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RxHzm1nj8zCqQ; Thu, 28 Sep 2023 15:52:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38SFqKI1021422; Thu, 28 Sep 2023 15:52:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38SFqKI9021419; Thu, 28 Sep 2023 15:52:20 GMT (envelope-from git) Date: Thu, 28 Sep 2023 15:52:20 GMT Message-Id: <202309281552.38SFqKI9021419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 518bd54167a8 - main - syslogd: Fix fd type, add enum for filed types List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 518bd54167a8990d1233f216d9ecd0db68f7bf81 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=518bd54167a8990d1233f216d9ecd0db68f7bf81 commit 518bd54167a8990d1233f216d9ecd0db68f7bf81 Author: Mark Johnston AuthorDate: 2023-09-01 02:48:18 +0000 Commit: Mark Johnston CommitDate: 2023-09-28 15:51:52 +0000 syslogd: Fix fd type, add enum for filed types Reviewed by: markj, emaste MFC after: 3 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41357 --- usr.sbin/syslogd/syslogd.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index de3d7c106f8a..701b062802b0 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -247,6 +247,17 @@ struct prop_filter { size_t pflt_strlen; }; +enum f_type { + F_UNUSED, /* unused entry */ + F_FILE, /* regular file */ + F_TTY, /* terminal */ + F_CONSOLE, /* console terminal */ + F_FORW, /* remote machine */ + F_USERS, /* list of users */ + F_WALL, /* everyone logged on */ + F_PIPE, /* pipe to program */ +}; + /* * This structure represents the files that will have log * copies printed. @@ -256,8 +267,8 @@ struct prop_filter { struct filed { STAILQ_ENTRY(filed) next; /* next in linked list */ - short f_type; /* entry type, see below */ - short f_file; /* file descriptor */ + enum f_type f_type; + int f_file; /* file descriptor */ time_t f_time; /* time this was last written */ char *f_host; /* host from which to recd. */ u_char f_pmask[LOG_NFACILITIES+1]; /* priority mask */ @@ -351,16 +362,6 @@ static int repeatinterval[] = { 30, 120, 600 }; /* # of secs before flush */ (f)->f_repeatcount = MAXREPEAT; \ } while (0) -/* values for f_type */ -#define F_UNUSED 0 /* unused entry */ -#define F_FILE 1 /* regular file */ -#define F_TTY 2 /* terminal */ -#define F_CONSOLE 3 /* console terminal */ -#define F_FORW 4 /* remote machine */ -#define F_USERS 5 /* list of users */ -#define F_WALL 6 /* everyone logged on */ -#define F_PIPE 7 /* pipe to program */ - static const char *TypeNames[] = { "UNUSED", "FILE", "TTY", "CONSOLE", "FORW", "USERS", "WALL", "PIPE" @@ -472,7 +473,6 @@ close_filed(struct filed *f) f->fu_forw_addr = NULL; } /* FALLTHROUGH */ - case F_FILE: case F_TTY: case F_CONSOLE: @@ -481,6 +481,8 @@ close_filed(struct filed *f) case F_PIPE: f->fu_pipe_pid = 0; break; + default: + break; } (void)close(f->f_file); f->f_file = -1; @@ -1978,6 +1980,8 @@ fprintlog_write(struct filed *f, struct iovlist *il, int flags) iovlist_append(il, "\r\n"); wallmsg(f, il->iov, il->iovcnt); break; + default: + break; } } @@ -2616,6 +2620,8 @@ init(int signo) deadq_enter(f->fu_pipe_pid, f->fu_pipe_pname); close_filed(f); break; + default: + break; } } while(!STAILQ_EMPTY(&fhead)) { @@ -2713,6 +2719,8 @@ init(int signo) for (i = 0; i < MAXUNAMES && *f->fu_uname[i]; i++) printf("%s, ", f->fu_uname[i]); break; + default: + break; } if (f->f_program) printf(" (%s)", f->f_program);