How to define SEM_NSEMS_MAX?

Mike Frysinger vapier@gentoo.org
Thu Apr 12 02:03:00 GMT 2012


On Wednesday 11 April 2012 21:47:34 Neil wrote:
> When I call
> max = sysconf(_SC_SEM_NSEMS_MAX);
> it returns -1
> 
> then I check the glibc code in file sysdeps/posix/sysconf.c:
> ------------------------------------------------
>     case _SC_SEM_NSEMS_MAX:
> #ifdef  SEM_NSEMS_MAX
>       return SEM_NSEMS_MAX;
> #else
>       return -1;
> #endif
> ------------------------------------------------
> 
> I grep the source code tree that SEM_NSEMS_MAX is not defined.
> So where can I define the SEM_NSEMS_MAX? Should it be defined in glibc
> source code tree or some configuration file else?

returning -1 is correct behavior.  please consult the POSIX spec:
	http://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.html

RETURN VALUE

... If the variable corresponding to name is described in <limits.h> as a 
maximum or minimum value and the variable has no limit, sysconf() shall return 
-1 without changing the value of errno. ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/libc-help/attachments/20120412/6e59f241/attachment.sig>


More information about the Libc-help mailing list