Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Jul 2014 19:12:19 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r268467 - head/lib/libc/gen
Message-ID:  <201407091912.s69JCJhl067755@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Wed Jul  9 19:12:18 2014
New Revision: 268467
URL: http://svnweb.freebsd.org/changeset/base/268467

Log:
  Implement sysconf(_SC_GETGR_R_SIZE_MAX) and sysconf(_SC_GETPW_R_SIZE_MAX).
  
  Reported by:	Dmitry Sivachenko <trtrmitya@gmail.com>
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/lib/libc/gen/sysconf.c

Modified: head/lib/libc/gen/sysconf.c
==============================================================================
--- head/lib/libc/gen/sysconf.c	Wed Jul  9 19:11:57 2014	(r268466)
+++ head/lib/libc/gen/sysconf.c	Wed Jul  9 19:12:18 2014	(r268467)
@@ -367,11 +367,17 @@ yesno:
 		 * _POSIX_FILE_LOCKING, so we can't answer this one.
 		 */
 #endif
-#if _POSIX_THREAD_SAFE_FUNCTIONS > -1
+
+	/*
+	 * SUSv4tc1 says the following about _SC_GETGR_R_SIZE_MAX and
+	 * _SC_GETPW_R_SIZE_MAX:
+	 * Note that sysconf(_SC_GETGR_R_SIZE_MAX) may return -1 if
+	 * there is no hard limit on the size of the buffer needed to
+	 * store all the groups returned.
+	 */
 	case _SC_GETGR_R_SIZE_MAX:
 	case _SC_GETPW_R_SIZE_MAX:
-#error "somebody needs to implement this"
-#endif
+		return (-1);
 	case _SC_HOST_NAME_MAX:
 		return (MAXHOSTNAMELEN - 1); /* does not include \0 */
 	case _SC_LOGIN_NAME_MAX:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407091912.s69JCJhl067755>