From 7736feb2769e32b669bffcccb89483163116ed5c Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Wed, 22 May 2002 20:26:28 +0000 Subject: 2002-05-22 Jeff Johnston * libc/sys/linux/shm_open.c: New file. * libc/sys/linux/shm_unlink.c: Ditto. * libc/sys/linux/Makefile.am: Add support for shm_open.c and shm_unlink.c. * libc/sys/linux/Makefile.in: Regenerated. * libc/sys/linux/sys/types.h: Add some additional checks to see if clock_t or time_t is already defined. --- newlib/libc/sys/linux/shm_unlink.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 newlib/libc/sys/linux/shm_unlink.c (limited to 'newlib/libc/sys/linux/shm_unlink.c') diff --git a/newlib/libc/sys/linux/shm_unlink.c b/newlib/libc/sys/linux/shm_unlink.c new file mode 100644 index 000000000..cf259c627 --- /dev/null +++ b/newlib/libc/sys/linux/shm_unlink.c @@ -0,0 +1,28 @@ +/* shm_unlink - remove a shared memory file */ + +/* Copyright 2002, Red Hat Inc. */ + +#include +#include +#include +#include +#include + +int +shm_unlink (const char *name) +{ + int rc; + char shm_name[PATH_MAX+20] = "/dev/shm/"; + + /* skip opening slash */ + if (*name == '/') + ++name; + + /* create special shared memory file name and leave enough space to + cause a path/name error if name is too long */ + strlcpy (shm_name + 9, name, PATH_MAX + 10); + + rc = unlink (shm_name); + + return rc; +} -- cgit v1.2.3