diff options
[SP/P11] Solved exercises
1 files changed, 17 insertions, 0 deletions
| -rw-r--r-- | Year 3/System programming/Practice11/ex1.c | 17 |
diff --git a/Year 3/System programming/Practice11/ex1.c b/Year 3/System programming/Practice11/ex1.c new file mode 100644 index 0000000..4086ca7 --- /dev/null +++ b/Year 3/System programming/Practice11/ex1.c @@ -0,0 +1,17 @@ +#include <stdio.h> +#include <semaphore.h> +#include <sys/stat.h> +#include <fcntl.h> + +int main() { + sem_t* sem = sem_open("/sem", O_CREAT); + + int sval = 0; + sem_getvalue(sem, &sval); + printf("%d\n", sval); + + sem_close(sem); + sem_unlink("/sem"); + + return 0; +} |
