mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-15 02:09:19 +08:00
7736feb276
* 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.
29 lines
553 B
C
29 lines
553 B
C
/* shm_unlink - remove a shared memory file */
|
|
|
|
/* Copyright 2002, Red Hat Inc. */
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/mman.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
#include <limits.h>
|
|
|
|
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;
|
|
}
|