From: Waldemar Kozaczuk <jwkozac...@gmail.com> Committer: Nadav Har'El <n...@scylladb.com> Branch: master
libc: fix sem_open() signature The signature of the sem_open is different in musl header than it is in the sem.cc (as a matter of fact the last 2 arguments are only required with O_CREAT), resulting on sem_open() not being "extern C" and not being exported to applications. The test tests/tst-semaphore.so couldn't run because of this. This patch fixes this. --- diff --git a/libc/sem.cc b/libc/sem.cc --- a/libc/sem.cc +++ b/libc/sem.cc @@ -110,7 +110,7 @@ static std::unordered_map<std::string, indirect_semaphore> named_semaphores; static mutex named_semaphores_mutex; OSV_LIBC_API -sem_t *sem_open(const char *name, int oflag, mode_t mode, unsigned int value) +sem_t *sem_open(const char *name, int oflag, ...) { SCOPE_LOCK(named_semaphores_mutex); auto iter = named_semaphores.find(std::string(name)); @@ -127,6 +127,11 @@ sem_t *sem_open(const char *name, int oflag, mode_t mode, unsigned int value) } else if (oflag & O_CREAT) { //creating new semaphore + va_list ap; + va_start(ap, oflag); + va_arg(ap, mode_t); + unsigned value = va_arg(ap, unsigned); + va_end(ap); if (value > SEM_VALUE_MAX) { errno = EINVAL; return SEM_FAILED; -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/00000000000073fc78060537baf2%40google.com.