* cygwin.din (shm_open): Export.

(shm_unlink): Export.
	* syscalls.cc (shm_open): New function.
	(shm_unlink): New function.
	* sysconf.cc (sca): Set value of _SC_SHARED_MEMORY_OBJECTS to
	_POSIX_SHARED_MEMORY_OBJECTS.
	* include/cygwin/version.h: Bump API minor number.
	* include/sys/mman.h (shm_open): Add prototype.
	(shm_unlink): Ditto.
This commit is contained in:
Corinna Vinschen 2007-02-08 13:36:53 +00:00
parent d7e4c7a807
commit ce8bab5a92
6 changed files with 66 additions and 2 deletions

View File

@ -1,3 +1,15 @@
2007-02-08 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din (shm_open): Export.
(shm_unlink): Export.
* syscalls.cc (shm_open): New function.
(shm_unlink): New function.
* sysconf.cc (sca): Set value of _SC_SHARED_MEMORY_OBJECTS to
_POSIX_SHARED_MEMORY_OBJECTS.
* include/cygwin/version.h: Bump API minor number.
* include/sys/mman.h (shm_open): Add prototype.
(shm_unlink): Ditto.
2007-02-08 Christopher Faylor <me@cgf.cx>
Corinna Vinschen <corinna@vinschen.de>

View File

@ -1314,6 +1314,8 @@ shmat SIGFE
shmctl SIGFE
shmdt SIGFE
shmget SIGFE
shm_open SIGFE
shm_unlink SIGFE
shutdown = cygwin_shutdown SIGFE
sigaction SIGFE
sigaddset SIGFE

View File

@ -302,12 +302,13 @@ details. */
162: New struct ifreq. Export if_nametoindex, if_indextoname,
if_nameindex, if_freenameindex.
163: Export posix_madvise, posix_memalign.
164: Export shm_open, shm_unlink.
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 163
#define CYGWIN_VERSION_API_MINOR 164
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible

View File

@ -67,6 +67,9 @@ extern int munlock (const void *__addr, size_t __len);
extern int posix_madvise (void *__addr, size_t __len, int __advice);
extern int shm_open (const char *__name, int __oflag, mode_t __mode);
extern int shm_unlink (const char *__name);
#ifdef __cplusplus
};
#endif /* __cplusplus */

View File

@ -3346,3 +3346,49 @@ pclose (FILE *fp)
return status;
}
#define SHM_STORAGE "/dev/shm"
extern "C" int
shm_open (const char *name, int oflag, mode_t mode)
{
/* Name must start with a single slash. */
if (!name || name[0] != '/' || name[1] == '/'
|| strlen (name) > CYG_MAX_PATH - sizeof (SHM_STORAGE))
{
debug_printf ("Invalid shared memory object name '%s'", name);
set_errno (EINVAL);
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;
}
/* Note that we require the existance of /dev/shm here. We don't
create this directory from here. That's the task of the installer. */
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)
{
/* Name must start with a single slash. */
if (!name || name[0] != '/' || name[1] == '/'
|| strlen (name) > CYG_MAX_PATH - sizeof (SHM_STORAGE))
{
debug_printf ("Invalid shared memory object name '%s'", name);
set_errno (EINVAL);
return -1;
}
char shmname[CYG_MAX_PATH];
strcpy (shmname, SHM_STORAGE);
strcat (shmname, name);
return unlink (shmname);
}

View File

@ -149,7 +149,7 @@ static struct
{cons, {c:-1L}}, /* 28, _SC_PRIORITIZED_IO */
{cons, {c:_POSIX_REALTIME_SIGNALS}}, /* 29, _SC_REALTIME_SIGNALS */
{cons, {c:_POSIX_SEMAPHORES}}, /* 30, _SC_SEMAPHORES */
{cons, {c:-1L}}, /* 31, _SC_SHARED_MEMORY_OBJECTS */
{cons, {c:_POSIX_SHARED_MEMORY_OBJECTS}}, /* 31, _SC_SHARED_MEMORY_OBJECTS */
{cons, {c:_POSIX_SYNCHRONIZED_IO}}, /* 32, _SC_SYNCHRONIZED_IO */
{cons, {c:_POSIX_TIMERS}}, /* 33, _SC_TIMERS */
{nsup, {c:0}}, /* 34, _SC_AIO_LISTIO_MAX */