source: branches/libc-0.6/src/emx/include/sys/shm.h

Last change on this file was 1987, checked in by bird, 20 years ago

shm + sem debuging.

  • Property cvs2svn:cvs-rev set to 1.4
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 5.0 KB
Line 
1/* $FreeBSD: src/sys/sys/shm.h,v 1.19 2003/01/25 21:33:05 alfred Exp $ */
2/* $NetBSD: shm.h,v 1.15 1994/06/29 06:45:17 cgd Exp $ */
3
4/*
5 * Copyright (c) 1994 Adam Glass
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Adam Glass.
19 * 4. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34/*
35 * As defined+described in "X/Open System Interfaces and Headers"
36 * Issue 4, p. XXX
37 */
38
39/** @file
40 * FreeBSD 5.3
41 * @changed bird: the SHMLBA to 64KB.
42 * @changed bird: added pid_t, time_t and size_t (POSIX).
43 */
44
45#ifndef _SYS_SHM_H_
46#define _SYS_SHM_H_
47
48#include <sys/ipc.h>
49
50#include <sys/_types.h>
51
52#if !defined(_TIME_T_DECLARED) && !defined(_TIME_T)
53typedef __time_t time_t;
54#define _TIME_T_DECLARED
55#define _TIME_T
56#endif
57
58#include <sys/_types.h>
59#if !defined(_SIZE_T_DECLARED) && !defined(_SIZE_T)
60typedef __size_t size_t;
61#define _SIZE_T_DECLARED
62#define _SIZE_T
63#endif
64
65#if !defined(_PID_T_DECLARED) && !defined(_PID_T)
66typedef __pid_t pid_t;
67#define _PID_T_DECLARED
68#define _PID_T
69#endif
70
71#define SHM_RDONLY 010000 /* Attach read-only (else read-write) */
72#define SHM_RND 020000 /* Round attach address to SHMLBA */
73#define SHMLBA (0x10000) /* Segment low boundary address multiple */
74
75/* "official" access mode definitions; somewhat braindead since you have
76 to specify (SHM_* >> 3) for group and (SHM_* >> 6) for world permissions */
77#define SHM_R (IPC_R)
78#define SHM_W (IPC_W)
79
80/* predefine tbd *LOCK shmctl commands */
81#define SHM_LOCK 11
82#define SHM_UNLOCK 12
83
84/* ipcs shmctl commands */
85#define SHM_STAT 13
86#define SHM_INFO 14
87
88#ifdef __EMX__
89typedef __uint32_t shmatt_t;
90#endif
91
92struct shmid_ds {
93 struct ipc_perm shm_perm; /* operation permission structure */
94#ifdef __EMX__
95 size_t shm_segsz; /* size of segment in bytes */
96#else
97 int shm_segsz; /* size of segment in bytes */
98#endif
99 pid_t shm_lpid; /* process ID of last shared memory op */
100 pid_t shm_cpid; /* process ID of creator */
101#ifdef __EMX__
102 shmatt_t shm_nattch; /* number of current attaches */
103#else
104 short shm_nattch; /* number of current attaches */
105#endif
106 time_t shm_atime; /* time of last shmat() */
107 time_t shm_dtime; /* time of last shmdt() */
108 time_t shm_ctime; /* time of last change by shmctl() */
109 void *shm_internal; /* sysv stupidity */
110};
111
112#ifdef _KERNEL
113
114/*
115 * System 5 style catch-all structure for shared memory constants that
116 * might be of interest to user programs. Do we really want/need this?
117 */
118struct shminfo {
119 int shmmax, /* max shared memory segment size (bytes) */
120 shmmin, /* min shared memory segment size (bytes) */
121 shmmni, /* max number of shared memory identifiers */
122 shmseg, /* max shared memory segments per process */
123 shmall; /* max amount of shared memory (pages) */
124};
125#ifndef __EMX__
126extern struct shminfo shminfo;
127extern struct shmid_ds *shmsegs;
128#endif
129
130struct shm_info {
131 int used_ids;
132 unsigned long shm_tot;
133 unsigned long shm_rss;
134 unsigned long shm_swp;
135 unsigned long swap_attempts;
136 unsigned long swap_successes;
137};
138
139#ifndef __EMX__
140struct thread;
141struct proc;
142struct vmspace;
143
144void shmexit(struct vmspace *);
145void shmfork(struct proc *, struct proc *);
146#endif /* !__EMX__ */
147#else /* !_KERNEL */
148
149#include <sys/cdefs.h>
150
151#ifndef _SIZE_T_DECLARED
152typedef __size_t size_t;
153#define _SIZE_T_DECLARED
154#endif
155
156__BEGIN_DECLS
157#ifndef __EMX__
158int shmsys(int, ...);
159#endif
160void *shmat(int, const void *, int);
161int shmget(key_t, size_t, int);
162int shmctl(int, int, struct shmid_ds *);
163int shmdt(const void *);
164__END_DECLS
165
166#endif /* !_KERNEL */
167
168#endif /* !_SYS_SHM_H_ */
Note: See TracBrowser for help on using the repository browser.