svn commit: r332546 - head/sys/powerpc/mpc85xx

2018-04-15 Thread Justin Hibbits
Author: jhibbits
Date: Mon Apr 16 04:02:53 2018
New Revision: 332546
URL: https://svnweb.freebsd.org/changeset/base/332546

Log:
  Use a resource hint instead of environment variable for DIU mode
  
  This makes it more consistent with FreeBSD norms, rather than using Linux's
  norms.  Now, instead of needing an environment variable
  
video-mode=fslfb:1280x1024@60
  
  Now one would use a hint:
  
hint.fb.0.mode=1280x1024@60

Modified:
  head/sys/powerpc/mpc85xx/fsl_diu.c

Modified: head/sys/powerpc/mpc85xx/fsl_diu.c
==
--- head/sys/powerpc/mpc85xx/fsl_diu.c  Mon Apr 16 03:58:08 2018
(r332545)
+++ head/sys/powerpc/mpc85xx/fsl_diu.c  Mon Apr 16 04:02:53 2018
(r332546)
@@ -363,12 +363,9 @@ diu_attach(device_t dev)
 
/* TODO: Eventually, allow EDID to be dynamically provided. */
if (OF_getprop_alloc(node, "edid", &edid_cells) <= 0) {
-   /*
-* u-boot uses the environment variable name 'video-mode', so
-* just use the same name here.  Should allow another variable
-* that better fits our design model, but this is fine.
-*/
-   if ((vm_name = kern_getenv("video-mode")) == NULL) {
+   /* Get a resource hint: hint.fb.N.mode */
+   if (resource_string_value(device_get_name(dev),
+   device_get_unit(dev), "mode", &vm_name) != 0) {
device_printf(dev,
"No EDID data and no video-mode env set\n");
return (ENXIO);
@@ -383,7 +380,7 @@ diu_attach(device_t dev)
videomode = edid.edid_preferred_mode;
} else {
/* Parse video-mode kenv variable. */
-   if ((err = sscanf(vm_name, "fslfb:%dx%d@%d", &w, &h, &r)) != 3) 
{
+   if ((err = sscanf(vm_name, "%dx%d@%d", &w, &h, &r)) != 3) {
device_printf(dev,
"Cannot parse video mode: %s\n", vm_name);
return (ENXIO);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r332527 - head/usr.sbin/daemon

2018-04-15 Thread Ian Lepore
Author: ian
Date: Mon Apr 16 03:35:43 2018
New Revision: 332527
URL: https://svnweb.freebsd.org/changeset/base/332527

Log:
  Fix cut-and-pasted line to have the right option letter.
  
  Reported by:  0mp@
  Pointy hat:   ian@

Modified:
  head/usr.sbin/daemon/daemon.8

Modified: head/usr.sbin/daemon/daemon.8
==
--- head/usr.sbin/daemon/daemon.8   Mon Apr 16 03:35:18 2018
(r332526)
+++ head/usr.sbin/daemon/daemon.8   Mon Apr 16 03:35:43 2018
(r332527)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 14, 2018
+.Dd April 15, 2018
 .Dt DAEMON 8
 .Os
 .Sh NAME
@@ -44,7 +44,7 @@
 .Op Fl s Ar syslog_priority
 .Op Fl T Ar syslog_tag
 .Op Fl l Ar syslog_facility
-.Op Fl T Ar restart_delay_seconds
+.Op Fl R Ar restart_delay_seconds
 .Ar command arguments ...
 .Sh DESCRIPTION
 The
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r332523 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2018-04-15 Thread Alexander Motin
Author: mav
Date: Mon Apr 16 00:54:58 2018
New Revision: 332523
URL: https://svnweb.freebsd.org/changeset/base/332523

Log:
  9433 Fix ARC hit rate
  
  When the compressed ARC feature was added in commit d3c2ae1
  the method of reference counting in the ARC was modified.  As
  part of this accounting change the arc_buf_add_ref() function
  was removed entirely.
  
  This would have be fine but the arc_buf_add_ref() function
  served a second undocumented purpose of updating the ARC access
  information when taking a hold on a dbuf.  Without this logic
  in place a cached dbuf would not migrate its associated
  arc_buf_hdr_t to the MFU list.  This would negatively impact
  the ARC hit rate, particularly on systems with a small ARC.
  
  This change reinstates the missing call to arc_access() from
  dbuf_hold() by implementing a new arc_buf_access() function.
  
  Reviewed-by: Giuseppe Di Natale 
  Reviewed-by: Tony Hutter 
  Reviewed-by: Tim Chase 
  Reviewed by: George Wilson 
  Reviewed-by: George Melikov 
  Signed-off-by: Brian Behlendorf 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Mon Apr 16 
00:42:45 2018(r332522)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Mon Apr 16 
00:54:58 2018(r332523)
@@ -540,8 +540,13 @@ typedef struct arc_stats {
 */
kstat_named_t arcstat_mutex_miss;
/*
+* Number of buffers skipped when updating the access state due to the
+* header having already been released after acquiring the hash lock.
+*/
+   kstat_named_t arcstat_access_skip;
+   /*
 * Number of buffers skipped because they have I/O in progress, are
-* indrect prefetch buffers that have not lived long enough, or are
+* indirect prefetch buffers that have not lived long enough, or are
 * not from the spa we're trying to evict from.
 */
kstat_named_t arcstat_evict_skip;
@@ -796,6 +801,7 @@ static arc_stats_t arc_stats = {
{ "allocated",  KSTAT_DATA_UINT64 },
{ "deleted",KSTAT_DATA_UINT64 },
{ "mutex_miss", KSTAT_DATA_UINT64 },
+   { "access_skip",KSTAT_DATA_UINT64 },
{ "evict_skip", KSTAT_DATA_UINT64 },
{ "evict_not_enough",   KSTAT_DATA_UINT64 },
{ "evict_l2_cached",KSTAT_DATA_UINT64 },
@@ -5063,6 +5069,51 @@ arc_access(arc_buf_hdr_t *hdr, kmutex_t *hash_lock)
} else {
ASSERT(!"invalid arc state");
}
+}
+
+/*
+ * This routine is called by dbuf_hold() to update the arc_access() state
+ * which otherwise would be skipped for entries in the dbuf cache.
+ */
+void
+arc_buf_access(arc_buf_t *buf)
+{
+   mutex_enter(&buf->b_evict_lock);
+   arc_buf_hdr_t *hdr = buf->b_hdr;
+
+   /*
+* Avoid taking the hash_lock when possible as an optimization.
+* The header must be checked again under the hash_lock in order
+* to handle the case where it is concurrently being released.
+*/
+   if (hdr->b_l1hdr.b_state == arc_anon || HDR_EMPTY(hdr)) {
+   mutex_exit(&buf->b_evict_lock);
+   ARCSTAT_BUMP(arcstat_access_skip);
+   return;
+   }
+
+   kmutex_t *hash_lock = HDR_LOCK(hdr);
+   mutex_enter(hash_lock);
+
+   if (hdr->b_l1hdr.b_state == arc_anon || HDR_EMPTY(hdr)) {
+   mutex_exit(hash_lock);
+   mutex_exit(&buf->b_evict_lock);
+   ARCSTAT_BUMP(arcstat_access_skip);
+   return;
+   }
+
+   mutex_exit(&buf->b_evict_lock);
+
+   ASSERT(hdr->b_l1hdr.b_state == arc_mru ||
+   hdr->b_l1hdr.b_state == arc_mfu);
+
+   DTRACE_PROBE1(arc__hit, arc_buf_hdr_t *, hdr);
+   arc_access(hdr, hash_lock);
+   mutex_exit(hash_lock);
+
+   ARCSTAT_BUMP(arcstat_hits);
+   ARCSTAT_CONDSTAT(!HDR_PREFETCH(hdr),
+   demand, prefetch, !HDR_ISTYPE_METADATA(hdr), data, metadata, hits);
 }
 
 /* a generic arc_done_func_t which you can use */

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Mon Apr 16 
00:42:45 2018(r332522)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Mon Apr 16 
00:54:58 2018(r332523)
@@ -2579,8 +2579,10 @@ top:
return (SET_ERROR(ENOENT));
}
 
-   if (db->db_buf != NULL)
+   if (db->db_buf != NULL) {
+   arc_buf_access(db->db_buf);

svn commit: r332518 - head/usr.sbin/daemon

2018-04-15 Thread Ian Lepore
Author: ian
Date: Sun Apr 15 21:46:08 2018
New Revision: 332518
URL: https://svnweb.freebsd.org/changeset/base/332518

Log:
  Add an option to daemon(8) to specify a delay between restarts of a
  supervised program.  The existing -r option has a hard-coded delay of one
  second.  This change adds a -R option which takes a delay in seconds.  This
  can be used to prevent log spam and rapid restarts, similar to init(8)'s
  behavior of adding a delay between rapid restarts when it's supervising a
  program.

Modified:
  head/usr.sbin/daemon/daemon.8
  head/usr.sbin/daemon/daemon.c

Modified: head/usr.sbin/daemon/daemon.8
==
--- head/usr.sbin/daemon/daemon.8   Sun Apr 15 20:29:37 2018
(r332517)
+++ head/usr.sbin/daemon/daemon.8   Sun Apr 15 21:46:08 2018
(r332518)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 22, 2016
+.Dd April 14, 2018
 .Dt DAEMON 8
 .Os
 .Sh NAME
@@ -44,6 +44,7 @@
 .Op Fl s Ar syslog_priority
 .Op Fl T Ar syslog_tag
 .Op Fl l Ar syslog_facility
+.Op Fl T Ar restart_delay_seconds
 .Ar command arguments ...
 .Sh DESCRIPTION
 The
@@ -114,7 +115,11 @@ regardless of whether the
 .Fl u
 option is used or not.
 .It Fl r
-Supervise and restart the program if it has been terminated.
+Supervise and restart the program after a one-second delay if it has
+been terminated.
+.It Fl R restart_delay_seconds
+Supervise and restart the program after the specified delay
+if it has been terminated.
 .It Fl t Ar title
 Set the title for the daemon process.
 The default is the daemonized invocation.

Modified: head/usr.sbin/daemon/daemon.c
==
--- head/usr.sbin/daemon/daemon.c   Sun Apr 15 20:29:37 2018
(r332517)
+++ head/usr.sbin/daemon/daemon.c   Sun Apr 15 21:46:08 2018
(r332518)
@@ -99,7 +99,7 @@ main(int argc, char *argv[])
dosyslog = 0;
outfn = NULL;
title = NULL;
-   while ((ch = getopt(argc, argv, "cfSp:P:ru:o:s:l:t:l:m:T:")) != -1) {
+   while ((ch = getopt(argc, argv, "cfSp:P:ru:o:s:l:t:l:m:R:T:")) != -1) {
switch (ch) {
case 'c':
nochdir = 0;
@@ -130,6 +130,11 @@ main(int argc, char *argv[])
case 'r':
restart = 1;
break;
+   case 'R':
+   restart = strtol(optarg, &p, 0);
+   if (p == optarg || restart < 1)
+   errx(6, "invalid restart delay");
+   break;
case 's':
logpri = get_log_mapping(optarg, prioritynames);
if (logpri == -1)
@@ -359,7 +364,7 @@ restart:
goto exit;
}
if (restart && !terminate) {
-   daemon_sleep(1, 0);
+   daemon_sleep(restart, 0);
close(pfd[0]);
pfd[0] = -1;
goto restart;
@@ -558,7 +563,7 @@ usage(void)
"usage: daemon [-cfrS] [-p child_pidfile] [-P supervisor_pidfile]\n"
"  [-u user] [-o output_file] [-t title]\n"
"  [-l syslog_facility] [-s syslog_priority]\n"
-   "  [-T syslog_tag] [-m output_mask]\n"
+   "  [-T syslog_tag] [-m output_mask] [-R 
restart_delay_secs]\n"
"command arguments ...\n");
exit(1);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r332515 - head/usr.sbin/cxgbetool

2018-04-15 Thread Navdeep Parhar
Author: np
Date: Sun Apr 15 19:23:37 2018
New Revision: 332515
URL: https://svnweb.freebsd.org/changeset/base/332515

Log:
  Fix typo in cxgbetool.8.

Modified:
  head/usr.sbin/cxgbetool/cxgbetool.8

Modified: head/usr.sbin/cxgbetool/cxgbetool.8
==
--- head/usr.sbin/cxgbetool/cxgbetool.8 Sun Apr 15 15:23:47 2018
(r332514)
+++ head/usr.sbin/cxgbetool/cxgbetool.8 Sun Apr 15 19:23:37 2018
(r332515)
@@ -562,7 +562,7 @@ Class Rate Limiting.
 .It Sy cl-wrr
 Class Weighted Round Robin.
 .Pp
-.It Sy cl-wrr
+.It Sy ch-rl
 Channel Rate Limiting.
 .El
 .It Sy mode Ar scheduler-mode
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r332512 - head/sys/conf

2018-04-15 Thread Brooks Davis
On Sun, Apr 15, 2018 at 07:28:29PM +0200, Dimitry Andric wrote:
> On 15 Apr 2018, at 17:37, Brooks Davis  wrote:
> > 
> > On Sun, Apr 15, 2018 at 10:33:18AM -0500, Benjamin Kaduk wrote:
> >> On Sun, Apr 15, 2018 at 10:13 AM, Brooks Davis  wrote:
> >> 
> >>> On Sun, Apr 15, 2018 at 03:06:07PM +, Brooks Davis wrote:
>  Author: brooks
>  Date: Sun Apr 15 15:06:07 2018
>  New Revision: 332512
>  URL: https://svnweb.freebsd.org/changeset/base/332512
>  
>  Log:
>   Remove device cm which was removed in r332490.
> >>> 
> >>> I'm quite confused by the fact that tinderbox didn't trip on this when I
> >>> ran it.  Are -DNO_CLEAN tinderbox builds insufficent for device removal?
> >>> 
> >> 
> >> Given that they would leave around the old object files needed to resolve
> >> stale
> >> references to removed driver components, it seems likely.
> > 
> > The thing is, config should have failed and it always runs in
> > -DNO_CLEAN buildkernel.  I expected the same to hold for tinderbox, but
> > apparently not.
> 
> But were any of the LINT files updated?  I guess not, if you didn't
> remove anything from NOTES.  I think it is likely that config will *not*
> be run again if the LINT files are older than their respective targets?

NOTES was updated because I did remove device arcnet, I just somehow
failed to find the cm(4) entries.  I'll just try to remember to do
-DNO_CLEAN kernel builds for future removals.

-- Brooks


signature.asc
Description: PGP signature


Re: svn commit: r332512 - head/sys/conf

2018-04-15 Thread Dimitry Andric
On 15 Apr 2018, at 17:37, Brooks Davis  wrote:
> 
> On Sun, Apr 15, 2018 at 10:33:18AM -0500, Benjamin Kaduk wrote:
>> On Sun, Apr 15, 2018 at 10:13 AM, Brooks Davis  wrote:
>> 
>>> On Sun, Apr 15, 2018 at 03:06:07PM +, Brooks Davis wrote:
 Author: brooks
 Date: Sun Apr 15 15:06:07 2018
 New Revision: 332512
 URL: https://svnweb.freebsd.org/changeset/base/332512
 
 Log:
  Remove device cm which was removed in r332490.
>>> 
>>> I'm quite confused by the fact that tinderbox didn't trip on this when I
>>> ran it.  Are -DNO_CLEAN tinderbox builds insufficent for device removal?
>>> 
>> 
>> Given that they would leave around the old object files needed to resolve
>> stale
>> references to removed driver components, it seems likely.
> 
> The thing is, config should have failed and it always runs in
> -DNO_CLEAN buildkernel.  I expected the same to hold for tinderbox, but
> apparently not.

But were any of the LINT files updated?  I guess not, if you didn't
remove anything from NOTES.  I think it is likely that config will *not*
be run again if the LINT files are older than their respective targets?

-Dimitry



signature.asc
Description: Message signed with OpenPGP


Re: svn commit: r332512 - head/sys/conf

2018-04-15 Thread Brooks Davis
On Sun, Apr 15, 2018 at 10:33:18AM -0500, Benjamin Kaduk wrote:
> On Sun, Apr 15, 2018 at 10:13 AM, Brooks Davis  wrote:
> 
> > On Sun, Apr 15, 2018 at 03:06:07PM +, Brooks Davis wrote:
> > > Author: brooks
> > > Date: Sun Apr 15 15:06:07 2018
> > > New Revision: 332512
> > > URL: https://svnweb.freebsd.org/changeset/base/332512
> > >
> > > Log:
> > >   Remove device cm which was removed in r332490.
> >
> > I'm quite confused by the fact that tinderbox didn't trip on this when I
> > ran it.  Are -DNO_CLEAN tinderbox builds insufficent for device removal?
> >
> 
> Given that they would leave around the old object files needed to resolve
> stale
> references to removed driver components, it seems likely.

The thing is, config should have failed and it always runs in
-DNO_CLEAN buildkernel.  I expected the same to hold for tinderbox, but
apparently not.

-- Brooks


signature.asc
Description: PGP signature


Re: svn commit: r332512 - head/sys/conf

2018-04-15 Thread Benjamin Kaduk
On Sun, Apr 15, 2018 at 10:13 AM, Brooks Davis  wrote:

> On Sun, Apr 15, 2018 at 03:06:07PM +, Brooks Davis wrote:
> > Author: brooks
> > Date: Sun Apr 15 15:06:07 2018
> > New Revision: 332512
> > URL: https://svnweb.freebsd.org/changeset/base/332512
> >
> > Log:
> >   Remove device cm which was removed in r332490.
>
> I'm quite confused by the fact that tinderbox didn't trip on this when I
> ran it.  Are -DNO_CLEAN tinderbox builds insufficent for device removal?
>

Given that they would leave around the old object files needed to resolve
stale
references to removed driver components, it seems likely.

-Ben
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r332514 - head

2018-04-15 Thread Brooks Davis
Author: brooks
Date: Sun Apr 15 15:23:47 2018
New Revision: 332514
URL: https://svnweb.freebsd.org/changeset/base/332514

Log:
  Manpages are .gz files.
  
  Reported by:  trasz

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Sun Apr 15 15:22:28 2018(r332513)
+++ head/ObsoleteFiles.inc  Sun Apr 15 15:23:47 2018(r332514)
@@ -40,7 +40,7 @@
 
 # 20180413: remove Arcnet support
 OLD_FILES+=usr/include/net/if_arc.h
-OLD_FILES+=usr/share/man/man4/cm.4
+OLD_FILES+=usr/share/man/man4/cm.4.gz
 # 20180409: remove FDDI support
 OLD_FILES+=usr/include/net/fddi.h
 OLD_FILES+=usr/share/man/man4/fpa.4.gz
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r332512 - head/sys/conf

2018-04-15 Thread Brooks Davis
On Sun, Apr 15, 2018 at 03:06:07PM +, Brooks Davis wrote:
> Author: brooks
> Date: Sun Apr 15 15:06:07 2018
> New Revision: 332512
> URL: https://svnweb.freebsd.org/changeset/base/332512
> 
> Log:
>   Remove device cm which was removed in r332490.

I'm quite confused by the fact that tinderbox didn't trip on this when I
ran it.  Are -DNO_CLEAN tinderbox builds insufficent for device removal?

-- Brooks


signature.asc
Description: PGP signature


svn commit: r332512 - head/sys/conf

2018-04-15 Thread Brooks Davis
Author: brooks
Date: Sun Apr 15 15:06:07 2018
New Revision: 332512
URL: https://svnweb.freebsd.org/changeset/base/332512

Log:
  Remove device cm which was removed in r332490.

Modified:
  head/sys/conf/NOTES

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Sun Apr 15 08:44:26 2018(r332511)
+++ head/sys/conf/NOTES Sun Apr 15 15:06:07 2018(r332512)
@@ -2066,11 +2066,6 @@ device   xmphy   # XaQti XMAC II
 
 # Order for ISA devices is important here
 
-device cm
-hint.cm.0.at="isa"
-hint.cm.0.port="0x2e0"
-hint.cm.0.irq="9"
-hint.cm.0.maddr="0xdc000"
 device ep
 device ex
 device fe
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r332511 - head/usr.sbin/syslogd

2018-04-15 Thread Ed Schouten
Author: ed
Date: Sun Apr 15 08:44:26 2018
New Revision: 332511
URL: https://svnweb.freebsd.org/changeset/base/332511

Log:
  Use proper alphabetic sorting of options.

Modified:
  head/usr.sbin/syslogd/syslogd.8

Modified: head/usr.sbin/syslogd/syslogd.8
==
--- head/usr.sbin/syslogd/syslogd.8 Sun Apr 15 08:34:16 2018
(r332510)
+++ head/usr.sbin/syslogd/syslogd.8 Sun Apr 15 08:44:26 2018
(r332511)
@@ -28,7 +28,7 @@
 .\" @(#)syslogd.8  8.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd April 9, 2018
+.Dd April 15, 2018
 .Dt SYSLOGD 8
 .Os
 .Sh NAME
@@ -243,20 +243,6 @@ Usually the
 .Dq kern
 facility is reserved for messages read directly from
 .Pa /dev/klog .
-.It Fl O Ar format
-Select the output format of generated log messages.
-The values
-.Ar bsd
-and
-.Ar rfc3164
-are used to generate RFC 3164 log messages.
-The values
-.Ar syslog
-and
-.Ar rfc5424
-are used to generate RFC 5424 log messages,
-having RFC 3339 timestamps with microsecond precision.
-The default is to generate RFC 3164 log messages.
 .It Fl m Ar mark_interval
 Select the number of minutes between
 .Dq mark
@@ -274,6 +260,20 @@ This option inherits
 .Fl s .
 .It Fl n
 Disable DNS query for every request.
+.It Fl O Ar format
+Select the output format of generated log messages.
+The values
+.Ar bsd
+and
+.Ar rfc3164
+are used to generate RFC 3164 log messages.
+The values
+.Ar syslog
+and
+.Ar rfc5424
+are used to generate RFC 5424 log messages,
+having RFC 3339 timestamps with microsecond precision.
+The default is to generate RFC 3164 log messages.
 .It Fl o
 Prefix kernel messages with the full kernel boot file as determined by
 .Xr getbootfile 3 .
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r332510 - in head: usr.bin/wall usr.sbin/syslogd

2018-04-15 Thread Ed Schouten
Author: ed
Date: Sun Apr 15 08:34:16 2018
New Revision: 332510
URL: https://svnweb.freebsd.org/changeset/base/332510

Log:
  Add RFC 5424 syslog message output to syslogd.
  
  - Move all of the code responsible for transmitting log messages into a
separate function, fprintlog_write().
  - Instead of manually modifying a list of iovecs, add a structure
iovlist with some helper functions.
  - Alter the F_FORW (UDP message forwarding) case to also use iovecs like
the other cases. Use sendmsg() instead of sendto().
  - In the case of F_FORW, truncate the message to a size dependent on the
address family (AF_INET, AF_INET6), as proposed by RFC 5426.
  - Move all traditional message formatting into fprintlog_bsd(). Get rid
of some of the string copying and snprintf()'ing. Simply emit more
iovecs to get the job done.
  - Increase ttymsg()'s limit of 7 iovecs to 32. Add a definition for this
limit, so it can be reused by iovlist.
  - Add fprintlog_rfc5424() to emit RFC 5424 formatted log entries.
  - Add a "-O" command line option to enable RFC 5424 formatting. It would
have been nicer if we supported "-o rfc5424", just like on NetBSD.
Unfortunately, the "-o" flag is already used for a different purpose
on FreeBSD.
  - Don't truncate hostnames in the RFC 5424 case, as suggested by that
specific RFC.
  
  For people interested in using this, this feature can be enabled by
  adding the following line to /etc/rc.conf:
  
syslogd_flags="-s -O rfc5424"
  
  Differential Revision:https://reviews.freebsd.org/D15011

Modified:
  head/usr.bin/wall/ttymsg.c
  head/usr.bin/wall/ttymsg.h
  head/usr.sbin/syslogd/syslogd.8
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.bin/wall/ttymsg.c
==
--- head/usr.bin/wall/ttymsg.c  Sat Apr 14 22:14:18 2018(r332509)
+++ head/usr.bin/wall/ttymsg.c  Sun Apr 15 08:34:16 2018(r332510)
@@ -61,7 +61,7 @@ static const char sccsid[] = "@(#)ttymsg.c8.2 (Berkel
 const char *
 ttymsg(struct iovec *iov, int iovcnt, const char *line, int tmout)
 {
-   struct iovec localiov[7];
+   struct iovec localiov[TTYMSG_IOV_MAX];
ssize_t left, wret;
int cnt, fd;
char device[MAXNAMLEN] = _PATH_DEV;

Modified: head/usr.bin/wall/ttymsg.h
==
--- head/usr.bin/wall/ttymsg.h  Sat Apr 14 22:14:18 2018(r332509)
+++ head/usr.bin/wall/ttymsg.h  Sun Apr 15 08:34:16 2018(r332510)
@@ -1,3 +1,5 @@
 /* $FreeBSD$ */
 
+#defineTTYMSG_IOV_MAX  32
+
 const char *ttymsg(struct iovec *, int, const char *, int);

Modified: head/usr.sbin/syslogd/syslogd.8
==
--- head/usr.sbin/syslogd/syslogd.8 Sat Apr 14 22:14:18 2018
(r332509)
+++ head/usr.sbin/syslogd/syslogd.8 Sun Apr 15 08:34:16 2018
(r332510)
@@ -28,7 +28,7 @@
 .\" @(#)syslogd.8  8.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd November 28, 2017
+.Dd April 9, 2018
 .Dt SYSLOGD 8
 .Os
 .Sh NAME
@@ -42,6 +42,7 @@
 .Op Fl f Ar config_file
 .Op Fl l Oo Ar mode Ns \&: Oc Ns Ar path
 .Op Fl m Ar mark_interval
+.Op Fl O Ar format
 .Op Fl P Ar pid_file
 .Op Fl p Ar log_socket
 .Op Fl S Ar logpriv_socket
@@ -242,6 +243,20 @@ Usually the
 .Dq kern
 facility is reserved for messages read directly from
 .Pa /dev/klog .
+.It Fl O Ar format
+Select the output format of generated log messages.
+The values
+.Ar bsd
+and
+.Ar rfc3164
+are used to generate RFC 3164 log messages.
+The values
+.Ar syslog
+and
+.Ar rfc5424
+are used to generate RFC 5424 log messages,
+having RFC 3339 timestamps with microsecond precision.
+The default is to generate RFC 3164 log messages.
 .It Fl m Ar mark_interval
 Select the number of minutes between
 .Dq mark

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Sat Apr 14 22:14:18 2018
(r332509)
+++ head/usr.sbin/syslogd/syslogd.c Sun Apr 15 08:34:16 2018
(r332510)
@@ -136,6 +136,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -367,9 +368,12 @@ static int KeepKernFac;/* Keep remotely logged kernel
 static int needdofsync = 0; /* Are any file(s) waiting to be fsynced? */
 static struct pidfh *pfh;
 static int sigpipe[2]; /* Pipe to catch a signal during select(). */
+static boolRFC3164OutputFormat = true; /* Use legacy format by default. */
 
 static volatile sig_atomic_t MarkSet, WantDie, WantInitialize, WantReapchild;
 
+struct iovlist;
+
 static int allowaddr(char *);
 static int addfile(struct filed *);
 static int addpeer(struct peer *);
@@ -386,6 +390,7 @@ static void dofsync(void);
 static voiddomark(int);
 static voidfprintlog_first(struct file