diff options
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 855ff43cc..6a0e45fb5 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -3346,73 +3346,3 @@ pclose (FILE *fp) return status; } - -#define SHM_STORAGE "/dev/shm" - -static bool -check_shm (const char *name) -{ - /* Note that we require the existance of /dev/shm for shared memory - object support, same as on Linux. We don't create this directory - here, that's the task of the installer. But we check for existance - and give ample warning. */ - path_conv dev_shm (SHM_STORAGE, PC_SYM_NOFOLLOW); - if (dev_shm.error || !dev_shm.exists () || !dev_shm.isdir ()) - { - small_printf ( - "Warning: '%s' does not exists or is not a directory.\n\n" - "Shared memory objects require the existance of this directory.\n" - "Create the directory '%s' and set the permissions to 01777.\n" - "For instance on the command line: mkdir -m 01777 %s\n", - SHM_STORAGE, SHM_STORAGE, SHM_STORAGE); - set_errno (EINVAL); - return false; - } - /* Name must start with a single slash. */ - if (!name || name[0] != '/' || name[1] == '/') - { - debug_printf ("Invalid shared memory object name '%s'", name); - set_errno (EINVAL); - return false; - } - if (strlen (name) > CYG_MAX_PATH - sizeof (SHM_STORAGE)) - { - debug_printf ("shared memory object name '%s' too long", name); - set_errno (ENAMETOOLONG); - return false; - } - return true; -} - -extern "C" int -shm_open (const char *name, int oflag, mode_t mode) -{ - if (!check_shm (name)) - return -1; - - /* Check for valid flags. */ - if (((oflag & O_ACCMODE) != O_RDONLY && (oflag & O_ACCMODE) != O_RDWR) - || (oflag & ~(O_ACCMODE | O_CREAT | O_EXCL | O_TRUNC))) - { - debug_printf ("Invalid oflag 0%o", oflag); - set_errno (EINVAL); - return -1; - } - - char shmname[CYG_MAX_PATH]; - strcpy (shmname, SHM_STORAGE); - strcat (shmname, name); - return open (shmname, oflag, mode & 0777); -} - -extern "C" int -shm_unlink (const char *name) -{ - if (!check_shm (name)) - return -1; - - char shmname[CYG_MAX_PATH]; - strcpy (shmname, SHM_STORAGE); - strcat (shmname, name); - return unlink (shmname); -} |