21 lines · cpp
1// RUN: %clangxx -O0 %s -o %t && %run %t2 3// Android does not implement these calls.4// UNSUPPORTED: android5 6#include <assert.h>7#include <fcntl.h>8#include <semaphore.h>9#include <stdio.h>10#include <unistd.h>11 12int main() {13 char name[1024];14 sprintf(name, "/sem_open_test_%zu", (size_t)getpid());15 16 sem_t *s = sem_open(name, O_CREAT, 0644, 123);17 assert(s != SEM_FAILED);18 assert(sem_close(s) == 0);19 assert(sem_unlink(name) == 0);20}21