os/ossrv/genericopenlibs/openenvcore/include/sys/ipc.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*-
sl@0
     2
 *© Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
sl@0
     3
 * Copyright (c) 1988 University of Utah.
sl@0
     4
 * Copyright (c) 1990, 1993
sl@0
     5
 *	The Regents of the University of California.  All rights reserved.
sl@0
     6
 * (c) UNIX System Laboratories, Inc.
sl@0
     7
 * All or some portions of this file are derived from material licensed
sl@0
     8
 * to the University of California by American Telephone and Telegraph
sl@0
     9
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
sl@0
    10
 * the permission of UNIX System Laboratories, Inc.
sl@0
    11
 *
sl@0
    12
 * This code is derived from software contributed to Berkeley by
sl@0
    13
 * the Systems Programming Group of the University of Utah Computer
sl@0
    14
 * Science Department.
sl@0
    15
 *
sl@0
    16
 * Redistribution and use in source and binary forms, with or without
sl@0
    17
 * modification, are permitted provided that the following conditions
sl@0
    18
 * are met:
sl@0
    19
 * 1. Redistributions of source code must retain the above copyright
sl@0
    20
 *    notice, this list of conditions and the following disclaimer.
sl@0
    21
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    22
 *    notice, this list of conditions and the following disclaimer in the
sl@0
    23
 *    documentation and/or other materials provided with the distribution.
sl@0
    24
 * 4. Neither the name of the University nor the names of its contributors
sl@0
    25
 *    may be used to endorse or promote products derived from this software
sl@0
    26
 *    without specific prior written permission.
sl@0
    27
 *
sl@0
    28
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
sl@0
    29
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sl@0
    30
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0
    31
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
sl@0
    32
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sl@0
    33
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
sl@0
    34
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
    35
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
sl@0
    36
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
sl@0
    37
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
sl@0
    38
 * SUCH DAMAGE.
sl@0
    39
 *
sl@0
    40
 *	@(#)ipc.h	8.4 (Berkeley) 2/19/95
sl@0
    41
 * $FreeBSD: src/sys/sys/ipc.h,v 1.25 2005/01/07 02:29:23 imp Exp $
sl@0
    42
 */
sl@0
    43
sl@0
    44
/*
sl@0
    45
 * SVID compatible ipc.h file
sl@0
    46
 */
sl@0
    47
#ifndef _SYS_IPC_H_
sl@0
    48
#define _SYS_IPC_H_
sl@0
    49
sl@0
    50
#include <sys/cdefs.h>
sl@0
    51
#include <sys/types.h>
sl@0
    52
sl@0
    53
#ifndef _GID_T_DECLARED
sl@0
    54
typedef	__gid_t		gid_t;
sl@0
    55
#define	_GID_T_DECLARED
sl@0
    56
#endif
sl@0
    57
sl@0
    58
#ifndef _KEY_T_DECLARED
sl@0
    59
typedef	__key_t		key_t;
sl@0
    60
#define	_KEY_T_DECLARED
sl@0
    61
#endif
sl@0
    62
sl@0
    63
#ifndef _MODE_T_DECLARED
sl@0
    64
typedef	__mode_t	mode_t;
sl@0
    65
#define	_MODE_T_DECLARED
sl@0
    66
#endif
sl@0
    67
sl@0
    68
#ifndef _UID_T_DECLARED
sl@0
    69
typedef	__uid_t		uid_t;
sl@0
    70
#define	_UID_T_DECLARED
sl@0
    71
#endif
sl@0
    72
sl@0
    73
/*
sl@0
    74
 * XXX almost all members have wrong types.
sl@0
    75
 */
sl@0
    76
struct ipc_perm {
sl@0
    77
	unsigned short	cuid;	/* creator user id */
sl@0
    78
	unsigned short	cgid;	/* creator group id */
sl@0
    79
	unsigned short	uid;	/* user id */
sl@0
    80
	unsigned short	gid;	/* group id */
sl@0
    81
	unsigned short	mode;	/* r/w permission */
sl@0
    82
	unsigned short	seq;	/* sequence # (to generate unique ipcid) */
sl@0
    83
	key_t		key;	/* user specified msg/sem/shm key */
sl@0
    84
};
sl@0
    85
sl@0
    86
#if __BSD_VISIBLE
sl@0
    87
/* common mode bits */
sl@0
    88
#define	IPC_R		000400	/* read permission */
sl@0
    89
#define	IPC_W		000200	/* write/alter permission */
sl@0
    90
#define	IPC_M		010000	/* permission to change control info */
sl@0
    91
#endif
sl@0
    92
sl@0
    93
/* SVID required constants (same values as system 5) */
sl@0
    94
#define	IPC_CREAT	001000	/* create entry if key does not exist */
sl@0
    95
#define	IPC_EXCL	002000	/* fail if key exists */
sl@0
    96
#define	IPC_NOWAIT	004000	/* error if request must wait */
sl@0
    97
sl@0
    98
#define	IPC_PRIVATE	(key_t)0 /* private key */
sl@0
    99
sl@0
   100
#define	IPC_RMID	0	/* remove identifier */
sl@0
   101
#define	IPC_SET		1	/* set options */
sl@0
   102
#define	IPC_STAT	2	/* get options */
sl@0
   103
#if __BSD_VISIBLE
sl@0
   104
#define	IPC_INFO	3	/* get info */
sl@0
   105
#endif
sl@0
   106
sl@0
   107
#ifdef _KERNEL
sl@0
   108
/* Macros to convert between ipc ids and array indices or sequence ids */
sl@0
   109
#define	IPCID_TO_IX(id)		((id) & 0xffff)
sl@0
   110
#define	IPCID_TO_SEQ(id)	(((id) >> 16) & 0xffff)
sl@0
   111
#define	IXSEQ_TO_IPCID(ix,perm)	(((perm.seq) << 16) | (ix & 0xffff))
sl@0
   112
sl@0
   113
struct thread;
sl@0
   114
struct proc;
sl@0
   115
struct vmspace;
sl@0
   116
sl@0
   117
extern void (*shmfork_hook)(struct proc *, struct proc *);
sl@0
   118
extern void (*shmexit_hook)(struct vmspace *);
sl@0
   119
sl@0
   120
#else /* ! _KERNEL */
sl@0
   121
sl@0
   122
__BEGIN_DECLS
sl@0
   123
/*
sl@0
   124
* Convert a pathname and project identifier to an IPC key.
sl@0
   125
*/
sl@0
   126
IMPORT_C key_t ftok(const char *pathname, int proj_id);
sl@0
   127
sl@0
   128
__END_DECLS
sl@0
   129
sl@0
   130
#endif /* _KERNEL */
sl@0
   131
sl@0
   132
#endif /* !_SYS_IPC_H_ */
sl@0
   133
sl@0
   134
sl@0
   135
sl@0
   136
//  End of File