From owner-svn-src-head@freebsd.org Sat Apr 15 20:37:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74045D3F5E3; Sat, 15 Apr 2017 20:37:36 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 510DBF12; Sat, 15 Apr 2017 20:37:36 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3FKbZe2015052; Sat, 15 Apr 2017 20:37:35 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3FKbZ91015048; Sat, 15 Apr 2017 20:37:35 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201704152037.v3FKbZ91015048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 15 Apr 2017 20:37:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316981 - head/usr.sbin/newsyslog X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Apr 2017 20:37:36 -0000 Author: bapt Date: Sat Apr 15 20:37:34 2017 New Revision: 316981 URL: https://svnweb.freebsd.org/changeset/base/316981 Log: Add a new Y flag to newsyslog.conf This makes newsyslog use zstandard to compress log files. Given Z is already taken for gzip and zstandard compression level stands in between gzip and xz (which has the X flag) chosing Y sounds ok :) Modified: head/usr.sbin/newsyslog/newsyslog.8 head/usr.sbin/newsyslog/newsyslog.c head/usr.sbin/newsyslog/newsyslog.conf.5 head/usr.sbin/newsyslog/pathnames.h Modified: head/usr.sbin/newsyslog/newsyslog.8 ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.8 Sat Apr 15 20:15:44 2017 (r316980) +++ head/usr.sbin/newsyslog/newsyslog.8 Sat Apr 15 20:37:34 2017 (r316981) @@ -17,7 +17,7 @@ .\" the suitability of this software for any purpose. It is .\" provided "as is" without express or implied warranty. .\" -.Dd September 23, 2014 +.Dd April 15, 2017 .Dt NEWSYSLOG 8 .Os .Sh NAME @@ -288,6 +288,7 @@ accepted for backwards compatibility. .Xr bzip2 1 , .Xr gzip 1 , .Xr xz 1 , +.Xr zst 1 , .Xr syslog 3 , .Xr newsyslog.conf 5 , .Xr chown 8 , Modified: head/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.c Sat Apr 15 20:15:44 2017 (r316980) +++ head/usr.sbin/newsyslog/newsyslog.c Sat Apr 15 20:37:34 2017 (r316981) @@ -100,17 +100,22 @@ __FBSDID("$FreeBSD$"); #define COMPRESS_SUFFIX_XZ ".xz" #endif +#ifndef COMPRESS_SUFFIX_ZST +#define COMPRESS_SUFFIX_ZST ".zst" +#endif + #define COMPRESS_SUFFIX_MAXLEN MAX(MAX(sizeof(COMPRESS_SUFFIX_GZ),sizeof(COMPRESS_SUFFIX_BZ2)),sizeof(COMPRESS_SUFFIX_XZ)) /* * Compression types */ -#define COMPRESS_TYPES 4 /* Number of supported compression types */ +#define COMPRESS_TYPES 5 /* Number of supported compression types */ #define COMPRESS_NONE 0 #define COMPRESS_GZIP 1 #define COMPRESS_BZIP2 2 #define COMPRESS_XZ 3 +#define COMPRESS_ZSTD 4 /* * Bit-values for the 'flags' parsed from a config-file entry. @@ -149,7 +154,8 @@ static const struct compress_types compr { "", "", "" }, /* no compression */ { "Z", COMPRESS_SUFFIX_GZ, _PATH_GZIP }, /* gzip compression */ { "J", COMPRESS_SUFFIX_BZ2, _PATH_BZIP2 }, /* bzip2 compression */ - { "X", COMPRESS_SUFFIX_XZ, _PATH_XZ } /* xz compression */ + { "X", COMPRESS_SUFFIX_XZ, _PATH_XZ }, /* xz compression */ + { "Y", COMPRESS_SUFFIX_ZST, _PATH_ZSTD } /* zst compression */ }; struct conf_entry { @@ -1299,6 +1305,9 @@ no_trimat: case 'x': working->compress = COMPRESS_XZ; break; + case 'y': + working->compress = COMPRESS_ZSTD; + break; case 'z': working->compress = COMPRESS_GZIP; break; Modified: head/usr.sbin/newsyslog/newsyslog.conf.5 ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.conf.5 Sat Apr 15 20:15:44 2017 (r316980) +++ head/usr.sbin/newsyslog/newsyslog.conf.5 Sat Apr 15 20:37:34 2017 (r316981) @@ -21,7 +21,7 @@ .\" the suitability of this software for any purpose. It is .\" provided "as is" without express or implied warranty. .\" -.Dd October 24, 2015 +.Dd April 15, 2017 .Dt NEWSYSLOG.CONF 5 .Os .Sh NAME @@ -303,6 +303,12 @@ indicates that should attempt to save disk space by compressing the rotated log file using .Xr xz 1 . +.It Cm Y +indicates that +.Xr newsyslog 8 +should attempt to save disk space by compressing the rotated +log file using +.Xr zstd 1 . .It Cm N indicates that there is no process which needs to be signaled when this log file is rotated. Modified: head/usr.sbin/newsyslog/pathnames.h ============================================================================== --- head/usr.sbin/newsyslog/pathnames.h Sat Apr 15 20:15:44 2017 (r316980) +++ head/usr.sbin/newsyslog/pathnames.h Sat Apr 15 20:37:34 2017 (r316981) @@ -27,3 +27,4 @@ provided "as is" without express or impl #define _PATH_BZIP2 "/usr/bin/bzip2" #define _PATH_GZIP "/usr/bin/gzip" #define _PATH_XZ "/usr/bin/xz" +#define _PATH_ZSTD "/usr/bin/zstd"