semaphore.h: Add SEM_VALUE_MAX.
It's specified in POSIX, and FreeBSD puts it in this file. Distinguish it from _POSIX_SEM_VALUE_MAX (which is really a "minimum value this can have" as specified in POSIX.)
This commit is contained in:
@@ -21,7 +21,8 @@ typedef struct _sem_t {
|
||||
int32_t padding[2];
|
||||
} sem_t;
|
||||
|
||||
#define SEM_FAILED ((sem_t*)(long)-1)
|
||||
#define SEM_FAILED ((sem_t*)(long)-1)
|
||||
#define SEM_VALUE_MAX INT_MAX
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#define MAX_POSIX_SEMS_PER_TEAM _POSIX_SEM_NSEMS_MAX
|
||||
#define MAX_POSIX_SEMS 1024
|
||||
#define MAX_POSIX_SEM_VALUE _POSIX_SEM_VALUE_MAX
|
||||
|
||||
|
||||
#endif // SYSTEM_REALTIME_SEM_H
|
||||
|
||||
@@ -679,7 +679,7 @@ _user_realtime_sem_open(const char* userName, int openFlagsOrShared,
|
||||
if (context == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
if (semCount > MAX_POSIX_SEM_VALUE)
|
||||
if (semCount > SEM_VALUE_MAX)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
// userSem must always be given
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <semaphore.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -96,7 +97,7 @@ __sysconf(int name)
|
||||
// unlimited, instead of _POSIX_SEM_NSEMS_MAX
|
||||
return -1;
|
||||
case _SC_SEM_VALUE_MAX:
|
||||
return _POSIX_SEM_VALUE_MAX;
|
||||
return SEM_VALUE_MAX;
|
||||
case _SC_IOV_MAX:
|
||||
return IOV_MAX;
|
||||
case _SC_NPROCESSORS_CONF:
|
||||
|
||||
Reference in New Issue
Block a user