diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2016-10-26 18:04:48 -0200 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2016-12-28 20:31:05 -0200 |
commit | 8232e7d2097eb8e5ca5548ff1ae3f7257f274a87 (patch) | |
tree | 22600c77563c75b0a6485fe61bac68bcdcb9d635 /sysdeps/unix | |
parent | 1afc369f1aa153ffcfbc50b4e840bdf5746b705d (diff) | |
download | glibc-8232e7d2097eb8e5ca5548ff1ae3f7257f274a87.tar.gz glibc-8232e7d2097eb8e5ca5548ff1ae3f7257f274a87.tar.xz glibc-8232e7d2097eb8e5ca5548ff1ae3f7257f274a87.zip |
Use shmat syscall for Linux implementation
This patch add a direct call to shmat syscall if it is supported by kernel features. Checked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/alpha/syscalls.list (shmat): Remove. * sysdeps/unix/sysv/linux/arm/syscalls.list (shmat): Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list (shmat): Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list (shmat): Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (shmat): Likewise. * sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmat): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmat): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmat): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmat): Likewise. * sysdeps/unix/sysv/linux/alpha/kernel-features.h (__NR_shmat): Define to __NR_osf_shmat. * sysdeps/unix/sysv/linux/shmat.c (shmat): Use shmat syscall if it is defined.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/kernel-features.h | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/arm/syscalls.list | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/generic/syscalls.list | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/syscalls.list | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/microblaze/syscalls.list | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/mips/mips64/syscalls.list | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 9 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/shmat.c | 17 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 |
11 files changed, 15 insertions, 22 deletions
diff --git a/sysdeps/unix/sysv/linux/alpha/kernel-features.h b/sysdeps/unix/sysv/linux/alpha/kernel-features.h index f09222d225..2fc3b7758a 100644 --- a/sysdeps/unix/sysv/linux/alpha/kernel-features.h +++ b/sysdeps/unix/sysv/linux/alpha/kernel-features.h @@ -29,4 +29,7 @@ #undef __ASSUME_STATFS64 #define __ASSUME_STATFS64 0 +/* Alpha defines SysV ipc shmat syscall with a different name. */ +#define __NR_shmat __NR_osf_shmat + #endif /* _KERNEL_FEATURES_H */ diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list index 8d3a042afe..9948d2d176 100644 --- a/sysdeps/unix/sysv/linux/alpha/syscalls.list +++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list @@ -1,6 +1,5 @@ # File name Caller Syscall name # args Strong name Weak names -shmat - osf_shmat i:ipi __shmat shmat oldshmctl EXTRA shmctl i:iip __old_shmctl shmctl@GLIBC_2.0 shmdt - shmdt i:s __shmdt shmdt shmget - shmget i:iii __shmget shmget diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list index 1b2de93518..f50a5cf6bf 100644 --- a/sysdeps/unix/sysv/linux/arm/syscalls.list +++ b/sysdeps/unix/sysv/linux/arm/syscalls.list @@ -23,7 +23,6 @@ personality EXTRA personality Ei:i __personality personality # Semaphore and shm system calls. msgctl, shmctl, and semctl have C # wrappers (to set __IPC_64). -shmat - shmat i:ipi __shmat shmat shmdt - shmdt i:s __shmdt shmdt shmget - shmget i:iii __shmget shmget diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list index e12fb3e8b1..0df73a9e2b 100644 --- a/sysdeps/unix/sysv/linux/generic/syscalls.list +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list @@ -3,7 +3,6 @@ # SysV APIs shmget - shmget i:iii __shmget shmget shmctl - shmctl i:iip __shmctl shmctl -shmat - shmat i:ipi __shmat shmat shmdt - shmdt i:s __shmdt shmdt # Socket APIs diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list index a8fbc44417..f757f026af 100644 --- a/sysdeps/unix/sysv/linux/hppa/syscalls.list +++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list @@ -1,7 +1,6 @@ # File name Caller Syscall name # args Strong name Weak names # semaphore and shm system calls -shmat - shmat i:ipi __shmat shmat shmctl - shmctl i:iip __shmctl shmctl shmdt - shmdt i:s __shmdt shmdt shmget - shmget i:iii __shmget shmget diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list index eda4e4e209..b0a3a44391 100644 --- a/sysdeps/unix/sysv/linux/ia64/syscalls.list +++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list @@ -5,7 +5,6 @@ umount2 - umount 2 __umount2 umount2 getpriority - getpriority i:ii __getpriority getpriority # semaphore and shm system calls -shmat - shmat i:ipi __shmat shmat shmctl - shmctl i:iip __shmctl shmctl shmdt - shmdt i:s __shmdt shmdt shmget - shmget i:iii __shmget shmget diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list index d9afda0548..8b844f2f76 100644 --- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list +++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list @@ -8,6 +8,5 @@ personality EXTRA personality Ei:i __personality personality # Semaphore and shm system calls. msgctl, shmctl, and semctl have C # wrappers (to set __IPC_64). -shmat - shmat i:ipi __shmat shmat shmdt - shmdt i:s __shmdt shmdt shmget - shmget i:iii __shmget shmget diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list index 9cbbd38918..e93c87a5ef 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list +++ b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list @@ -2,6 +2,5 @@ # Semaphore and shm system calls. msgctl, shmctl, and semctl have C # wrappers (to set __IPC_64). -shmat - shmat i:ipi __shmat shmat shmdt - shmdt i:s __shmdt shmdt shmget - shmget i:iii __shmget shmget diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list index 924d182d69..40ed7c5b91 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list +++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list @@ -1,7 +1,6 @@ -# File name Caller Syscall name # args Strong name Weak names +# File name Caller Syscall name # args Strong name Weak names # semaphore and shm system calls -shmat - shmat i:ipi __shmat shmat -shmctl - shmctl i:iip __shmctl shmctl -shmdt - shmdt i:s __shmdt shmdt -shmget - shmget i:iii __shmget shmget +shmctl - shmctl i:iip __shmctl shmctl +shmdt - shmdt i:s __shmdt shmdt +shmget - shmget i:iii __shmget shmget diff --git a/sysdeps/unix/sysv/linux/shmat.c b/sysdeps/unix/sysv/linux/shmat.c index 5afc93c9a9..d1ef323e37 100644 --- a/sysdeps/unix/sysv/linux/shmat.c +++ b/sysdeps/unix/sysv/linux/shmat.c @@ -16,13 +16,10 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <errno.h> -#include <sys/shm.h> +#include <sys/msg.h> #include <ipc_priv.h> - #include <sysdep.h> -#include <unistd.h> -#include <sys/syscall.h> +#include <errno.h> /* Attach the shared memory segment associated with SHMID to the data segment of the calling process. SHMADDR and SHMFLG determine how @@ -31,17 +28,19 @@ void * shmat (int shmid, const void *shmaddr, int shmflg) { +#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS + return (void*) INLINE_SYSCALL_CALL (shmat, shmid, shmaddr, shmflg); +#else INTERNAL_SYSCALL_DECL(err); unsigned long resultvar; void *raddr; - resultvar = INTERNAL_SYSCALL (ipc, err, 5, IPCOP_shmat, - shmid, shmflg, - (long int) &raddr, - (void *) shmaddr); + resultvar = INTERNAL_SYSCALL_CALL (ipc, err, IPCOP_shmat, shmid, shmflg, + &raddr, shmaddr); if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) return (void *) INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (resultvar, err)); return raddr; +#endif } diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list index 573ed0735d..8712bb83ed 100644 --- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list +++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list @@ -6,7 +6,6 @@ pread64 - pread64 Ci:ipii __libc_pread __libc_pread64 __pread64 pread64 __prea preadv64 - preadv Ci:ipii preadv64 preadv pwrite64 - pwrite64 Ci:ipii __libc_pwrite __libc_pwrite64 __pwrite64 pwrite64 __pwrite pwrite pwritev64 - pwritev Ci:ipii pwritev64 pwritev -shmat - shmat i:ipi __shmat shmat shmctl - shmctl i:iip __shmctl shmctl shmdt - shmdt i:s __shmdt shmdt shmget - shmget i:iii __shmget shmget |