repo.or.cz
/
libc-test.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
add sem_close regression test
[libc-test.git]
/
src
/
regression
/
sem_close-unmap.c
blob
f1e51d9d0f9185d634be14c48f04e2b7fe63b22f
1
// commit: f70375df85d26235a45e74559afd69be59e5ff99 2020-10-28
2
#define _GNU_SOURCE 1
3
#include <stdlib.h>
4
#include <semaphore.h>
5
6
int
main
()
7
{
8
char
buf
[] =
"mysemXXXXXX"
;
9
if
(!
mktemp
(
buf
))
return
1
;
10
// open twice
11
sem_t
*
sem
=
sem_open
(
buf
,
O_CREAT
|
O_EXCL
,
0600
);
12
sem_open
(
buf
,
0
);
13
sem_unlink
(
buf
);
14
// close once
15
sem_close
(
sem
);
16
// semaphore should be still mapped
17
sem_post
(
sem
);
18
}