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
This commit is contained in:
Konstantin Belousov 2017-04-12 19:27:14 +00:00
parent bf43319445
commit f6ef11cc75
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=316739

View File

@ -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 @@ sysconf(int name)
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;