* sysdeps/unix/sysv/linux/setrlimit.c (__setrlimit): Don't modify
	the rlimits structure passed in.

1999-11-19  Andreas Jaeger  <aj@suse.de>

	* include/sys/resource.h (__setrlimit): Add prototype.

1999-11-19  Ulrich Drepper  <drepper@cygnus.com>
This commit is contained in:
Ulrich Drepper 1999-11-20 05:08:30 +00:00
parent 228589d285
commit 602b6b0fe4
3 changed files with 23 additions and 7 deletions

View File

@ -1,3 +1,12 @@
1999-11-19 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/setrlimit.c (__setrlimit): Don't modify
the rlimits structure passed in.
1999-11-19 Andreas Jaeger <aj@suse.de>
* include/sys/resource.h (__setrlimit): Add prototype.
1999-11-19 Ulrich Drepper <drepper@cygnus.com>
* elf/dl-load.c (_dl_init_paths): Allocate correct number of

View File

@ -3,6 +3,9 @@
/* Now define the internal interfaces. */
extern int __getrlimit (enum __rlimit_resource __resource,
struct rlimit *__rlimits) __THROW;
extern int __getrusage (enum __rusage_who __who, struct rusage *__usage) __THROW;
struct rlimit *__rlimits);
extern int __getrusage (enum __rusage_who __who, struct rusage *__usage);
extern int __setrlimit (enum __rlimit_resource __resource,
const struct rlimit *__rlimits);
#endif

View File

@ -41,6 +41,10 @@ __setrlimit (resource, rlimits)
enum __rlimit_resource resource;
const struct rlimit *rlimits;
{
#ifndef __ASSUME_NEW_GETRLIMIT_SYSCALL
struct rlimit rlimits_small;
#endif
#ifdef __NR_ugetrlimit
if (! no_new_getrlimit)
{
@ -62,13 +66,13 @@ __setrlimit (resource, rlimits)
#ifndef __ASSUME_NEW_GETRLIMIT_SYSCALL
/* We might have to correct the limits values. Since the old values
were signed the new values are too large. */
rlimits->rlim_cur = MIN ((unsigned long int) rlimits->rlim_cur,
RLIM_INFINITY >> 2);
rlimits->rlim_max = MIN ((unsigned long int) rlimits->rlim_max,
RLIM_INFINITY >> 2);
rlimits_small.rlim_cur = MIN ((unsigned long int) rlimits->rlim_cur,
RLIM_INFINITY >> 2);
rlimits_small.rlim_max = MIN ((unsigned long int) rlimits->rlim_max,
RLIM_INFINITY >> 2);
/* Fall back on the old system call. */
return INLINE_SYSCALL (setrlimit, 2, resource, rlimits);
return INLINE_SYSCALL (setrlimit, 2, resource, &rlimits_small);
#endif
}
weak_alias (__setrlimit, setrlimit)