]> sourceware.org Git - newlib-cygwin.git/blame - winsup/cygwin/include/cygwin/shm.h
* Merge in cygwin-64bit-branch.
[newlib-cygwin.git] / winsup / cygwin / include / cygwin / shm.h
CommitLineData
f449bfef
RC
1/* sys/shm.h
2
61522196 3 Copyright 2001, 2002, 2012, 2013 Red Hat Inc.
f449bfef
RC
4 Written by Robert Collins <rbtcollins@hotmail.com>
5
6This file is part of Cygwin.
7
8This software is a copyrighted work licensed under the terms of the
9Cygwin license. Please consult the file "CYGWIN_LICENSE" for
10details. */
11
a6df500f
CV
12#ifndef _CYGWIN_SHM_H
13#define _CYGWIN_SHM_H
1c001dd2
CS
14
15#include <cygwin/ipc.h>
a6df500f 16#include <sys/cygwin.h>
1c001dd2 17
f449bfef
RC
18#ifdef __cplusplus
19extern "C"
20{
21#endif
22
a6df500f
CV
23/* Segment low boundary address multiple.
24 *
25 * 64 Kb was hardcoded for x86. MS states this may change so the constant
26 * expression is replaced by a function call returning the correct value. */
27#define SHMLBA (cygwin_internal (CW_GET_SHMLBA))
f449bfef 28
1c001dd2 29/* Shared memory operation flags:
f449bfef 30 */
1c001dd2
CS
31#define SHM_RDONLY 0x01 /* Attach read-only (else read-write). */
32#define SHM_RND 0x02 /* Round attach address to SHMLBA. */
f449bfef 33
a6df500f 34#ifdef _KERNEL
1c001dd2
CS
35/* Command definitions for the semctl () function:
36 */
37#define SHM_STAT 0x4000 /* For ipcs(8) */
38#define SHM_INFO 0x4001 /* For ipcs(8) */
a6df500f 39#endif /* _KERNEL */
f449bfef 40
1c001dd2
CS
41/* Unsigned integer used for the number of current attaches.
42 */
61522196 43typedef uint32_t shmatt_t;
f449bfef 44
1c001dd2
CS
45struct shmid_ds
46{
a6df500f 47 struct ipc_perm shm_perm; /* Operation permission structure. */
61522196 48 uint32_t shm_segsz; /* Size of segment in bytes. */
a6df500f
CV
49 pid_t shm_lpid; /* Process ID of last operation. */
50 pid_t shm_cpid; /* Process ID of creator. */
51 shmatt_t shm_nattch;/* Number of current attaches. */
52 timestruc_t shm_atim; /* Time of last shmat (). */
53 timestruc_t shm_dtim; /* Time of last shmdt (). */
54 timestruc_t shm_ctim; /* Time of last change by shmctl (). */
55#ifdef _KERNEL
56 struct shm_handle *shm_internal;
57 long shm_spare4[1];
58#else
59 long shm_spare4[2];
60#endif /* _KERNEL */
f449bfef
RC
61};
62
1c001dd2
CS
63#define shm_atime shm_atim.tv_sec
64#define shm_dtime shm_dtim.tv_sec
65#define shm_ctime shm_ctim.tv_sec
f449bfef 66
a6df500f 67#ifdef _KERNEL
1c001dd2
CS
68/* Buffer type for shmctl (IPC_INFO, ...) as used by ipcs(8).
69 */
70struct shminfo
71{
61522196 72 int32_t shmmax; /* Maximum size in bytes of a shared
a6df500f 73 memory segment. */
61522196 74 int32_t shmmin; /* Minimum size in bytes of a shared
a6df500f 75 memory segment. */
61522196 76 int32_t shmmni; /* Maximum number of shared memory
a6df500f 77 segments, system wide. */
61522196 78 int32_t shmseg; /* Maximum number of shared memory
a6df500f 79 segments attached per process. */
61522196
CV
80 int32_t shmall; /* Maximum number of bytes of shared
81 memory, system wide.
82 Note that XSI IPC shared memory allocation is
83 restricted to a bit less than 2 Gigs, even on
84 64 bit, so using an int32_t here is sufficient. */
85 int32_t shm_spare[4];
f449bfef
RC
86};
87
1c001dd2 88/* Buffer type for shmctl (SHM_INFO, ...) as used by ipcs(8).
f449bfef 89 */
1c001dd2
CS
90struct shm_info
91{
a6df500f 92#define shm_ids used_ids
61522196
CV
93 int32_t used_ids; /* Number of allocated segments. */
94 int32_t shm_tot; /* Size in bytes of allocated segments. */
95 int32_t shm_atts; /* Number of attached segments, system
a6df500f 96 wide. */
f449bfef 97};
a6df500f 98#endif /* _KERNEL */
f449bfef 99
1c001dd2
CS
100void *shmat (int shmid, const void *shmaddr, int shmflg);
101int shmctl (int shmid, int cmd, struct shmid_ds *buf);
102int shmdt (const void *shmaddr);
103int shmget (key_t key, size_t size, int shmflg);
f449bfef
RC
104
105#ifdef __cplusplus
106}
107#endif
1c001dd2 108
a6df500f 109#endif /* _CYGWIN_SHM_H */
This page took 0.32818 seconds and 5 git commands to generate.