1*ce099b40Smartin /* $NetBSD: linux_ipc.h,v 1.9 2008/04/28 20:23:43 martin Exp $ */ 2b64f5d3bSerh 3b64f5d3bSerh /*- 48096c25aSfvdl * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. 5b64f5d3bSerh * All rights reserved. 6b64f5d3bSerh * 7b64f5d3bSerh * This code is derived from software contributed to The NetBSD Foundation 88096c25aSfvdl * by Frank van der Linden and Eric Haszlakiewicz. 9b64f5d3bSerh * 10b64f5d3bSerh * Redistribution and use in source and binary forms, with or without 11b64f5d3bSerh * modification, are permitted provided that the following conditions 12b64f5d3bSerh * are met: 13b64f5d3bSerh * 1. Redistributions of source code must retain the above copyright 14b64f5d3bSerh * notice, this list of conditions and the following disclaimer. 15b64f5d3bSerh * 2. Redistributions in binary form must reproduce the above copyright 16b64f5d3bSerh * notice, this list of conditions and the following disclaimer in the 17b64f5d3bSerh * documentation and/or other materials provided with the distribution. 18b64f5d3bSerh * 19b64f5d3bSerh * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20b64f5d3bSerh * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21b64f5d3bSerh * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22b64f5d3bSerh * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23b64f5d3bSerh * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24b64f5d3bSerh * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25b64f5d3bSerh * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26b64f5d3bSerh * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27b64f5d3bSerh * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28b64f5d3bSerh * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29b64f5d3bSerh * POSSIBILITY OF SUCH DAMAGE. 30b64f5d3bSerh */ 313bf459f3Sfvdl 32908291d2Schristos #ifndef _LINUX_IPC_H 33908291d2Schristos #define _LINUX_IPC_H 34b64f5d3bSerh 356a89288aSmrg #if defined(_KERNEL_OPT) 3641590f69Serh #include "opt_sysv.h" 3741590f69Serh #endif 3841590f69Serh 39b64f5d3bSerh #include <sys/ipc.h> 403bf459f3Sfvdl 413bf459f3Sfvdl /* 423bf459f3Sfvdl * Structs and values to handle the SYSV ipc/shm/msg calls implemented 433bf459f3Sfvdl * in Linux. Most values match the NetBSD values (as they are both derived 443bf459f3Sfvdl * from SysV values). Values that are the same may not be defined here. 453bf459f3Sfvdl */ 463bf459f3Sfvdl 473bf459f3Sfvdl typedef int linux_key_t; 483bf459f3Sfvdl 493bf459f3Sfvdl /* 503bf459f3Sfvdl * The only thing different about the Linux ipc_perm structure is the 513bf459f3Sfvdl * order of the fields. 523bf459f3Sfvdl */ 533bf459f3Sfvdl struct linux_ipc_perm { 543bf459f3Sfvdl linux_key_t l_key; 553bf459f3Sfvdl ushort l_uid; 563bf459f3Sfvdl ushort l_gid; 573bf459f3Sfvdl ushort l_cuid; 583bf459f3Sfvdl ushort l_cgid; 593bf459f3Sfvdl ushort l_mode; 603bf459f3Sfvdl ushort l_seq; 613bf459f3Sfvdl }; 623bf459f3Sfvdl 6365de380aSchristos struct linux_ipc64_perm { 6465de380aSchristos linux_key_t l_key; 6565de380aSchristos uint l_uid; 6665de380aSchristos uint l_gid; 6765de380aSchristos uint l_cuid; 6865de380aSchristos uint l_cgid; 6965de380aSchristos ushort l_mode; 7065de380aSchristos ushort l___pad1; 7165de380aSchristos ushort l_seq; 7265de380aSchristos ushort l___pad2; 7365de380aSchristos ulong l___unused1; 7465de380aSchristos ulong l___unused2; 7565de380aSchristos }; 7665de380aSchristos 773bf459f3Sfvdl #define LINUX_IPC_RMID 0 783bf459f3Sfvdl #define LINUX_IPC_SET 1 793bf459f3Sfvdl #define LINUX_IPC_STAT 2 803bf459f3Sfvdl #define LINUX_IPC_INFO 3 813bf459f3Sfvdl 8265de380aSchristos #define LINUX_IPC_64 0x100 8365de380aSchristos 84b64f5d3bSerh #if defined (SYSVSEM) || defined(SYSVSHM) || defined(SYSVMSG) 85b64f5d3bSerh #ifdef _KERNEL 86b64f5d3bSerh __BEGIN_DECLS 87f2af9174Sdsl void linux_to_bsd_ipc_perm(struct linux_ipc_perm *, 88f2af9174Sdsl struct ipc_perm *); 89f2af9174Sdsl void linux_to_bsd_ipc64_perm(struct linux_ipc64_perm *, 90f2af9174Sdsl struct ipc_perm *); 91f2af9174Sdsl void bsd_to_linux_ipc_perm(struct ipc_perm *, 92f2af9174Sdsl struct linux_ipc_perm *); 93f2af9174Sdsl void bsd_to_linux_ipc64_perm(struct ipc_perm *, 94f2af9174Sdsl struct linux_ipc64_perm *); 95b64f5d3bSerh __END_DECLS 96b64f5d3bSerh #endif /* !_KERNEL */ 97b64f5d3bSerh #endif /* !SYSVSEM, !SYSVSHM, !SYSVMSG */ 98b64f5d3bSerh 99908291d2Schristos #endif /* !_LINUX_IPC_H */ 100