Open Bug 1192500 Opened 6 years ago Updated 4 years ago

ssl/sslmutex.c uses sem_init/sem_destroy that are unsupported on iOS


(NSS :: Libraries, defect, P3)



(Not tracked)



(Reporter: sdefresne, Unassigned)



User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36

Steps to reproduce:

When building ssl/sslmutex.c targeting iOS with -Wdeprecated-declarations, the compiler reports that sem_init and sem_destroy are deprecated. In fact those interface are not implemented on iOS, they just return an error.

Actual results:

../../net/third_party/nss/ssl/sslmutex.c:522:14: warning: 'sem_init' is deprecated [-Wdeprecated-declarations]
        rv = sem_init(&pMutex->u.sem, shared, 1);
/Applications/ note: 'sem_init' has been explicitly marked deprecated here
int sem_init(sem_t *, int, unsigned int) __deprecated;
../../net/third_party/nss/ssl/sslmutex.c:544:7: warning: 'sem_destroy' is deprecated [-Wdeprecated-declarations]
        rv = sem_destroy(&pMutex->u.sem);
/Applications/ note: 'sem_destroy' has been explicitly marked deprecated here
int sem_destroy(sem_t *) __deprecated;

Expected results:

No warning should be reported by the compiler. Possible replacements are GCD semaphores or named semaphore (sem_open/sem_close).
Duplicate of this bug: 1193525 includes this gem:

> Wow. <semaphore.h> declares sem_init so that it compiles properly on OS X, but it returns -1 with errno set to ENOSYS (function not implemented).

Clearly, no one is actually using these on OS X.  Maybe we should just remove support for shared semaphores in libssl on OS X.
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.