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