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:
parent
fc58fbb08f
commit
88ffcbc56d
3 changed files with 31 additions and 0 deletions
|
@ -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
13
tools/rmsem.c
Normal 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
13
tools/rmshm.c
Normal 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;
|
||||
}
|
Loading…
Add table
Reference in a new issue