glibc/sysdeps/unix/sysv/linux
Adhemerval Zanella 045c13d185 Consolidate Linux setrlimit and getrlimit implementation
This patch consolidates all Linux setrlimit and getrlimit on the default
sysdeps/unix/sysv/linux/{set,get}rlimit{64}.c.  It contains two exceptions:

  1. mips32 and mips64n32 which requires a versioned symbol for GLIBC 2.19
     and higher due a broken RLIM64_INFINITY constant.
  2. sparc32 does not define a compat symbol for getrlimit64 for old 2GB
     limit. I am not sure if it is required, but a RLIM_INFINITY fix [1]
     change its definition without adding a compat symbol.  This patch does
     not aim to address this possible issue, it follow current symbol
     export.

The default implementation uses prlimit64 for 64 bit rlim_t ({set,get}rlimit64)
and if it fails with ENOSYS it fall back to {get,set}rlimit syscall.  This
code path is only used on kernel older than 2.6.36 (basically now only x86)
and I avoid to user __ASSUME_PRLIMTI64 to simplify the implementation.  Once
x86 moves to be on par with other architectures regarding minimum kernel
supported we can get rid of using old syscalls and default path.

A new type size define is added, __RLIM_T_MATCHES_RLIM64_T, where is set as
default for 64 bits ports.  This allows the default implementation to avoid
{get,set}rlimit building and alias {get,set}rlimit64 to {get,set}rlimit.

Checked on x86_64, i386, armhf, aarch64, and powerpc64le.  I also did a
sanity build plus check-abi on all other supported architectures.

[1] Commit 9c96ff2385

	Adhemerval Zanella  <adhemerval.zanella@linaro.org>
	Yury Norov  <ynorov@caviumnetworks.com>

	* bits/typesizes.h (__RLIM_T_MATCHES_RLIM64_T): define.
	* sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
	(__RLIM_T_MATCHES_RLIM64_T): Likewise.
	* sysdeps/unix/sysv/linux/generic/bits/typesizes.h
	(__RLIM_T_MATCHES_RLIM64_T): Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/typesizes.h [__s390x__]
	(__RLIM_T_MATCHES_RLIM64_T): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
	[__arch64__ || __sparcv9] (__RLIM_T_MATCHES_RLIM64_T): Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/typesizes.h [__86_64__]
	(__RLIM_T_MATCHES_RLIM64_T): Likewise.
	* sysdeps/unix/sysv/linux/arm/Makefile [$(subdir) = resource]
	(sysdep_routines): Remove oldgetrlimit64.
	* sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) = resource]
	(sysdep_routines): Likewise.
	* sysdeps/unix/sysv/linux/m68k/Makefile [$(subdir) = resource]
	(sysdep_routines): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile
	[$(subdir) = resource] (sysdep_routines): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/Makefile
	[$(subdir) = resource] (sysdep_routines): Likewise.
	* sysdeps/unix/sysv/linux/arm/getrlimit64.c: Remove file.
	* sysdeps/unix/sysv/linux/arm/oldgetrlimit64.c: Likewise.
	* sysdeps/unix/sysv/linux/hppa/getrlimit64.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/getrlimit64.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/oldgetrlimit64.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/getrlimit64.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/oldgetrlimit64.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/getrlimit64.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/oldgetrlimit64.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/getrlimit64.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/oldgetrlimit64.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/getrlimit64.c: Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/getrlimit64.c: Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/setrlimit64.c: Likewise.
	* sysdeps/sysv/linux/generic/wordsize-32/syscalls.list: Remove
	setrlimit and getrlimit.
	* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/i386/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/getrlimit.c: New file.
	* sysdeps/unix/sysv/linux/sparc/getrlimit64.c: Likewise.
	* sysdeps/unix/sysv/linux/setrlimit.c: Likewise.
	* sysdeps/unix/sysv/linux/getrlimit64.c (__getrlimit64): Handle
	__RLIM_T_MATCHES_RLIM64_T and add alias if defined.
	(__old_getrlimit64): Add compatibility symbol.
	* sysdeps/unix/sysv/linux/setrlimit64.c (__setrlimit): Likewise.
2016-11-17 15:54:22 -02:00
..
aarch64 Add canonicalize, canonicalizef, canonicalizel. 2016-10-26 23:14:31 +00:00
alpha Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
arm Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
bits Installed-header hygiene (BZ#20366): stack_t. 2016-09-23 08:43:56 -04:00
generic Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
hppa Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
i386 Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
ia64 Add canonicalize, canonicalizef, canonicalizel. 2016-10-26 23:14:31 +00:00
include/sys Installed header hygiene (BZ#20366): Test of installed headers. 2016-09-23 08:43:56 -04:00
m68k Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
microblaze Add canonicalize, canonicalizef, canonicalizel. 2016-10-26 23:14:31 +00:00
mips Consolidate Linux truncate implementations 2016-11-09 17:46:17 -02:00
net Installed-header hygiene (BZ#20366): time.h types. 2016-09-23 08:43:56 -04:00
netash
netatalk
netax25
neteconet
netinet Installed-header hygiene (BZ#20366): obsolete BSD u_* types. 2016-09-23 08:43:56 -04:00
netipx Installed-header hygiene (BZ#20366): obsolete BSD u_* types. 2016-09-23 08:43:56 -04:00
netiucv Add missing iucv related defines. 2016-04-27 09:08:29 +02:00
netpacket
netrom
netrose Installed-header hygiene (BZ#20366): Simple self-contained fixes. 2016-09-23 08:43:55 -04:00
nfs
nios2 Update nios2 localplt.data. 2016-11-08 23:41:05 +00:00
powerpc Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
s390 Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
scsi
sh Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
sparc Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
sys Installed-header hygiene (BZ#20366): time.h types. 2016-09-23 08:43:56 -04:00
tile Make tilegx32 install libraries in lib32 directories. 2016-11-14 23:34:54 +00:00
wordsize-64 Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
x86 Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
x86_64 Consolidate lseek/lseek64/llseek implementations 2016-11-08 16:04:33 -02:00
Implies
Makefile Consolidate lseek/lseek64/llseek implementations 2016-11-08 16:04:33 -02:00
Versions
_G_config.h
_exit.c
a.out.h
accept.c
accept4.c
access.c New internal function __access_noerrno 2016-11-16 15:53:58 -02:00
adjtime.c
aio_misc.h
aio_sigqueue.c
arch-fork.h
bind.c
check_native.c network: recvmsg and sendmsg standard compliance (BZ#16919) 2016-05-25 17:39:01 -03:00
check_pf.c network: recvmsg and sendmsg standard compliance (BZ#16919) 2016-05-25 17:39:01 -03:00
clock.c
clock_getcpuclockid.c
clock_getres.c
clock_gettime.c
clock_nanosleep.c
clock_settime.c
cmsg_nxthdr.c
configure
configure.ac
connect.c
createthread.c
default-sched.h
device-nrs.h
dl-brk.c
dl-execstack.c
dl-fxstatat64.c
dl-getcwd.c
dl-librecon.h
dl-openat64.c Assume __NR_openat is always defined 2016-03-23 23:35:08 +01:00
dl-opendir.c
dl-origin.c
dl-osinfo.h
dl-sbrk.c
dl-sysdep.c
dl-sysdep.h
dl-vdso.c
dl-vdso.h
dl-writev.h
epoll_pwait.c
errqueue.h
eventfd_read.c
eventfd_write.c
exit-thread.h
faccessat.c
fallocate.c Consolidate fallocate{64} implementations 2016-10-07 14:16:36 -03:00
fallocate64.c Consolidate fallocate{64} implementations 2016-10-07 14:16:36 -03:00
fatal-prepare.h
fchmodat.c
fcntl.c
fd_to_filename.h
fexecve.c
fips-private.h
fpathconf.c
fstatfs64.c
fstatvfs.c
fstatvfs64.c
ftime.c
ftruncate.c Consolidate Linux ftruncate implementations 2016-11-09 17:46:11 -02:00
ftruncate64.c Consolidate Linux ftruncate implementations 2016-11-09 17:46:11 -02:00
futex-internal.h
futimens.c Assume __NR_utimensat is always defined 2016-03-23 23:35:08 +01:00
futimes.c
futimesat.c
fxstat.c * sysdeps/unix/sysv/linux/fxstat.c: Remove useless cast. 2016-10-24 14:36:53 -07:00
fxstat64.c Define __ASSUME_ST_INO_64_BIT on all platforms. 2016-11-07 13:26:27 -08:00
fxstatat.c
fxstatat64.c
gai_sigqueue.c
getclktck.c
getcwd.c
getdents.c Remove __ASSUME_GETDENTS64_SYSCALL. 2016-03-22 00:32:20 +00:00
getdents64.c
getdirentries.c
getdirentries64.c
getdtsz.c
gethostid.c
getipv4sourcefilter.c
getloadavg.c
getlogin.c
getlogin_r.c
getpagesize.c
getpeername.c
getpid.c
getpriority.c
getpt.c
getrlimit.c Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
getrlimit64.c Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
getsockname.c
getsockopt.c
getsourcefilter.c
getsysstats.c
gettimeofday.c
grantpt.c
if_index.c
ifaddrs.c network: recvmsg and sendmsg standard compliance (BZ#16919) 2016-05-25 17:39:01 -03:00
ifreq.c
internal_statvfs.c
internal_statvfs64.c
ipc_priv.h
kernel-features.h Remove __ASSUME_FUTEX_LOCK_PI 2016-06-13 08:36:34 -03:00
kernel-posix-cpu-timers.h
kernel-posix-timers.h
kernel_sigaction.h
kernel_stat.h
kernel_termios.h
ldd-rewrite.sed
lddlibc4.c
ldsodefs.h Fix build with HAVE_AUX_VECTOR 2016-04-11 10:27:25 +02:00
libc_fatal.c
linux_fsinfo.h
listen.c
local-setxid.h
lowlevellock-futex.h
lseek.c Consolidate lseek/lseek64/llseek implementations 2016-11-08 16:04:33 -02:00
lseek64.c Consolidate lseek/lseek64/llseek implementations 2016-11-08 16:04:33 -02:00
lutimes.c Assume __NR_utimensat is always defined 2016-03-23 23:35:08 +01:00
lxstat.c * sysdeps/unix/sysv/linux/fxstat.c: Remove useless cast. 2016-10-24 14:36:53 -07:00
lxstat64.c Define __ASSUME_ST_INO_64_BIT on all platforms. 2016-11-07 13:26:27 -08:00
malloc-sysdep.h
mmap64.c
mq_close.c
mq_getattr.c
mq_notify.c
mq_open.c
mq_receive.c
mq_send.c
mq_unlink.c
msgctl.c
msgget.c
msgrcv.c
msgsnd.c
netlink_assert_response.c
netlinkaccess.h
nice.c
not-cancel.h
nptl-signals.h Refactor Linux raise implementation (BZ#15368) 2016-07-13 17:08:51 +01:00
nscd_setup_thread.c
ntp_gettime.c
ntp_gettimex.c
open64.c
openat.c
openat64.c
opendir.c
opensock.c
pathconf.c
pathconf.h
paths.h
personality.c
posix_fadvise.c Consolidate posix_fadvise implementations 2016-10-07 14:16:41 -03:00
posix_fadvise64.c Consolidate posix_fadvise implementations 2016-10-07 14:16:41 -03:00
posix_fallocate.c Consolidate posix_fallocate{64} implementations 2016-10-07 14:16:41 -03:00
posix_fallocate64.c Consolidate posix_fallocate{64} implementations 2016-10-07 14:16:41 -03:00
posix_madvise.c
ppoll.c
pread.c Fix Linux sh4 pread/pwrite argument passing 2016-10-24 15:26:42 -02:00
pread64.c Fix Linux sh4 pread/pwrite argument passing 2016-10-24 15:26:42 -02:00
preadv.c Remove __ASSUME_OFF_DIFF_OFF64 definition 2016-07-08 14:28:08 -03:00
preadv64.c Remove __ASSUME_OFF_DIFF_OFF64 definition 2016-07-08 14:28:08 -03:00
prlimit.c
prof-freq.c
profil.c
pselect.c
pt-raise.c Refactor Linux raise implementation (BZ#15368) 2016-07-13 17:08:51 +01:00
pthread-pids.h
pthread_getaffinity.c
pthread_getcpuclockid.c
pthread_getname.c
pthread_kill.c
pthread_setaffinity.c
pthread_setname.c
pthread_sigmask.c
pthread_sigqueue.c
ptrace.c
ptsname.c
pwrite.c Fix Linux sh4 pread/pwrite argument passing 2016-10-24 15:26:42 -02:00
pwrite64.c Fix Linux sh4 pread/pwrite argument passing 2016-10-24 15:26:42 -02:00
pwritev.c Remove __ASSUME_OFF_DIFF_OFF64 definition 2016-07-08 14:28:08 -03:00
pwritev64.c Remove __ASSUME_OFF_DIFF_OFF64 definition 2016-07-08 14:28:08 -03:00
raise.c Refactor Linux raise implementation (BZ#15368) 2016-07-13 17:08:51 +01:00
readahead.c
readdir64.c
readdir64_r.c
readonly-area.c
reboot.c
recv.c
recvfrom.c
recvmmsg.c Revert {send,sendm,recv,recvm}msg conformance changes 2016-06-10 11:58:16 -03:00
recvmsg.c Revert {send,sendm,recv,recvm}msg conformance changes 2016-06-10 11:58:16 -03:00
remove.c
sa_len.c
safe-fatal.h
sched_getaffinity.c
sched_getcpu.c
sched_setaffinity.c
segfault.c
semctl.c
semget.c
semop.c
semtimedop.c
send.c
sendmmsg.c Revert {send,sendm,recv,recvm}msg conformance changes 2016-06-10 11:58:16 -03:00
sendmsg.c Revert {send,sendm,recv,recvm}msg conformance changes 2016-06-10 11:58:16 -03:00
sendto.c
setegid.c
seteuid.c
setgid.c
setgroups.c
sethostid.c
setipv4sourcefilter.c
setregid.c
setresgid.c
setresuid.c
setreuid.c
setrlimit.c Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
setrlimit64.c Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
setsockopt.c
setsourcefilter.c
setuid.c
shlib-versions
shm-directory.c
shmat.c
shmctl.c
shmdt.c
shmget.c
shutdown.c
sigaction.c
siglist.h
signal.c
signalfd.c
sigpending.c
sigprocmask.c
sigqueue.c
sigreturn.c
sigset-cvt-mask.h
sigstack.c
sigsuspend.c
sigtimedwait.c
sigwait.c
sigwaitinfo.c
sizes.h
socket.c
socketcall.h
socketpair.c
spawni.c posix: Fix open file action for posix_spawn on Linux 2016-09-28 14:07:35 -07:00
speed.c
statfs64.c
statvfs.c
statvfs64.c
sync_file_range.c Consolidate Linux sync_file_range implementations 2016-10-11 16:21:12 -03:00
syscalls.list Consolidate Linux setrlimit and getrlimit implementation 2016-11-17 15:54:22 -02:00
sysconf.c
sysctl.c
sysctl.mk
sysdep-vdso.h
sysdep.h Fix Linux sh4 pread/pwrite argument passing 2016-10-24 15:26:42 -02:00
syslog.c
system.c
tcdrain.c
tcflow.c
tcflush.c
tcgetattr.c
tcgetpgrp.c
tcsendbrk.c
tcsetattr.c
tcsetpgrp.c
termio.h
time.c
timer_create.c
timer_delete.c
timer_getoverr.c
timer_gettime.c
timer_routines.c
timer_settime.c
times.c Expand comments in Linux times() implementation. 2016-06-19 15:47:00 -04:00
timespec_get.c
truncate.c Consolidate Linux truncate implementations 2016-11-09 17:46:17 -02:00
truncate64.c Consolidate Linux truncate implementations 2016-11-09 17:46:17 -02:00
tst-affinity-pid.c
tst-affinity.c
tst-align-clone.c
tst-clone.c
tst-clone2.c Fix clone (CLONE_VM) pid/tid reset (BZ#19957) 2016-04-29 18:19:30 -03:00
tst-fallocate-common.c Fix Linux fallocate tests for EOPNOTSUPP 2016-10-18 08:56:22 -02:00
tst-fallocate.c Consolidate fallocate{64} implementations 2016-10-07 14:16:36 -03:00
tst-fallocate64.c Consolidate fallocate{64} implementations 2016-10-07 14:16:36 -03:00
tst-fanotify.c
tst-getpid1.c
tst-personality.c
tst-quota.c Base <sys/quota.h> on Linux kernel headers [BZ #20525] 2016-09-01 15:53:13 +02:00
tst-setgetname.c Fix -Wformat-length warning in tst-setgetname.c 2016-10-24 09:43:54 -07:00
tst-skeleton-affinity.c
tst-skeleton-thread-affinity.c
tst-sync_file_range.c Consolidate Linux sync_file_range implementations 2016-10-11 16:21:12 -03:00
tst-thread-affinity-pthread.c
tst-thread-affinity-pthread2.c
tst-thread-affinity-sched.c
ttyname.c
ttyname_r.c
ualarm.c
umount.S
umount2.S
unlockpt.c
updwtmp.c
ustat.c
utimensat.c Assume __NR_utimensat is always defined 2016-03-23 23:35:08 +01:00
utimes.c
utmp_file.c
vfork.c
wait.c Remove union wait [BZ #19613] 2016-04-14 08:54:57 +02:00
wait3.c
waitid.c
waitpid.c
xmknod.c
xmknodat.c
xstat.c * sysdeps/unix/sysv/linux/fxstat.c: Remove useless cast. 2016-10-24 14:36:53 -07:00
xstat64.c Define __ASSUME_ST_INO_64_BIT on all platforms. 2016-11-07 13:26:27 -08:00
xstatconv.c Define __ASSUME_ST_INO_64_BIT on all platforms. 2016-11-07 13:26:27 -08:00
xstatconv.h