Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Apr 2017 19:27:14 +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: r316739 - head/lib/libc/gen
Message-ID:  <201704121927.v3CJREU8098655@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Wed Apr 12 19:27:14 2017
New Revision: 316739
URL: https://svnweb.freebsd.org/changeset/base/316739

Log:
  Report _SC_SEM_NSEMS_MAX and _SC_SEM_VALUE_MAX which show parameters
  of the current usermode implementation of the POSIX semaphores.
  
  For NSEMS_MAX, return -1 without changing errno, which indicates that
  the variable has no limit.  Before, sysconf(3) returned parameters
  queried from the ksem(9) legacy implementation, which apparently has
  low defaults for NSEMS_MAX.
  
  Reported and tested by:	jbeich
  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 Apr 12 19:23:41 2017	(r316738)
+++ head/lib/libc/gen/sysconf.c	Wed Apr 12 19:27:14 2017	(r316739)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include <limits.h>
 #include <paths.h>
 #include <pthread.h>		/* we just need the limits */
+#include <semaphore.h>
 #include <time.h>
 #include <unistd.h>
 #include "un-namespace.h"
@@ -299,13 +300,9 @@ do_NAME_MAX:
 		mib[1] = CTL_P1003_1B_RTSIG_MAX;
 		goto yesno;
 	case _SC_SEM_NSEMS_MAX:
-		mib[0] = CTL_P1003_1B;
-		mib[1] = CTL_P1003_1B_SEM_NSEMS_MAX;
-		goto yesno;
+		return (-1);
 	case _SC_SEM_VALUE_MAX:
-		mib[0] = CTL_P1003_1B;
-		mib[1] = CTL_P1003_1B_SEM_VALUE_MAX;
-		goto yesno;
+		return (SEM_VALUE_MAX);
 	case _SC_SIGQUEUE_MAX:
 		mib[0] = CTL_P1003_1B;
 		mib[1] = CTL_P1003_1B_SIGQUEUE_MAX;



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