diff options
author | Conrad Scott <conrad.scott@dsl.pipex.com> | 2002-06-16 16:15:27 +0400 |
---|---|---|
committer | Conrad Scott <conrad.scott@dsl.pipex.com> | 2002-06-16 16:15:27 +0400 |
commit | 06e4e40dd374d2e6344cfc65e244cfa32ed97ee0 (patch) | |
tree | fec24c9dadeb9dea9f56eb2ad204c75a602aed46 /winsup/cygwin/include/sys | |
parent | 38566ea25b88e5fcf106cd2a716339007e0750d2 (diff) |
* include/sys/ipc.h (IPC_PRIVATE): Add cast to key_t.
(IPC_INFO): New flag for ipcs(8).
(IPC_RMID IPC_SET IPC_STAT): Renumber.
* include/sys/shm.h (SHM_RDONLY SHM_RND): Renumber with distinct
values [sic].
(class _shmattach): Internal type moved to "cygserver_shm.h".
(class shmnode): Ditto.
(class shmid_ds): Ditto.
(struct shmid_ds): Add spare fields.
(struct shminfo): New type for IPC_INFO interface.
* cygserver_shm.h: Remove obsolete #if 0 ... #endif block.
(class shm_cleanup): Remove unused class.
(struct _shmattach): Internal type moved from <sys/shm.h>.
(struct shmnode): Ditto.
(struct int_shmid_ds): Ditto. Renamed to avoid name clash with
public interface struct shmid_ds. Use the shmid_bs structure as a
field.
* cygserver_shm.cc: Remove obsolete #if 0 ... #endif block.
(client_request_shm::serve): Update for redefinition of
int_shmid_ds structure.
* shm.cc (build_inprocess_shmds): Ditto.
(fixup_shms_after_fork): Ditto.
(shmctl): Ditto.
(shmget): Ditto. Remove obsolete #if 0 ... #endif code.
Diffstat (limited to 'winsup/cygwin/include/sys')
-rw-r--r-- | winsup/cygwin/include/sys/ipc.h | 36 | ||||
-rw-r--r-- | winsup/cygwin/include/sys/shm.h | 105 |
2 files changed, 67 insertions, 74 deletions
diff --git a/winsup/cygwin/include/sys/ipc.h b/winsup/cygwin/include/sys/ipc.h index c718a173a..f319aebeb 100644 --- a/winsup/cygwin/include/sys/ipc.h +++ b/winsup/cygwin/include/sys/ipc.h @@ -9,16 +9,17 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#ifndef _SYS_IPC_H +#define _SYS_IPC_H + #ifdef __cplusplus extern "C" { #endif -#ifndef _SYS_IPC_H -#define _SYS_IPC_H - -/* sys/types must be included before sys/ipc.h. We aren't meant to automatically - * include it however +/* + * <sys/types.h> must be included before <sys/ipc.h>. We aren't meant + * to automatically include it however. */ struct ipc_perm { @@ -29,25 +30,30 @@ struct ipc_perm { mode_t mode; }; -/* the mode flags used with the _get functions use the low order 9 bits for a mode - * request +/* + * The mode flags used with the _get functions use the low order 9 + * bits for a mode request. */ #define IPC_CREAT 0x0200 #define IPC_EXCL 0x0400 #define IPC_NOWAIT 0x0800 -/* this is a value that will _never_ be a valid key from ftok */ -#define IPC_PRIVATE -2 +/* This is a value that will _never_ be a valid key from ftok(3). */ +#define IPC_PRIVATE ((key_t) -2) -/* ctl commands 1000-1fff is ipc reserved */ -#define IPC_RMID 0x1003 -#define IPC_SET 0x1002 -#define IPC_STAT 0x1001 +/* + * Values for the cmd argument to shmctl(2). + * Commands 1000-1fff are reserved for IPC_xxx. + */ +#define IPC_RMID 0x1000 +#define IPC_SET 0x1001 +#define IPC_STAT 0x1002 +#define IPC_INFO 0x1003 /* For ipcs(8). */ key_t ftok(const char *, int); -#endif /* _SYS_IPC_H */ - #ifdef __cplusplus } #endif + +#endif /* _SYS_IPC_H */ diff --git a/winsup/cygwin/include/sys/shm.h b/winsup/cygwin/include/sys/shm.h index 208c5f29f..d6873d9ac 100644 --- a/winsup/cygwin/include/sys/shm.h +++ b/winsup/cygwin/include/sys/shm.h @@ -9,81 +9,68 @@ This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#ifndef _SYS_SHM_H +#define _SYS_SHM_H + +#include <sys/ipc.h> + #ifdef __cplusplus extern "C" { #endif -#ifndef _SYS_SHM_H -#define _SYS_SHM_H +/* + * 64 Kb was hardcoded for x86. MS states this may change, but we need + * it in the header file. + */ +#define SHMLBA 65536 -#include <sys/ipc.h> +/* + * Values for the shmflg argument to shmat(2). + */ +#define SHM_RDONLY 0x01 /* Attach read-only, not read/write. */ +#define SHM_RND 0x02 /* Round shmaddr down to multiple of SHMLBA. */ -#define SHM_RDONLY 1 -/* 64 Kb was hardcoded for x86. MS states this may change, but we need it in the header - * file. +/* + * Values for the cmd argument to shmctl(2). + * Commands 4000-4fff are reserved for SHM_xxx. */ -#define SHMLBA 65536 -#define SHM_RND 1 +#define SHM_STAT 0x4000 /* For ipcs(8) */ typedef long int shmatt_t; -#if defined(__INSIDE_CYGWIN__) && defined(__cplusplus) - -class _shmattach { -public: - void *data; - int shmflg; - class _shmattach *next; -}; - -class shmid_ds { -public: - struct ipc_perm shm_perm; - size_t shm_segsz; - pid_t shm_lpid; - pid_t shm_cpid; - shmatt_t shm_nattch; - time_t shm_atime; - time_t shm_dtime; - time_t shm_ctime; - void *mapptr; -}; - -class shmnode { -public: - class shmid_ds * shmds; - int shm_id; - class shmnode *next; - key_t key; - HANDLE filemap; - HANDLE attachmap; - class _shmattach *attachhead; -}; - -#else -/* this is what we return when queried. It has no bitwise correspondence - * the internal structures - */ struct shmid_ds { - struct ipc_perm shm_perm; - size_t shm_segsz; - pid_t shm_lpid; - pid_t shm_cpid; - shmatt_t shm_nattch; - time_t shm_atime; - time_t shm_dtime; - time_t shm_ctime; + struct ipc_perm shm_perm; + size_t shm_segsz; + pid_t shm_lpid; + pid_t shm_cpid; + shmatt_t shm_nattch; + time_t shm_atime; + long shm_spare1; + time_t shm_dtime; + long shm_spare2; + time_t shm_ctime; + long shm_spare3; + long shm_spare4[2]; }; -#endif /* __INSIDE_CYGWIN__ */ -void *shmat(int, const void *, int); -int shmctl(int, int, struct shmid_ds *); -int shmdt(const void *); -int shmget(key_t, size_t, int); +/* Buffer type for shmctl(IPC_INFO, ...) as used by ipcs(8). */ +struct shminfo { + unsigned long shmmax; + unsigned long shmmin; + unsigned long shmmni; + unsigned long shmseg; + unsigned long shmall; + unsigned long shm_spare[4]; +}; -#endif /* _SYS_SHM_H */ +void *shmat(int shmid, const void *shmaddr, int shmflg); +int shmctl(int shmid, int cmd, struct shmid_ds *buf); +int shmdt(const void *shmaddr); +int shmget(key_t key, size_t size, int shmflg); #ifdef __cplusplus } #endif + +#endif /* _SYS_SHM_H */ |