Home | History | Annotate | Line # | Download | only in common
linux_ipc.h revision 1.9
      1  1.9    martin /*	$NetBSD: linux_ipc.h,v 1.9 2008/04/28 20:23:43 martin Exp $	*/
      2  1.2       erh 
      3  1.2       erh /*-
      4  1.4      fvdl  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
      5  1.2       erh  * All rights reserved.
      6  1.2       erh  *
      7  1.2       erh  * This code is derived from software contributed to The NetBSD Foundation
      8  1.4      fvdl  * by Frank van der Linden and Eric Haszlakiewicz.
      9  1.2       erh  *
     10  1.2       erh  * Redistribution and use in source and binary forms, with or without
     11  1.2       erh  * modification, are permitted provided that the following conditions
     12  1.2       erh  * are met:
     13  1.2       erh  * 1. Redistributions of source code must retain the above copyright
     14  1.2       erh  *    notice, this list of conditions and the following disclaimer.
     15  1.2       erh  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.2       erh  *    notice, this list of conditions and the following disclaimer in the
     17  1.2       erh  *    documentation and/or other materials provided with the distribution.
     18  1.2       erh  *
     19  1.2       erh  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  1.2       erh  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  1.2       erh  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  1.2       erh  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  1.2       erh  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  1.2       erh  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  1.2       erh  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  1.2       erh  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  1.2       erh  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  1.2       erh  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  1.2       erh  * POSSIBILITY OF SUCH DAMAGE.
     30  1.1      fvdl  */
     31  1.1      fvdl 
     32  1.3  christos #ifndef _LINUX_IPC_H
     33  1.3  christos #define _LINUX_IPC_H
     34  1.5       erh 
     35  1.6       mrg #if defined(_KERNEL_OPT)
     36  1.5       erh #include "opt_sysv.h"
     37  1.5       erh #endif
     38  1.2       erh 
     39  1.2       erh #include <sys/ipc.h>
     40  1.1      fvdl 
     41  1.1      fvdl /*
     42  1.1      fvdl  * Structs and values to handle the SYSV ipc/shm/msg calls implemented
     43  1.1      fvdl  * in Linux. Most values match the NetBSD values (as they are both derived
     44  1.1      fvdl  * from SysV values). Values that are the same may not be defined here.
     45  1.1      fvdl  */
     46  1.1      fvdl 
     47  1.1      fvdl typedef int linux_key_t;
     48  1.1      fvdl 
     49  1.1      fvdl /*
     50  1.1      fvdl  * The only thing different about the Linux ipc_perm structure is the
     51  1.1      fvdl  * order of the fields.
     52  1.1      fvdl  */
     53  1.1      fvdl struct linux_ipc_perm {
     54  1.1      fvdl 	linux_key_t	l_key;
     55  1.1      fvdl 	ushort		l_uid;
     56  1.1      fvdl 	ushort		l_gid;
     57  1.1      fvdl 	ushort		l_cuid;
     58  1.1      fvdl 	ushort		l_cgid;
     59  1.1      fvdl 	ushort		l_mode;
     60  1.1      fvdl 	ushort		l_seq;
     61  1.1      fvdl };
     62  1.1      fvdl 
     63  1.7  christos struct linux_ipc64_perm {
     64  1.7  christos 	linux_key_t	l_key;
     65  1.7  christos 	uint		l_uid;
     66  1.7  christos 	uint		l_gid;
     67  1.7  christos 	uint		l_cuid;
     68  1.7  christos 	uint		l_cgid;
     69  1.7  christos 	ushort		l_mode;
     70  1.7  christos 	ushort		l___pad1;
     71  1.7  christos 	ushort		l_seq;
     72  1.7  christos 	ushort		l___pad2;
     73  1.7  christos 	ulong		l___unused1;
     74  1.7  christos 	ulong		l___unused2;
     75  1.7  christos };
     76  1.7  christos 
     77  1.1      fvdl #define LINUX_IPC_RMID	0
     78  1.1      fvdl #define LINUX_IPC_SET	1
     79  1.1      fvdl #define LINUX_IPC_STAT	2
     80  1.1      fvdl #define LINUX_IPC_INFO	3
     81  1.1      fvdl 
     82  1.7  christos #define LINUX_IPC_64	0x100
     83  1.7  christos 
     84  1.2       erh #if defined (SYSVSEM) || defined(SYSVSHM) || defined(SYSVMSG)
     85  1.2       erh #ifdef _KERNEL
     86  1.2       erh __BEGIN_DECLS
     87  1.8       dsl void linux_to_bsd_ipc_perm(struct linux_ipc_perm *,
     88  1.8       dsl 				       struct ipc_perm *);
     89  1.8       dsl void linux_to_bsd_ipc64_perm(struct linux_ipc64_perm *,
     90  1.8       dsl 				       struct ipc_perm *);
     91  1.8       dsl void bsd_to_linux_ipc_perm(struct ipc_perm *,
     92  1.8       dsl 				       struct linux_ipc_perm *);
     93  1.8       dsl void bsd_to_linux_ipc64_perm(struct ipc_perm *,
     94  1.8       dsl 				       struct linux_ipc64_perm *);
     95  1.2       erh __END_DECLS
     96  1.2       erh #endif	/* !_KERNEL */
     97  1.2       erh #endif	/* !SYSVSEM, !SYSVSHM, !SYSVMSG */
     98  1.2       erh 
     99  1.3  christos #endif /* !_LINUX_IPC_H */
    100