Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Implement sysconf(3) _SC_GETGR_R_SIZE_MAX and _SC_GETPW_R_SI...
details: https://anonhg.NetBSD.org/src/rev/4085924462bf
branches: trunk
changeset: 571044:4085924462bf
user: lukem <lukem%NetBSD.org@localhost>
date: Wed Nov 10 04:02:52 2004 +0000
description:
Implement sysconf(3) _SC_GETGR_R_SIZE_MAX and _SC_GETPW_R_SIZE_MAX for
the 1003.1-2001 Thread Safe Functions (TSF) getgrnam_r(3) and getpwnam_r(3).
These are not implemented in sysctl(3) "user.*", since that adds a lot
of complexity in the implementation for no real benefit.
diffstat:
include/limits.h | 6 +++++-
lib/libc/gen/sysconf.c | 11 +++++++++--
sys/sys/unistd.h | 8 +++++---
usr.bin/getconf/getconf.c | 9 +++++++--
4 files changed, 26 insertions(+), 8 deletions(-)
diffs (125 lines):
diff -r e092a263c8a9 -r 4085924462bf include/limits.h
--- a/include/limits.h Wed Nov 10 03:57:23 2004 +0000
+++ b/include/limits.h Wed Nov 10 04:02:52 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: limits.h,v 1.22 2003/08/07 09:44:10 agc Exp $ */
+/* $NetBSD: limits.h,v 1.23 2004/11/10 04:02:52 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -90,6 +90,10 @@
#define NL_SETMAX 255
#define NL_TEXTMAX 2048
+ /* IEEE Std 1003.1-2001 TSF */
+#define _GETGR_R_SIZE_MAX 1024
+#define _GETPW_R_SIZE_MAX 1024
+
/* Always ensure that this is consistent with <stdio.h> */
#ifndef TMP_MAX
#define TMP_MAX 308915776 /* Legacy */
diff -r e092a263c8a9 -r 4085924462bf lib/libc/gen/sysconf.c
--- a/lib/libc/gen/sysconf.c Wed Nov 10 03:57:23 2004 +0000
+++ b/lib/libc/gen/sysconf.c Wed Nov 10 04:02:52 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysconf.c,v 1.19 2003/08/07 16:42:57 agc Exp $ */
+/* $NetBSD: sysconf.c,v 1.20 2004/11/10 04:02:52 lukem Exp $ */
/*-
* Copyright (c) 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)sysconf.c 8.2 (Berkeley) 3/20/94";
#else
-__RCSID("$NetBSD: sysconf.c,v 1.19 2003/08/07 16:42:57 agc Exp $");
+__RCSID("$NetBSD: sysconf.c,v 1.20 2004/11/10 04:02:52 lukem Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -80,6 +80,7 @@
len = sizeof(value);
switch (name) {
+
/* 1003.1 */
case _SC_ARG_MAX:
mib[0] = CTL_KERN;
@@ -289,6 +290,12 @@
mib[1] = USER_ATEXIT_MAX;
break;
+/* 1003.1-2001, TSF */
+ case _SC_GETGR_R_SIZE_MAX:
+ return _GETGR_R_SIZE_MAX;
+ case _SC_GETPW_R_SIZE_MAX:
+ return _GETPW_R_SIZE_MAX;
+
yesno: if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
return (-1);
if (value == 0)
diff -r e092a263c8a9 -r 4085924462bf sys/sys/unistd.h
--- a/sys/sys/unistd.h Wed Nov 10 03:57:23 2004 +0000
+++ b/sys/sys/unistd.h Wed Nov 10 04:02:52 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: unistd.h,v 1.30 2003/11/15 01:19:38 thorpej Exp $ */
+/* $NetBSD: unistd.h,v 1.31 2004/11/10 04:02:52 lukem Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -125,7 +125,7 @@
#define FFILESYNC 0x0020 /* sync data and metadata */
#endif
-/* configurable pathname variables */
+/* configurable pathname variables; use as argument to pathconf(3) */
#define _PC_LINK_MAX 1
#define _PC_MAX_CANON 2
#define _PC_MAX_INPUT 3
@@ -138,7 +138,7 @@
#define _PC_SYNC_IO 10
#define _PC_FILESIZEBITS 11
-/* configurable system variables */
+/* configurable system variables; use as argument to sysconf(3) */
/*
* XXX The value of _SC_CLK_TCK is embedded in <time.h>.
* XXX The value of _SC_PAGESIZE is embedded in <sys/shm.h>.
@@ -190,6 +190,8 @@
#define _SC_TIMERS 44
#define _SC_SPIN_LOCKS 45
#define _SC_READER_WRITER_LOCKS 46
+#define _SC_GETGR_R_SIZE_MAX 47
+#define _SC_GETPW_R_SIZE_MAX 48
/* configurable system strings */
#define _CS_PATH 1
diff -r e092a263c8a9 -r 4085924462bf usr.bin/getconf/getconf.c
--- a/usr.bin/getconf/getconf.c Wed Nov 10 03:57:23 2004 +0000
+++ b/usr.bin/getconf/getconf.c Wed Nov 10 04:02:52 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getconf.c,v 1.21 2004/11/10 00:29:07 lukem Exp $ */
+/* $NetBSD: getconf.c,v 1.22 2004/11/10 04:02:52 lukem Exp $ */
/*-
* Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: getconf.c,v 1.21 2004/11/10 00:29:07 lukem Exp $");
+__RCSID("$NetBSD: getconf.c,v 1.22 2004/11/10 04:02:52 lukem Exp $");
#endif /* not lint */
#include <err.h>
@@ -165,6 +165,11 @@
/* POSIX.1-2001 XSI Option Group Configurable System Variables */
{ "ATEXIT_MAX", SYSCONF, _SC_ATEXIT_MAX },
+
+ /* POSIX.1-2001 TSF Configurable System Variables */
+ { "GETGR_R_SIZE_MAX", SYSCONF, _SC_GETGR_R_SIZE_MAX },
+ { "GETPW_R_SIZE_MAX", SYSCONF, _SC_GETPW_R_SIZE_MAX },
+
{ NULL }
};
Home |
Main Index |
Thread Index |
Old Index