mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-27 03:41:23 +08:00
Remove __ASSUME_IPC64
PowerPC has always used __IPC_64 like most other architectures, which means that __ASSUME_IPC64 can be always true. Also, all other architecture implementations that use the ipc syscall are effectively identical to the generic version and can be removed.
This commit is contained in:
parent
1695cdae06
commit
be481652f2
28
ChangeLog
28
ChangeLog
@ -1,3 +1,31 @@
|
|||||||
|
2015-08-24 Andreas Schwab <schwab@suse.de>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_IPC64):
|
||||||
|
Don't define.
|
||||||
|
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
|
||||||
|
(__ASSUME_IPC64): Don't undef.
|
||||||
|
* sysdeps/unix/sysv/linux/msgctl.c: Don't check for __ASSUME_IPC64.
|
||||||
|
* sysdeps/unix/sysv/linux/semctl.c: Likewise.
|
||||||
|
* sysdeps/unix/sysv/linux/shmctl.c: Likewise.
|
||||||
|
* sysdeps/unix/sysv/linux/i386/msgctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/i386/semctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/i386/shmctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/m68k/msgctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/m68k/semctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/m68k/shmctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/s390/s390-32/msgctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/s390/s390-32/semctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/s390/s390-32/shmctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/sh/msgctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/sh/semctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/sh/shmctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/sparc/sparc32/msgctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/sparc/sparc32/shmctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/sparc/sparc64/msgctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c: Remove.
|
||||||
|
* sysdeps/unix/sysv/linux/sparc/sparc64/shmctl.c: Remove.
|
||||||
|
|
||||||
2015-08-21 Mike Frysinger <vapier@gentoo.org>
|
2015-08-21 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
* manual/Makefile (install): Only build manual when perl is available.
|
* manual/Makefile (install): Only build manual when perl is available.
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/msg.h>
|
|
||||||
#include <ipc_priv.h>
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/syscall.h>
|
|
||||||
|
|
||||||
#include <shlib-compat.h>
|
|
||||||
|
|
||||||
struct __old_msqid_ds
|
|
||||||
{
|
|
||||||
struct __old_ipc_perm msg_perm; /* structure describing operation permission */
|
|
||||||
struct msg *__msg_first; /* pointer to first message on queue */
|
|
||||||
struct msg *__msg_last; /* pointer to last message on queue */
|
|
||||||
__time_t msg_stime; /* time of last msgsnd command */
|
|
||||||
__time_t msg_rtime; /* time of last msgrcv command */
|
|
||||||
__time_t msg_ctime; /* time of last change */
|
|
||||||
struct wait_queue *__wwait; /* ??? */
|
|
||||||
struct wait_queue *__rwait; /* ??? */
|
|
||||||
unsigned short int __msg_cbytes; /* current number of bytes on queue */
|
|
||||||
unsigned short int msg_qnum; /* number of messages currently on queue */
|
|
||||||
unsigned short int msg_qbytes; /* max number of bytes allowed on queue */
|
|
||||||
__ipc_pid_t msg_lspid; /* pid of last msgsnd() */
|
|
||||||
__ipc_pid_t msg_lrpid; /* pid of last msgrcv() */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Allows to control internal state and destruction of message queue
|
|
||||||
objects. */
|
|
||||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
|
|
||||||
int __old_msgctl (int, int, struct __old_msqid_ds *);
|
|
||||||
#endif
|
|
||||||
int __new_msgctl (int, int, struct msqid_ds *);
|
|
||||||
|
|
||||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
|
|
||||||
int
|
|
||||||
attribute_compat_text_section
|
|
||||||
__old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf)
|
|
||||||
{
|
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd, 0, buf);
|
|
||||||
}
|
|
||||||
compat_symbol (libc, __old_msgctl, msgctl, GLIBC_2_0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
|
||||||
__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
|
|
||||||
{
|
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl,
|
|
||||||
msqid, cmd | __IPC_64, 0, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
versioned_symbol (libc, __new_msgctl, msgctl, GLIBC_2_2);
|
|
@ -1,97 +0,0 @@
|
|||||||
/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <sys/sem.h>
|
|
||||||
#include <ipc_priv.h>
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/syscall.h>
|
|
||||||
|
|
||||||
#include <shlib-compat.h>
|
|
||||||
|
|
||||||
struct __old_semid_ds
|
|
||||||
{
|
|
||||||
struct __old_ipc_perm sem_perm; /* operation permission struct */
|
|
||||||
__time_t sem_otime; /* last semop() time */
|
|
||||||
__time_t sem_ctime; /* last time changed by semctl() */
|
|
||||||
struct sem *__sembase; /* ptr to first semaphore in array */
|
|
||||||
struct sem_queue *__sem_pending; /* pending operations */
|
|
||||||
struct sem_queue *__sem_pending_last; /* last pending operation */
|
|
||||||
struct sem_undo *__undo; /* ondo requests on this array */
|
|
||||||
unsigned short int sem_nsems; /* number of semaphores in set */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Define a `union semun' suitable for Linux here. */
|
|
||||||
union semun
|
|
||||||
{
|
|
||||||
int val; /* value for SETVAL */
|
|
||||||
struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
|
|
||||||
unsigned short int *array; /* array for GETALL & SETALL */
|
|
||||||
struct seminfo *__buf; /* buffer for IPC_INFO */
|
|
||||||
struct __old_semid_ds *__old_buf;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Return identifier for array of NSEMS semaphores associated with
|
|
||||||
KEY. */
|
|
||||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
|
|
||||||
int __old_semctl (int semid, int semnum, int cmd, ...);
|
|
||||||
#endif
|
|
||||||
int __new_semctl (int semid, int semnum, int cmd, ...);
|
|
||||||
|
|
||||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
|
|
||||||
int
|
|
||||||
attribute_compat_text_section
|
|
||||||
__old_semctl (int semid, int semnum, int cmd, ...)
|
|
||||||
{
|
|
||||||
union semun arg;
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
va_start (ap, cmd);
|
|
||||||
|
|
||||||
/* Get the argument. */
|
|
||||||
arg = va_arg (ap, union semun);
|
|
||||||
|
|
||||||
va_end (ap);
|
|
||||||
|
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd,
|
|
||||||
&arg);
|
|
||||||
}
|
|
||||||
compat_symbol (libc, __old_semctl, semctl, GLIBC_2_0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
|
||||||
__new_semctl (int semid, int semnum, int cmd, ...)
|
|
||||||
{
|
|
||||||
union semun arg;
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
va_start (ap, cmd);
|
|
||||||
|
|
||||||
/* Get the argument. */
|
|
||||||
arg = va_arg (ap, union semun);
|
|
||||||
|
|
||||||
va_end (ap);
|
|
||||||
|
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64,
|
|
||||||
&arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
versioned_symbol (libc, __new_semctl, semctl, GLIBC_2_2);
|
|
@ -1,77 +0,0 @@
|
|||||||
/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/shm.h>
|
|
||||||
#include <ipc_priv.h>
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/syscall.h>
|
|
||||||
#include <bits/wordsize.h>
|
|
||||||
|
|
||||||
#include <shlib-compat.h>
|
|
||||||
|
|
||||||
struct __old_shmid_ds
|
|
||||||
{
|
|
||||||
struct __old_ipc_perm shm_perm; /* operation permission struct */
|
|
||||||
int shm_segsz; /* size of segment in bytes */
|
|
||||||
__time_t shm_atime; /* time of last shmat() */
|
|
||||||
__time_t shm_dtime; /* time of last shmdt() */
|
|
||||||
__time_t shm_ctime; /* time of last change by shmctl() */
|
|
||||||
__ipc_pid_t shm_cpid; /* pid of creator */
|
|
||||||
__ipc_pid_t shm_lpid; /* pid of last shmop */
|
|
||||||
unsigned short int shm_nattch; /* number of current attaches */
|
|
||||||
unsigned short int __shm_npages; /* size of segment (pages) */
|
|
||||||
unsigned long int *__shm_pages; /* array of ptrs to frames -> SHMMAX */
|
|
||||||
struct vm_area_struct *__attaches; /* descriptors for attaches */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct __old_shminfo
|
|
||||||
{
|
|
||||||
int shmmax;
|
|
||||||
int shmmin;
|
|
||||||
int shmmni;
|
|
||||||
int shmseg;
|
|
||||||
int shmall;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Provide operations to control over shared memory segments. */
|
|
||||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
|
|
||||||
int __old_shmctl (int, int, struct __old_shmid_ds *);
|
|
||||||
#endif
|
|
||||||
int __new_shmctl (int, int, struct shmid_ds *);
|
|
||||||
|
|
||||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
|
|
||||||
int
|
|
||||||
attribute_compat_text_section
|
|
||||||
__old_shmctl (int shmid, int cmd, struct __old_shmid_ds *buf)
|
|
||||||
{
|
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd, 0, buf);
|
|
||||||
}
|
|
||||||
compat_symbol (libc, __old_shmctl, shmctl, GLIBC_2_0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
|
||||||
__new_shmctl (int shmid, int cmd, struct shmid_ds *buf)
|
|
||||||
{
|
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl,
|
|
||||||
shmid, cmd | __IPC_64, 0, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
versioned_symbol (libc, __new_shmctl, shmctl, GLIBC_2_2);
|
|
@ -44,11 +44,6 @@
|
|||||||
socket-related operations instead of separate syscalls.
|
socket-related operations instead of separate syscalls.
|
||||||
__ASSUME_SOCKETCALL is defined for such architectures. */
|
__ASSUME_SOCKETCALL is defined for such architectures. */
|
||||||
|
|
||||||
/* Linux 2.3.39 introduced IPC64. Except for powerpc. Linux 2.4.0 on
|
|
||||||
PPC introduced a correct IPC64. But PowerPC64 does not support a
|
|
||||||
separate 64-bit syscall, already 64-bit. */
|
|
||||||
#define __ASSUME_IPC64 1
|
|
||||||
|
|
||||||
/* The changed st_ino field appeared in 2.4.0-test6. However, SH is lame,
|
/* The changed st_ino field appeared in 2.4.0-test6. However, SH is lame,
|
||||||
and still does not have a 64-bit inode field. */
|
and still does not have a 64-bit inode field. */
|
||||||
#define __ASSUME_ST_INO_64_BIT 1
|
#define __ASSUME_ST_INO_64_BIT 1
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/msgctl.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/semctl.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/shmctl.c>
|
|
@ -64,68 +64,7 @@ compat_symbol (libc, __old_msgctl, msgctl, GLIBC_2_0);
|
|||||||
int
|
int
|
||||||
__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
|
__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
|
||||||
{
|
{
|
||||||
#if __ASSUME_IPC64 > 0
|
return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd | __IPC_64, 0, buf);
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl,
|
|
||||||
msqid, cmd | __IPC_64, 0, buf);
|
|
||||||
#else
|
|
||||||
switch (cmd) {
|
|
||||||
case MSG_STAT:
|
|
||||||
case IPC_STAT:
|
|
||||||
case IPC_SET:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl,
|
|
||||||
msqid, cmd, 0, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
struct __old_msqid_ds old;
|
|
||||||
|
|
||||||
/* Unfortunately there is no way how to find out for sure whether
|
|
||||||
we should use old or new msgctl. */
|
|
||||||
result = INLINE_SYSCALL (ipc, 5, IPCOP_msgctl,
|
|
||||||
msqid, cmd | __IPC_64, 0, buf);
|
|
||||||
if (result != -1 || errno != EINVAL)
|
|
||||||
return result;
|
|
||||||
|
|
||||||
if (cmd == IPC_SET)
|
|
||||||
{
|
|
||||||
old.msg_perm.uid = buf->msg_perm.uid;
|
|
||||||
old.msg_perm.gid = buf->msg_perm.gid;
|
|
||||||
old.msg_perm.mode = buf->msg_perm.mode;
|
|
||||||
old.msg_qbytes = buf->msg_qbytes;
|
|
||||||
if (old.msg_perm.uid != buf->msg_perm.uid ||
|
|
||||||
old.msg_perm.gid != buf->msg_perm.gid ||
|
|
||||||
old.msg_qbytes != buf->msg_qbytes)
|
|
||||||
{
|
|
||||||
__set_errno (EINVAL);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result = INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd, 0, &old);
|
|
||||||
if (result != -1 && cmd != IPC_SET)
|
|
||||||
{
|
|
||||||
memset(buf, 0, sizeof(*buf));
|
|
||||||
buf->msg_perm.__key = old.msg_perm.__key;
|
|
||||||
buf->msg_perm.uid = old.msg_perm.uid;
|
|
||||||
buf->msg_perm.gid = old.msg_perm.gid;
|
|
||||||
buf->msg_perm.cuid = old.msg_perm.cuid;
|
|
||||||
buf->msg_perm.cgid = old.msg_perm.cgid;
|
|
||||||
buf->msg_perm.mode = old.msg_perm.mode;
|
|
||||||
buf->msg_perm.__seq = old.msg_perm.__seq;
|
|
||||||
buf->msg_stime = old.msg_stime;
|
|
||||||
buf->msg_rtime = old.msg_rtime;
|
|
||||||
buf->msg_ctime = old.msg_ctime;
|
|
||||||
buf->__msg_cbytes = old.__msg_cbytes;
|
|
||||||
buf->msg_qnum = old.msg_qnum;
|
|
||||||
buf->msg_qbytes = old.msg_qbytes;
|
|
||||||
buf->msg_lspid = old.msg_lspid;
|
|
||||||
buf->msg_lrpid = old.msg_lrpid;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
versioned_symbol (libc, __new_msgctl, msgctl, GLIBC_2_2);
|
versioned_symbol (libc, __new_msgctl, msgctl, GLIBC_2_2);
|
||||||
|
@ -37,6 +37,3 @@
|
|||||||
#define __ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL 1
|
#define __ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL 1
|
||||||
|
|
||||||
#include_next <kernel-features.h>
|
#include_next <kernel-features.h>
|
||||||
|
|
||||||
/* PowerPC64 IPC is always 64-bit and does not use __IPC_64. */
|
|
||||||
#undef __ASSUME_IPC64
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/msgctl.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/semctl.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/shmctl.c>
|
|
@ -121,67 +121,8 @@ __new_semctl (int semid, int semnum, int cmd, ...)
|
|||||||
|
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
|
||||||
#if __ASSUME_IPC64 > 0
|
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64,
|
return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64,
|
||||||
&arg);
|
&arg);
|
||||||
#else
|
|
||||||
switch (cmd)
|
|
||||||
{
|
|
||||||
case SEM_STAT:
|
|
||||||
case IPC_STAT:
|
|
||||||
case IPC_SET:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd,
|
|
||||||
&arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
int save_errno = errno, result;
|
|
||||||
struct __old_semid_ds old;
|
|
||||||
struct semid_ds *buf;
|
|
||||||
|
|
||||||
/* Unfortunately there is no way how to find out for sure whether
|
|
||||||
we should use old or new semctl. */
|
|
||||||
result = INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64,
|
|
||||||
&arg);
|
|
||||||
if (result != -1 || errno != EINVAL)
|
|
||||||
return result;
|
|
||||||
|
|
||||||
__set_errno(save_errno);
|
|
||||||
buf = arg.buf;
|
|
||||||
arg.__old_buf = &old;
|
|
||||||
if (cmd == IPC_SET)
|
|
||||||
{
|
|
||||||
old.sem_perm.uid = buf->sem_perm.uid;
|
|
||||||
old.sem_perm.gid = buf->sem_perm.gid;
|
|
||||||
old.sem_perm.mode = buf->sem_perm.mode;
|
|
||||||
if (old.sem_perm.uid != buf->sem_perm.uid ||
|
|
||||||
old.sem_perm.gid != buf->sem_perm.gid)
|
|
||||||
{
|
|
||||||
__set_errno (EINVAL);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result = INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd,
|
|
||||||
&arg);
|
|
||||||
if (result != -1 && cmd != IPC_SET)
|
|
||||||
{
|
|
||||||
memset(buf, 0, sizeof(*buf));
|
|
||||||
buf->sem_perm.__key = old.sem_perm.__key;
|
|
||||||
buf->sem_perm.uid = old.sem_perm.uid;
|
|
||||||
buf->sem_perm.gid = old.sem_perm.gid;
|
|
||||||
buf->sem_perm.cuid = old.sem_perm.cuid;
|
|
||||||
buf->sem_perm.cgid = old.sem_perm.cgid;
|
|
||||||
buf->sem_perm.mode = old.sem_perm.mode;
|
|
||||||
buf->sem_perm.__seq = old.sem_perm.__seq;
|
|
||||||
buf->sem_otime = old.sem_otime;
|
|
||||||
buf->sem_ctime = old.sem_ctime;
|
|
||||||
buf->sem_nsems = old.sem_nsems;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
versioned_symbol (libc, __new_semctl, semctl, GLIBC_2_2);
|
versioned_symbol (libc, __new_semctl, semctl, GLIBC_2_2);
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/msgctl.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/semctl.c>
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/shmctl.c>
|
|
@ -71,85 +71,8 @@ compat_symbol (libc, __old_shmctl, shmctl, GLIBC_2_0);
|
|||||||
int
|
int
|
||||||
__new_shmctl (int shmid, int cmd, struct shmid_ds *buf)
|
__new_shmctl (int shmid, int cmd, struct shmid_ds *buf)
|
||||||
{
|
{
|
||||||
#if __ASSUME_IPC64 > 0
|
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd | __IPC_64, 0,
|
return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd | __IPC_64, 0,
|
||||||
buf);
|
buf);
|
||||||
#else
|
|
||||||
switch (cmd) {
|
|
||||||
case SHM_STAT:
|
|
||||||
case IPC_STAT:
|
|
||||||
case IPC_SET:
|
|
||||||
#if __WORDSIZE != 32
|
|
||||||
case IPC_INFO:
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd, 0, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
int save_errno = errno, result;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
struct __old_shmid_ds ds;
|
|
||||||
struct __old_shminfo info;
|
|
||||||
} old;
|
|
||||||
|
|
||||||
/* Unfortunately there is no way how to find out for sure whether
|
|
||||||
we should use old or new shmctl. */
|
|
||||||
result = INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd | __IPC_64, 0,
|
|
||||||
buf);
|
|
||||||
if (result != -1 || errno != EINVAL)
|
|
||||||
return result;
|
|
||||||
|
|
||||||
__set_errno(save_errno);
|
|
||||||
if (cmd == IPC_SET)
|
|
||||||
{
|
|
||||||
old.ds.shm_perm.uid = buf->shm_perm.uid;
|
|
||||||
old.ds.shm_perm.gid = buf->shm_perm.gid;
|
|
||||||
old.ds.shm_perm.mode = buf->shm_perm.mode;
|
|
||||||
if (old.ds.shm_perm.uid != buf->shm_perm.uid ||
|
|
||||||
old.ds.shm_perm.gid != buf->shm_perm.gid)
|
|
||||||
{
|
|
||||||
__set_errno (EINVAL);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result = INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd, 0, &old.ds);
|
|
||||||
if (result != -1 && (cmd == SHM_STAT || cmd == IPC_STAT))
|
|
||||||
{
|
|
||||||
memset(buf, 0, sizeof(*buf));
|
|
||||||
buf->shm_perm.__key = old.ds.shm_perm.__key;
|
|
||||||
buf->shm_perm.uid = old.ds.shm_perm.uid;
|
|
||||||
buf->shm_perm.gid = old.ds.shm_perm.gid;
|
|
||||||
buf->shm_perm.cuid = old.ds.shm_perm.cuid;
|
|
||||||
buf->shm_perm.cgid = old.ds.shm_perm.cgid;
|
|
||||||
buf->shm_perm.mode = old.ds.shm_perm.mode;
|
|
||||||
buf->shm_perm.__seq = old.ds.shm_perm.__seq;
|
|
||||||
buf->shm_atime = old.ds.shm_atime;
|
|
||||||
buf->shm_dtime = old.ds.shm_dtime;
|
|
||||||
buf->shm_ctime = old.ds.shm_ctime;
|
|
||||||
buf->shm_segsz = old.ds.shm_segsz;
|
|
||||||
buf->shm_nattch = old.ds.shm_nattch;
|
|
||||||
buf->shm_cpid = old.ds.shm_cpid;
|
|
||||||
buf->shm_lpid = old.ds.shm_lpid;
|
|
||||||
}
|
|
||||||
#if __WORDSIZE != 32
|
|
||||||
else if (result != -1 && cmd == IPC_INFO)
|
|
||||||
{
|
|
||||||
struct shminfo *i = (struct shminfo *)buf;
|
|
||||||
|
|
||||||
memset(i, 0, sizeof(*i));
|
|
||||||
i->shmmax = old.info.shmmax;
|
|
||||||
i->shmmin = old.info.shmmin;
|
|
||||||
i->shmmni = old.info.shmmni;
|
|
||||||
i->shmseg = old.info.shmseg;
|
|
||||||
i->shmall = old.info.shmall;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
versioned_symbol (libc, __new_shmctl, shmctl, GLIBC_2_2);
|
versioned_symbol (libc, __new_shmctl, shmctl, GLIBC_2_2);
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/msgctl.c>
|
|
@ -1,120 +0,0 @@
|
|||||||
/* Semctl for architectures where word sized unions are passed indirectly
|
|
||||||
Copyright (C) 1995-2015 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <sys/sem.h>
|
|
||||||
#include <ipc_priv.h>
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/syscall.h>
|
|
||||||
|
|
||||||
#include <shlib-compat.h>
|
|
||||||
|
|
||||||
struct __old_semid_ds
|
|
||||||
{
|
|
||||||
struct __old_ipc_perm sem_perm; /* operation permission struct */
|
|
||||||
__time_t sem_otime; /* last semop() time */
|
|
||||||
__time_t sem_ctime; /* last time changed by semctl() */
|
|
||||||
struct sem *__sembase; /* ptr to first semaphore in array */
|
|
||||||
struct sem_queue *__sem_pending; /* pending operations */
|
|
||||||
struct sem_queue *__sem_pending_last; /* last pending operation */
|
|
||||||
struct sem_undo *__undo; /* ondo requests on this array */
|
|
||||||
unsigned short int sem_nsems; /* number of semaphores in set */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Define a `union semun' suitable for Linux here. */
|
|
||||||
union semun
|
|
||||||
{
|
|
||||||
int val; /* value for SETVAL */
|
|
||||||
struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
|
|
||||||
unsigned short int *array; /* array for GETALL & SETALL */
|
|
||||||
struct seminfo *__buf; /* buffer for IPC_INFO */
|
|
||||||
struct __old_semid_ds *__old_buf;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Return identifier for array of NSEMS semaphores associated with
|
|
||||||
KEY. */
|
|
||||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
|
|
||||||
int __old_semctl (int semid, int semnum, int cmd, ...);
|
|
||||||
#endif
|
|
||||||
int __new_semctl (int semid, int semnum, int cmd, ...);
|
|
||||||
|
|
||||||
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
|
|
||||||
int
|
|
||||||
attribute_compat_text_section
|
|
||||||
__old_semctl (int semid, int semnum, int cmd, ...)
|
|
||||||
{
|
|
||||||
union semun arg;
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
/* Get the argument only if required. */
|
|
||||||
arg.buf = NULL;
|
|
||||||
switch (cmd)
|
|
||||||
{
|
|
||||||
case SETVAL: /* arg.val */
|
|
||||||
case GETALL: /* arg.array */
|
|
||||||
case SETALL:
|
|
||||||
case IPC_STAT: /* arg.buf */
|
|
||||||
case IPC_SET:
|
|
||||||
case SEM_STAT:
|
|
||||||
case IPC_INFO: /* arg.__buf */
|
|
||||||
case SEM_INFO:
|
|
||||||
va_start (ap, cmd);
|
|
||||||
arg = va_arg (ap, union semun);
|
|
||||||
va_end (ap);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd,
|
|
||||||
&arg);
|
|
||||||
}
|
|
||||||
compat_symbol (libc, __old_semctl, semctl, GLIBC_2_0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
|
||||||
__new_semctl (int semid, int semnum, int cmd, ...)
|
|
||||||
{
|
|
||||||
union semun arg;
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
/* Get the argument only if required. */
|
|
||||||
arg.buf = NULL;
|
|
||||||
switch (cmd)
|
|
||||||
{
|
|
||||||
case SETVAL: /* arg.val */
|
|
||||||
case GETALL: /* arg.array */
|
|
||||||
case SETALL:
|
|
||||||
case IPC_STAT: /* arg.buf */
|
|
||||||
case IPC_SET:
|
|
||||||
case SEM_STAT:
|
|
||||||
case IPC_INFO: /* arg.__buf */
|
|
||||||
case SEM_INFO:
|
|
||||||
va_start (ap, cmd);
|
|
||||||
arg = va_arg (ap, union semun);
|
|
||||||
va_end (ap);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64,
|
|
||||||
&arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
versioned_symbol (libc, __new_semctl, semctl, GLIBC_2_2);
|
|
@ -1 +0,0 @@
|
|||||||
#include <sysdeps/unix/sysv/linux/i386/shmctl.c>
|
|
@ -1,36 +0,0 @@
|
|||||||
/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/msg.h>
|
|
||||||
#include <ipc_priv.h>
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
#include <sys/syscall.h>
|
|
||||||
|
|
||||||
/* Allows to control internal state and destruction of message queue
|
|
||||||
objects. */
|
|
||||||
|
|
||||||
int
|
|
||||||
msgctl (msqid, cmd, buf)
|
|
||||||
int msqid;
|
|
||||||
int cmd;
|
|
||||||
struct msqid_ds *buf;
|
|
||||||
{
|
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd, 0, buf);
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <sys/sem.h>
|
|
||||||
#include <ipc_priv.h>
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
#include <sys/syscall.h>
|
|
||||||
|
|
||||||
/* Define a `union semun' suitable for Linux here. */
|
|
||||||
union semun
|
|
||||||
{
|
|
||||||
int val; /* value for SETVAL */
|
|
||||||
struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
|
|
||||||
unsigned short int *array; /* array for GETALL & SETALL */
|
|
||||||
struct seminfo *__buf; /* buffer for IPC_INFO */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Return identifier for array of NSEMS semaphores associated with
|
|
||||||
KEY. */
|
|
||||||
|
|
||||||
int
|
|
||||||
semctl (int semid, int semnum, int cmd, ...)
|
|
||||||
{
|
|
||||||
union semun arg;
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
va_start (ap, cmd);
|
|
||||||
|
|
||||||
/* Get the argument. */
|
|
||||||
arg = va_arg (ap, union semun);
|
|
||||||
|
|
||||||
va_end (ap);
|
|
||||||
|
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd,
|
|
||||||
arg.array);
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<http://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/shm.h>
|
|
||||||
#include <ipc_priv.h>
|
|
||||||
|
|
||||||
#include <sysdep.h>
|
|
||||||
#include <sys/syscall.h>
|
|
||||||
|
|
||||||
/* Provide operations to control over shared memory segments. */
|
|
||||||
|
|
||||||
int
|
|
||||||
shmctl (shmid, cmd, buf)
|
|
||||||
int shmid;
|
|
||||||
int cmd;
|
|
||||||
struct shmid_ds *buf;
|
|
||||||
{
|
|
||||||
return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd, 0, buf);
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user