]> sourceware.org Git - newlib-cygwin.git/blame - winsup/cygwin/include/cygwin/shm.h
* include/cygwin/version.h: Reorganize last two api versions so that btowc and
[newlib-cygwin.git] / winsup / cygwin / include / cygwin / shm.h
CommitLineData
f449bfef
RC
1/* sys/shm.h
2
1c001dd2 3 Copyright 2001, 2002 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
1c001dd2
CS
12#ifndef _SYS_SHM_H
13#define _SYS_SHM_H
14
15#include <cygwin/ipc.h>
16
f449bfef
RC
17#ifdef __cplusplus
18extern "C"
19{
20#endif
21
1c001dd2
CS
22/* 64 Kb was hardcoded for x86. MS states this may change, but we need
23 * it in the header file.
24 */
25#define SHMLBA 65536 /* Segment low boundary address multiple. */
f449bfef 26
1c001dd2 27/* Shared memory operation flags:
f449bfef 28 */
1c001dd2
CS
29#define SHM_RDONLY 0x01 /* Attach read-only (else read-write). */
30#define SHM_RND 0x02 /* Round attach address to SHMLBA. */
f449bfef 31
1c001dd2
CS
32/* Command definitions for the semctl () function:
33 */
34#define SHM_STAT 0x4000 /* For ipcs(8) */
35#define SHM_INFO 0x4001 /* For ipcs(8) */
f449bfef 36
1c001dd2
CS
37/* Unsigned integer used for the number of current attaches.
38 */
39typedef unsigned int shmatt_t;
f449bfef 40
1c001dd2
CS
41struct shmid_ds
42{
43 struct ipc_perm shm_perm; /* Operation permission structure. */
44 size_t shm_segsz; /* Size of segment in bytes. */
45 pid_t shm_lpid; /* Process ID of last operation. */
46 pid_t shm_cpid; /* Process ID of creator. */
47 shmatt_t shm_nattch; /* Number of current attaches. */
48 timestruc_t shm_atim; /* Time of last shmat (). */
49 timestruc_t shm_dtim; /* Time of last shmdt (). */
50 timestruc_t shm_ctim; /* Time of last change by shmctl (). */
51 long shm_spare4[2];
f449bfef
RC
52};
53
1c001dd2
CS
54#define shm_atime shm_atim.tv_sec
55#define shm_dtime shm_dtim.tv_sec
56#define shm_ctime shm_ctim.tv_sec
f449bfef 57
1c001dd2
CS
58/* Buffer type for shmctl (IPC_INFO, ...) as used by ipcs(8).
59 */
60struct shminfo
61{
62 unsigned long shmmax; /* Maximum size in bytes of a shared
63 memory segment. */
64 unsigned long shmmin; /* Minimum size in bytes of a shared
65 memory segment. */
66 unsigned long shmmni; /* Maximum number of shared memory
67 segments, system wide. */
68 unsigned long shmseg; /* Maximum number of shared memory
69 segments attached per process. */
70 unsigned long shmall; /* Maximum number of bytes of shared
71 memory, system wide. */
72 unsigned long shm_spare[4];
f449bfef
RC
73};
74
1c001dd2 75/* Buffer type for shmctl (SHM_INFO, ...) as used by ipcs(8).
f449bfef 76 */
1c001dd2
CS
77struct shm_info
78{
79 unsigned long shm_ids; /* Number of allocated segments. */
80 unsigned long shm_tot; /* Size in bytes of allocated segments. */
81 unsigned long shm_atts; /* Number of attached segments, system
82 wide. */
f449bfef 83};
f449bfef 84
1c001dd2
CS
85void *shmat (int shmid, const void *shmaddr, int shmflg);
86int shmctl (int shmid, int cmd, struct shmid_ds *buf);
87int shmdt (const void *shmaddr);
88int shmget (key_t key, size_t size, int shmflg);
f449bfef
RC
89
90#ifdef __cplusplus
91}
92#endif
1c001dd2
CS
93
94#endif /* _SYS_SHM_H */
This page took 0.075116 seconds and 5 git commands to generate.