All pastes #40424 Raw Edit

Something

public text v1 · immutable
#40424 ·published 2006-02-06 23:57 UTC
rendered paste body
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>

int main (int argc, char **argv) {
        key_t mkey = ftok(argv[0], 0);
        if (mkey == -1) {
                perror ("ftok");
                exit (-2);
        }
        int mysem = semget (mkey, 1, IPC_CREAT|0777);

        if (mysem == -1) {
                perror ("semget");
                exit (-1);
        }
}