shm.h revision 2836
1/* $Id: shm.h,v 1.1 1994/09/13 14:47:36 dfr 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#ifndef _SYS_SHM_H_ 40#define _SYS_SHM_H_ 41 42#include <sys/ipc.h> 43 44#define SHM_RDONLY 010000 /* Attach read-only (else read-write) */ 45#define SHM_RND 020000 /* Round attach address to SHMLBA */ 46#define SHMLBA CLBYTES /* Segment low boundry address multiple */ 47 48struct shmid_ds { 49 struct ipc_perm shm_perm; /* operation permission structure */ 50 int shm_segsz; /* size of segment in bytes */ 51 pid_t shm_lpid; /* process ID of last shared memory op */ 52 pid_t shm_cpid; /* process ID of creator */ 53 short shm_nattch; /* number of current attaches */ 54 time_t shm_atime; /* time of last shmat() */ 55 time_t shm_dtime; /* time of last shmdt() */ 56 time_t shm_ctime; /* time of last change by shmctl() */ 57 void *shm_internal; /* sysv stupidity */ 58}; 59 60#ifdef KERNEL 61 62/* 63 * System 5 style catch-all structure for shared memory constants that 64 * might be of interest to user programs. Do we really want/need this? 65 */ 66struct shminfo { 67 int shmmax, /* max shared memory segment size (bytes) */ 68 shmmin, /* min shared memory segment size (bytes) */ 69 shmmni, /* max number of shared memory identifiers */ 70 shmseg, /* max shared memory segments per process */ 71 shmall; /* max amount of shared memory (pages) */ 72}; 73extern struct shminfo shminfo; 74struct shmid_ds *shmsegs; 75 76#else /* !KERNEL */ 77 78#include <sys/cdefs.h> 79 80__BEGIN_DECLS 81int shmsys __P((int, ...)); 82void *shmat __P((int, void *, int)); 83int shmget __P((key_t, int, int)); 84int shmctl __P((int, int, struct shmid_ds *)); 85int shmdt __P((void *)); 86__END_DECLS 87 88#endif /* !KERNEL */ 89 90#endif /* !_SYS_SHM_H_ */ 91