From: Waldemar Kozaczuk <[email protected]>
Committer: Waldemar Kozaczuk <[email protected]>
Branch: master

libc: added named semaphore functions to the list of exported symbols

---
diff --git a/exported_symbols/osv_ld-musl.so.1.symbols 
b/exported_symbols/osv_ld-musl.so.1.symbols
--- a/exported_symbols/osv_ld-musl.so.1.symbols
+++ b/exported_symbols/osv_ld-musl.so.1.symbols
@@ -907,11 +907,14 @@ secure_getenv
 seed48
 seekdir
 select
+sem_close
 sem_destroy
 sem_init
+sem_open
 sem_post
 sem_timedwait
 sem_trywait
+sem_unlink
 sem_wait
 send
 sendfile
diff --git a/exported_symbols/osv_libc.so.6.symbols 
b/exported_symbols/osv_libc.so.6.symbols
--- a/exported_symbols/osv_libc.so.6.symbols
+++ b/exported_symbols/osv_libc.so.6.symbols
@@ -837,6 +837,7 @@ strerror_l
 strerror_r
 strfmon
 strfmon_l
+strfromf128
 strftime
 __strftime_l
 strftime_l
@@ -865,6 +866,7 @@ strtod_l
 strtof
 __strtof_l
 strtof_l
+strtof128
 strtoimax
 strtok
 __strtok_r
diff --git a/exported_symbols/osv_libpthread.so.0.symbols 
b/exported_symbols/osv_libpthread.so.0.symbols
--- a/exported_symbols/osv_libpthread.so.0.symbols
+++ b/exported_symbols/osv_libpthread.so.0.symbols
@@ -94,11 +94,14 @@ read
 recv
 recvfrom
 recvmsg
+sem_close
 sem_destroy
 sem_init
+sem_open
 sem_post
 sem_timedwait
 sem_trywait
+sem_unlink
 sem_wait
 send
 sendmsg
diff --git a/libc/sem.cc b/libc/sem.cc
--- a/libc/sem.cc
+++ b/libc/sem.cc
@@ -55,7 +55,7 @@ OSV_LIBC_API
 int sem_init(sem_t* s, int pshared, unsigned val)
 {
     static_assert(sizeof(indirect_semaphore) <= sizeof(*s), "sem_t overflow");
-    posix_semaphore *sem = new posix_semaphore(val, 1, false); 
+    posix_semaphore *sem = new posix_semaphore(val, 1, false);
     new (s) indirect_semaphore(sem);
     return 0;
 }
@@ -114,7 +114,7 @@ sem_t *sem_open(const char *name, int oflag, ...)
 {
     SCOPE_LOCK(named_semaphores_mutex);
     auto iter = named_semaphores.find(std::string(name));
-    
+
     if (iter != named_semaphores.end()) {
         //opening already named semaphore
         if (oflag & O_EXCL && oflag & O_CREAT) {
@@ -136,13 +136,13 @@ sem_t *sem_open(const char *name, int oflag, ...)
             errno = EINVAL;
             return SEM_FAILED;
         }
-        
+
         indirect_semaphore *indp = new std::unique_ptr<posix_semaphore>(
             new posix_semaphore(value, 1, true));
         named_semaphores.emplace(std::string(name), indp);
         return reinterpret_cast<sem_t *>(indp);
     }
-    
+
     errno = ENOENT;
     return SEM_FAILED;
 }
@@ -160,7 +160,7 @@ int sem_unlink(const char *name)
         named_semaphores.erase(iter);
         return 0;
     }
-    
+
     errno = ENOENT;
     return -1;
 }
diff --git a/tests/tst-semaphore.c b/tests/tst-semaphore.c
--- a/tests/tst-semaphore.c
+++ b/tests/tst-semaphore.c
@@ -66,7 +66,7 @@ int main(void) {
 
     //Can't create a new named semaphore without O_CREAT
     assert(sem_open("other", 0, 0777, 1) == SEM_FAILED);
-    assert(sem_open("other", O_EXCL | O_SYNC, 0777, 1) == SEM_FAILED); 
+    assert(sem_open("other", O_EXCL | O_SYNC, 0777, 1) == SEM_FAILED);
 
     //Any other flags should have no effect if the named semaphore does not 
exist
     sem_t *named_sem3 = sem_open("other", O_EXCL | O_CREAT | O_SYNC, 0777, 1);

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/0000000000007ee4170605449565%40google.com.

Reply via email to