After one too many PRs on the subject, bite the bullet and define IOV_MAX
and its associated constants. Implement _SC_IOV_MAX in the usual way. Be a bit sloppy about the namespace question; this should get cleared up in time for 5.0. MFC after: 1 month
This commit is contained in:
parent
0f77799115
commit
37336173d3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=78431
@ -62,6 +62,7 @@
|
|||||||
#define _POSIX2_LINE_MAX 2048
|
#define _POSIX2_LINE_MAX 2048
|
||||||
#define _POSIX2_RE_DUP_MAX 255
|
#define _POSIX2_RE_DUP_MAX 255
|
||||||
|
|
||||||
|
#define _XOPEN_IOV_MAX 16
|
||||||
|
|
||||||
#ifdef _P1003_1B_VISIBLE
|
#ifdef _P1003_1B_VISIBLE
|
||||||
|
|
||||||
|
@ -38,6 +38,11 @@
|
|||||||
static char sccsid[] = "@(#)sysconf.c 8.2 (Berkeley) 3/20/94";
|
static char sccsid[] = "@(#)sysconf.c 8.2 (Berkeley) 3/20/94";
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
|
#if defined(LIBC_RCS) && !defined(lint)
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$FreeBSD$";
|
||||||
|
#endif /* LIBC_RCS and not lint */
|
||||||
|
|
||||||
#include <sys/_posix.h>
|
#include <sys/_posix.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
@ -285,6 +290,13 @@ sysconf(name)
|
|||||||
goto yesno;
|
goto yesno;
|
||||||
#endif /* _P1003_1B_VISIBLE */
|
#endif /* _P1003_1B_VISIBLE */
|
||||||
|
|
||||||
|
#ifdef _SC_IOV_MAX
|
||||||
|
case _SC_IOV_MAX:
|
||||||
|
mib[0] = CTL_KERN;
|
||||||
|
mib[1] = KERN_IOV_MAX;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
yesno: if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
|
yesno: if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
|
||||||
return (-1);
|
return (-1);
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
#include <sys/resourcevar.h>
|
#include <sys/resourcevar.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
#include <sys/vnode.h>
|
#include <sys/vnode.h>
|
||||||
|
|
||||||
#include <vm/vm.h>
|
#include <vm/vm.h>
|
||||||
@ -56,6 +57,9 @@
|
|||||||
|
|
||||||
static void uio_yield __P((void));
|
static void uio_yield __P((void));
|
||||||
|
|
||||||
|
SYSCTL_INT(_kern, KERN_IOV_MAX, iov_max, CTLFLAG_RD, NULL, UIO_MAXIOV,
|
||||||
|
"Maximum number of elements in an I/O vector; sysconf(_SC_IOV_MAX)");
|
||||||
|
|
||||||
int
|
int
|
||||||
uiomove(cp, n, uio)
|
uiomove(cp, n, uio)
|
||||||
register caddr_t cp;
|
register caddr_t cp;
|
||||||
|
@ -328,7 +328,8 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
|
|||||||
#define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */
|
#define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */
|
||||||
#define KERN_USRSTACK 33 /* int: address of USRSTACK */
|
#define KERN_USRSTACK 33 /* int: address of USRSTACK */
|
||||||
#define KERN_LOGSIGEXIT 34 /* int: do we log sigexit procs? */
|
#define KERN_LOGSIGEXIT 34 /* int: do we log sigexit procs? */
|
||||||
#define KERN_MAXID 35 /* number of valid kern ids */
|
#define KERN_IOV_MAX 35 /* int: value of UIO_MAXIOV */
|
||||||
|
#define KERN_MAXID 36 /* number of valid kern ids */
|
||||||
|
|
||||||
#define CTL_KERN_NAMES { \
|
#define CTL_KERN_NAMES { \
|
||||||
{ 0, 0 }, \
|
{ 0, 0 }, \
|
||||||
@ -366,6 +367,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
|
|||||||
{ "ps_strings", CTLTYPE_INT }, \
|
{ "ps_strings", CTLTYPE_INT }, \
|
||||||
{ "usrstack", CTLTYPE_INT }, \
|
{ "usrstack", CTLTYPE_INT }, \
|
||||||
{ "logsigexit", CTLTYPE_INT }, \
|
{ "logsigexit", CTLTYPE_INT }, \
|
||||||
|
{ "iov_max", CTLTYPE_INT }, \
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#define PATH_MAX 1024 /* max bytes in pathname */
|
#define PATH_MAX 1024 /* max bytes in pathname */
|
||||||
#define PIPE_BUF 512 /* max bytes for atomic pipe writes */
|
#define PIPE_BUF 512 /* max bytes for atomic pipe writes */
|
||||||
|
#define IOV_MAX 1024 /* max elements in i/o vector */
|
||||||
|
|
||||||
#define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */
|
#define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */
|
||||||
#define BC_DIM_MAX 2048 /* max array elements in bc(1) */
|
#define BC_DIM_MAX 2048 /* max array elements in bc(1) */
|
||||||
|
@ -70,6 +70,14 @@ struct uio {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Limits
|
* Limits
|
||||||
|
*
|
||||||
|
* N.B.: UIO_MAXIOV must be no less than IOV_MAX from <sys/syslimits.h>
|
||||||
|
* which in turn must be no less than _XOPEN_IOV_MAX from <limits.h>. If
|
||||||
|
* we ever make this tunable (probably pointless), then IOV_MAX should be
|
||||||
|
* removed from <sys/syslimits.h> and applications would be expected to use
|
||||||
|
* sysconf(3) to find out the correct value, or else assume the worst
|
||||||
|
* (_XOPEN_IOV_MAX). Perhaps UIO_MAXIOV should be simply defined as
|
||||||
|
* IOV_MAX.
|
||||||
*/
|
*/
|
||||||
#define UIO_MAXIOV 1024 /* max 1K of iov's */
|
#define UIO_MAXIOV 1024 /* max 1K of iov's */
|
||||||
#define UIO_SMALLIOV 8 /* 8 on stack, else malloc */
|
#define UIO_SMALLIOV 8 /* 8 on stack, else malloc */
|
||||||
|
@ -198,6 +198,8 @@
|
|||||||
|
|
||||||
#endif /* _P1003_1B_VISIBLE */
|
#endif /* _P1003_1B_VISIBLE */
|
||||||
|
|
||||||
|
#define _SC_IOV_MAX 56
|
||||||
|
|
||||||
#ifndef _POSIX_SOURCE
|
#ifndef _POSIX_SOURCE
|
||||||
/*
|
/*
|
||||||
* rfork() options.
|
* rfork() options.
|
||||||
|
Loading…
Reference in New Issue
Block a user