diff options
author | dchagin <dchagin@FreeBSD.org> | 2017-04-15 15:11:23 +0000 |
---|---|---|
committer | dchagin <dchagin@FreeBSD.org> | 2017-04-15 15:11:23 +0000 |
commit | 92fe6dbe06a92e3b53c56202f180cfcd6436bd0e (patch) | |
tree | c78d7aa6c7887a97d64d0a71a81c958e493c85f3 /sys/i386 | |
parent | 0d28ee294899b065b8b0f868f780a293190049c5 (diff) | |
download | FreeBSD-src-92fe6dbe06a92e3b53c56202f180cfcd6436bd0e.zip FreeBSD-src-92fe6dbe06a92e3b53c56202f180cfcd6436bd0e.tar.gz |
MFC r314866:
Reduce code duplication between MD Linux code by moving SYSV IPC 64-bit
related struct definitions out into the MI path.
Invert the native ipc structs to the Linux ipc structs convesion logic.
Since 64-bit variant of ipc structs has more precision convert native ipc
structs to the 64-bit Linux ipc structs and then truncate 64-bit values
into the non 64-bit if needed. Unlike Linux, return EOVERFLOW if the
values do not fit.
Fix SYSV IPC for 64-bit Linuxulator which never sets IPC_64 bit.
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/linux/linux.h | 10 | ||||
-rw-r--r-- | sys/i386/linux/linux_ipc64.h | 145 |
2 files changed, 0 insertions, 155 deletions
diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h index 9493b0a..d485e10 100644 --- a/sys/i386/linux/linux.h +++ b/sys/i386/linux/linux.h @@ -453,16 +453,6 @@ union l_semun { void *__pad; }; -struct l_ipc_perm { - l_key_t key; - l_uid16_t uid; - l_gid16_t gid; - l_uid16_t cuid; - l_gid16_t cgid; - l_ushort mode; - l_ushort seq; -}; - /* * Socket defines */ diff --git a/sys/i386/linux/linux_ipc64.h b/sys/i386/linux/linux_ipc64.h deleted file mode 100644 index 04ff5f4..0000000 --- a/sys/i386/linux/linux_ipc64.h +++ /dev/null @@ -1,145 +0,0 @@ -/*- - * Copyright (c) 2002 Maxim Sobolev <sobomax@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _I386_LINUX_LINUX_IPC64_H_ -#define _I386_LINUX_LINUX_IPC64_H_ - -/* - * The ipc64_perm structure for i386 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 32-bit mode_t and seq - * - 2 miscellaneous 32-bit values - */ - -struct l_ipc64_perm -{ - l_key_t key; - l_uid_t uid; - l_gid_t gid; - l_uid_t cuid; - l_gid_t cgid; - l_mode_t mode; - l_ushort __pad1; - l_ushort seq; - l_ushort __pad2; - l_ulong __unused1; - l_ulong __unused2; -}; - -/* - * The msqid64_ds structure for i386 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 64-bit time_t to solve y2038 problem - * - 2 miscellaneous 32-bit values - */ - -struct l_msqid64_ds { - struct l_ipc64_perm msg_perm; - l_time_t msg_stime; /* last msgsnd time */ - l_ulong __unused1; - l_time_t msg_rtime; /* last msgrcv time */ - l_ulong __unused2; - l_time_t msg_ctime; /* last change time */ - l_ulong __unused3; - l_ulong msg_cbytes; /* current number of bytes on queue */ - l_ulong msg_qnum; /* number of messages in queue */ - l_ulong msg_qbytes; /* max number of bytes on queue */ - l_pid_t msg_lspid; /* pid of last msgsnd */ - l_pid_t msg_lrpid; /* last receive pid */ - l_ulong __unused4; - l_ulong __unused5; -}; - -/* - * The semid64_ds structure for i386 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 64-bit time_t to solve y2038 problem - * - 2 miscellaneous 32-bit values - */ - -struct l_semid64_ds { - struct l_ipc64_perm sem_perm; /* permissions */ - l_time_t sem_otime; /* last semop time */ - l_ulong __unused1; - l_time_t sem_ctime; /* last change time */ - l_ulong __unused2; - l_ulong sem_nsems; /* no. of semaphores in array */ - l_ulong __unused3; - l_ulong __unused4; -}; - -/* - * The shmid64_ds structure for i386 architecture. - * Note extra padding because this structure is passed back and forth - * between kernel and user space. - * - * Pad space is left for: - * - 64-bit time_t to solve y2038 problem - * - 2 miscellaneous 32-bit values - */ - -struct l_shmid64_ds { - struct l_ipc64_perm shm_perm; /* operation perms */ - l_size_t shm_segsz; /* size of segment (bytes) */ - l_time_t shm_atime; /* last attach time */ - l_ulong __unused1; - l_time_t shm_dtime; /* last detach time */ - l_ulong __unused2; - l_time_t shm_ctime; /* last change time */ - l_ulong __unused3; - l_pid_t shm_cpid; /* pid of creator */ - l_pid_t shm_lpid; /* pid of last operator */ - l_ulong shm_nattch; /* no. of current attaches */ - l_ulong __unused4; - l_ulong __unused5; -}; - -struct l_shminfo64 { - l_ulong shmmax; - l_ulong shmmin; - l_ulong shmmni; - l_ulong shmseg; - l_ulong shmall; - l_ulong __unused1; - l_ulong __unused2; - l_ulong __unused3; - l_ulong __unused4; -}; - -#endif /* !_I386_LINUX_LINUX_IPC64_H_ */ |