svn commit: r272755 - in stable/9: contrib/libc-vis etc/rc.d sbin/devd share/man/man4 tools/tools/sysdoc
Brooks Davis
brooks at FreeBSD.org
Wed Oct 8 15:58:30 UTC 2014
Author: brooks
Date: Wed Oct 8 15:58:28 2014
New Revision: 272755
URL: https://svnweb.freebsd.org/changeset/base/272755
Log:
MFC r271287:
Merge from NetBSD:
PR/49185: Conrad Meyer: strvisx: Handle zero-length input strings
gracefully. (don't abuse 0 to mean compute string length internally)
PR: 193447
Submitted by: Conrad Meyer <conrad.meyer at isilon.com>
Modified:
stable/9/contrib/libc-vis/vis.c
stable/9/etc/rc.d/devd
stable/9/sbin/devd/devd.cc
stable/9/share/man/man4/devctl.4
stable/9/tools/tools/sysdoc/tunables.mdoc
Directory Properties:
stable/9/ (props changed)
stable/9/contrib/libc-vis/ (props changed)
stable/9/etc/ (props changed)
stable/9/etc/rc.d/ (props changed)
stable/9/sbin/ (props changed)
stable/9/sbin/devd/ (props changed)
stable/9/share/ (props changed)
stable/9/share/man/ (props changed)
stable/9/share/man/man4/ (props changed)
stable/9/tools/ (props changed)
stable/9/tools/tools/ (props changed)
stable/9/tools/tools/sysdoc/ (props changed)
Modified: stable/9/contrib/libc-vis/vis.c
==============================================================================
--- stable/9/contrib/libc-vis/vis.c Wed Oct 8 15:45:15 2014 (r272754)
+++ stable/9/contrib/libc-vis/vis.c Wed Oct 8 15:58:28 2014 (r272755)
@@ -1,4 +1,4 @@
-/* $NetBSD: vis.c,v 1.60 2013/02/21 16:21:20 joerg Exp $ */
+/* $NetBSD: vis.c,v 1.62 2014/09/08 17:35:01 christos Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -57,7 +57,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: vis.c,v 1.60 2013/02/21 16:21:20 joerg Exp $");
+__RCSID("$NetBSD: vis.c,v 1.62 2014/09/08 17:35:01 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#ifdef __FBSDID
__FBSDID("$FreeBSD$");
@@ -357,7 +357,7 @@ istrsenvisx(char *mbdst, size_t *dlen, c
ssize_t mbslength, maxolen;
_DIAGASSERT(mbdst != NULL);
- _DIAGASSERT(mbsrc != NULL);
+ _DIAGASSERT(mbsrc != NULL || mblength == 0);
_DIAGASSERT(mbextra != NULL);
/*
@@ -375,8 +375,6 @@ istrsenvisx(char *mbdst, size_t *dlen, c
/* Allocate space for the wide char strings */
psrc = pdst = extra = NULL;
- if (!mblength)
- mblength = strlen(mbsrc);
if ((psrc = calloc(mblength + 1, sizeof(*psrc))) == NULL)
return -1;
if ((pdst = calloc((4 * mblength) + 1, sizeof(*pdst))) == NULL)
@@ -528,6 +526,15 @@ out:
free(psrc);
return error;
}
+
+static int
+istrsenvisxl(char *mbdst, size_t *dlen, const char *mbsrc,
+ int flags, const char *mbextra, int *cerr_ptr)
+{
+ return istrsenvisx(mbdst, dlen, mbsrc,
+ mbsrc != NULL ? strlen(mbsrc) : 0, flags, mbextra, cerr_ptr);
+}
+
#endif
#if !HAVE_SVIS
@@ -571,13 +578,13 @@ snvis(char *mbdst, size_t dlen, int c, i
int
strsvis(char *mbdst, const char *mbsrc, int flags, const char *mbextra)
{
- return istrsenvisx(mbdst, NULL, mbsrc, 0, flags, mbextra, NULL);
+ return istrsenvisxl(mbdst, NULL, mbsrc, flags, mbextra, NULL);
}
int
strsnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags, const char *mbextra)
{
- return istrsenvisx(mbdst, &dlen, mbsrc, 0, flags, mbextra, NULL);
+ return istrsenvisxl(mbdst, &dlen, mbsrc, flags, mbextra, NULL);
}
int
@@ -646,13 +653,13 @@ nvis(char *mbdst, size_t dlen, int c, in
int
strvis(char *mbdst, const char *mbsrc, int flags)
{
- return istrsenvisx(mbdst, NULL, mbsrc, 0, flags, "", NULL);
+ return istrsenvisxl(mbdst, NULL, mbsrc, flags, "", NULL);
}
int
strnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags)
{
- return istrsenvisx(mbdst, &dlen, mbsrc, 0, flags, "", NULL);
+ return istrsenvisxl(mbdst, &dlen, mbsrc, flags, "", NULL);
}
/*
Modified: stable/9/etc/rc.d/devd
==============================================================================
--- stable/9/etc/rc.d/devd Wed Oct 8 15:45:15 2014 (r272754)
+++ stable/9/etc/rc.d/devd Wed Oct 8 15:58:28 2014 (r272755)
@@ -30,9 +30,10 @@ devd_prestart ()
{
find_pidfile
- # If devd is disabled, turn it off in the kernel to avoid memory leaks.
+ # If devd is disabled, turn it off in the kernel to avoid unnecessary
+ # memory usage.
if ! checkyesno ${rcvar}; then
- $SYSCTL hw.bus.devctl_disable=1
+ $SYSCTL hw.bus.devctl_queue=0
fi
}
Modified: stable/9/sbin/devd/devd.cc
==============================================================================
--- stable/9/sbin/devd/devd.cc Wed Oct 8 15:45:15 2014 (r272754)
+++ stable/9/sbin/devd/devd.cc Wed Oct 8 15:58:28 2014 (r272755)
@@ -99,7 +99,7 @@ __FBSDID("$FreeBSD$");
#define PIPE "/var/run/devd.pipe"
#define CF "/etc/devd.conf"
-#define SYSCTL "hw.bus.devctl_disable"
+#define SYSCTL "hw.bus.devctl_queue"
/*
* Since the client socket is nonblocking, we must increase its send buffer to
@@ -1119,9 +1119,9 @@ check_devd_enabled()
len = sizeof(val);
if (sysctlbyname(SYSCTL, &val, &len, NULL, 0) != 0)
errx(1, "devctl sysctl missing from kernel!");
- if (val) {
- warnx("Setting " SYSCTL " to 0");
- val = 0;
+ if (val == 0) {
+ warnx("Setting " SYSCTL " to 1000");
+ val = 1000;
sysctlbyname(SYSCTL, NULL, NULL, &val, sizeof(val));
}
}
Modified: stable/9/share/man/man4/devctl.4
==============================================================================
--- stable/9/share/man/man4/devctl.4 Wed Oct 8 15:45:15 2014 (r272754)
+++ stable/9/share/man/man4/devctl.4 Wed Oct 8 15:58:28 2014 (r272755)
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 11, 2003
+.Dd March 26, 2014
.Dt DEVCTL 4
.Os
.Sh NAME
@@ -73,9 +73,9 @@ If you try to read this device a charact
the rest of the data.
Listening programs are expected to cope.
.Pp
-The sysctl and boot parameter
-.Va hw.bus.devctl_disable
-is used to disable
+The sysctl
+.Va hw.bus.devctl_queue
+can be used to control queue length. It is set to 0 to disable
.Nm
when no
.Xr devd 8
Modified: stable/9/tools/tools/sysdoc/tunables.mdoc
==============================================================================
--- stable/9/tools/tools/sysdoc/tunables.mdoc Wed Oct 8 15:45:15 2014 (r272754)
+++ stable/9/tools/tools/sysdoc/tunables.mdoc Wed Oct 8 15:58:28 2014 (r272755)
@@ -233,16 +233,6 @@ See
for more information.
---
-hw.bus.devctl_disable
-bool
-
-This can be used to turn off
-.Xr devctl 4
-when no
-.Xr devd 8
-is running.
-
----
hw.bus.devices
---
More information about the svn-src-stable-9
mailing list