セマフォを使ってロックをするプログラム #include <fcntl.h> // O_CREAT #include <semaphore.h> // sem_wait #include <stdio.h> // printf #include <unistd.h> // sleep int main() { sem_t *sem = sem_open("/unko", O_CREAT, 0666, 1); // ★パーミッション全開のつもり if(sem==NULL){ perror("sem_open"); return 1; } printf("ロック\n"); sem_wait(sem…