1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

tools: added tools for deleting semaphores and shmem regions

This commit is contained in:
Steffen Vogel 2018-05-07 15:53:40 +02:00
parent fc58fbb08f
commit 88ffcbc56d
3 changed files with 31 additions and 0 deletions

View file

@ -36,6 +36,11 @@ ifeq ($(shell $(PKGCONFIG) libzmq; echo $$?),0)
TOOLS_LDLIBS += $(shell $(PKGCONFIG) --libs libzmq)
endif
ifeq ($(IS_LINUX),1)
TOOLS += $(BUILDDIR)/rmshm $(BUILDDIR)/rmsem
TOOLS_LDLIBS += -lrt -pthread
endif
# Compile executable objects
$(BUILDDIR)/tools/%.o: tools/%.c | $$(dir $$@)
$(CC) $(TOOLS_CFLAGS) -c $< -o $@

13
tools/rmsem.c Normal file
View file

@ -0,0 +1,13 @@
#include <semaphore.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
for (int i = 1; i < argc; i++) {
int ret = sem_unlink(argv[i]);
if (ret)
fprintf(stderr, "Failed to unlink: %s\n", argv[i]);
}
return 0;
}

13
tools/rmshm.c Normal file
View file

@ -0,0 +1,13 @@
#include <sys/mman.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
for (int i = 1; i < argc; i++) {
int ret = shm_unlink(argv[i]);
if (ret)
fprintf(stderr, "Failed to unlink: %s\n", argv[i]);
}
return 0;
}