This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Where the SEM_NSEMS_MAX is defined?


Ryan S. Arnold wrote:
> Perhaps _POSIX_SEM_NSEMS_MAX is an artifact of some historical
> semaphore pool concept?
>
> Ryan
Posix specifies errors for which a conforming implementation may fail the
(in this instance) semaphore creation. But an implementation can as well
not impose such limits.

We can easily test the Linux limits:
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
int main() {
    errno = 0;
    long limit = sysconf(_SC_SEM_NSEMS_MAX);
    printf("Limit: %ld\nerrno: %d\n\n", limit, errno);
    return 0;
}

Which return
> Limit: -1
> errno: 0
And from sysconf(3):
> In the case of limits, -1 means that there is no definite limit.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]