Boilerplate for shared memory

This commit is contained in:
zenon 2018-05-30 17:10:53 +02:00
parent 93303f19e1
commit 9ac6d9fbfe
2 changed files with 11 additions and 3 deletions

View File

@ -7,16 +7,17 @@
CC = gcc
CFLAGS = -std=c99 -pedantic -Wall -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_POSIX_C_SOURCE=200809L -g -c
LDFLAGS = -lrt -lpthread
.PHONY: all clean docs docs_clean
all: supervisor generator
supervisor: supervisor.o
$(CC) $^ -o $@
$(CC) $(LDFLAGS) $^ -o $@
generator: generator.o
$(CC) $^ -o $@
$(CC) $(LDFLAGS) $^ -o $@
%.o: %.c common.h
$(CC) $(CFLAGS) $^

View File

@ -14,6 +14,7 @@
#include <unistd.h>
#include <assert.h>
#include <string.h>
#include <stdint.h>
#include <errno.h>
#include <signal.h>
@ -33,8 +34,14 @@
#define SEM_USED_SPACE "/sem_used_space_01527193"
#define SEM_WRITE_END "/sem_write_end_01527193"
#define MAX_ITEMS 32
struct circ_buf {
int id;
int quit;
int head;
int tail;
int validItems;
int data[MAX_ITEMS];
};
#endif /* ifndef COMMON_H */