Skip to content
BSD syscall#274

svc · unix #274

sem_getvalue

Reads the current value of a POSIX semaphore without modifying it.

Prototype

int sem_getvalue(sem_t *sem, int *sval);

Returns: int

Arguments

NameTypeDirDescription
semsem_t-
svalint-

Version history

XNU tagmacOS#
xnu-1456.1.26macOS 10.6 Snow Leopard274
xnu-1699.24.8macOS 10.7 Lion274
xnu-2050.18.24macOS 10.8 Mountain Lion274
xnu-2422.115.4macOS 10.9 Mavericks274
xnu-1486.2.11—274
xnu-1504.15.3—274
xnu-1504.3.12—274
xnu-1504.7.4—274
xnu-1504.9.17—274
xnu-1504.9.26—274
xnu-1504.9.37—274
xnu-1699.22.73—274
xnu-1699.22.81—274
xnu-1699.24.23—274
xnu-1699.26.8—274
xnu-1699.32.7—274
xnu-2050.22.13—274
xnu-2050.24.15—274
xnu-2050.48.11—274
xnu-2050.7.9—274
xnu-2050.9.2—274
xnu-2422.1.72—274
xnu-2422.100.13—274
xnu-2422.110.17—274
xnu-2422.90.20—274

Notes

Returns the observed counter at the moment of the call; concurrent waiters or posters may change the value before the caller acts on it. POSIX allows the implementation to return a negative value reflecting the number of waiters, but Darwin returns only the non-negative count.

Related APIs

sem_waitsem_postsem_trywait