Last change
on this file was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
553 bytes
|
Line | |
---|
1 | /* shm_unlink - remove a shared memory file */ |
---|
2 | |
---|
3 | /* Copyright 2002, Red Hat Inc. */ |
---|
4 | |
---|
5 | #include <sys/types.h> |
---|
6 | #include <sys/mman.h> |
---|
7 | #include <unistd.h> |
---|
8 | #include <string.h> |
---|
9 | #include <limits.h> |
---|
10 | |
---|
11 | int |
---|
12 | shm_unlink (const char *name) |
---|
13 | { |
---|
14 | int rc; |
---|
15 | char shm_name[PATH_MAX+20] = "/dev/shm/"; |
---|
16 | |
---|
17 | /* skip opening slash */ |
---|
18 | if (*name == '/') |
---|
19 | ++name; |
---|
20 | |
---|
21 | /* create special shared memory file name and leave enough space to |
---|
22 | cause a path/name error if name is too long */ |
---|
23 | strlcpy (shm_name + 9, name, PATH_MAX + 10); |
---|
24 | |
---|
25 | rc = unlink (shm_name); |
---|
26 | |
---|
27 | return rc; |
---|
28 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.