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
sem_close: fix missing include for O_* constants
[libc-test.git]
/
src
/
regression
/
sem_close-unmap.c
blob
c19e0827695bed8310f204bb56ae07321642c243
1
// commit: f70375df85d26235a45e74559afd69be59e5ff99 2020-10-28
2
#define _GNU_SOURCE 1
3
#include <fcntl.h>
4
#include <stdlib.h>
5
#include <semaphore.h>
6
7
int
main
()
8
{
9
char
buf
[] =
"mysemXXXXXX"
;
10
if
(!
mktemp
(
buf
))
return
1
;
11
// open twice
12
sem_t
*
sem
=
sem_open
(
buf
,
O_CREAT
|
O_EXCL
,
0600
);
13
sem_open
(
buf
,
0
);
14
sem_unlink
(
buf
);
15
// close once
16
sem_close
(
sem
);
17
// semaphore should be still mapped
18
sem_post
(
sem
);
19
}