Assume <sys/resource.h> exists

It is required by POSIX.1-2001.

Cc: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar 2022-12-02 22:20:55 +01:00 committed by Serge Hallyn
parent cdaa04e460
commit 9d695340b4
4 changed files with 19 additions and 30 deletions

View File

@ -38,7 +38,7 @@ dnl Checks for libraries.
dnl Checks for header files.
AC_CHECK_HEADERS(crypt.h utmp.h \
termio.h sgtty.h sys/ioctl.h paths.h \
sys/capability.h sys/random.h sys/resource.h \
sys/capability.h sys/random.h \
gshadow.h lastlog.h rpc/key_prot.h netdb.h acl/libacl.h \
attr/libattr.h attr/error_context.h)

View File

@ -28,10 +28,8 @@
#include <pwd.h>
#include "getdef.h"
#include "shadowlog.h"
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#define LIMITS
#endif
#ifdef LIMITS
#ifndef LIMITS_FILE
#define LIMITS_FILE "/etc/limits"

View File

@ -15,9 +15,7 @@
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#include "prototypes.h"
@ -28,39 +26,34 @@
*/
void pwd_init (void)
{
#ifdef HAVE_SYS_RESOURCE_H
struct rlimit rlim;
# ifdef RLIMIT_CORE
#ifdef RLIMIT_CORE
rlim.rlim_cur = rlim.rlim_max = 0;
setrlimit (RLIMIT_CORE, &rlim);
# endif
#endif
rlim.rlim_cur = rlim.rlim_max = RLIM_INFINITY;
# ifdef RLIMIT_AS
#ifdef RLIMIT_AS
setrlimit (RLIMIT_AS, &rlim);
# endif
# ifdef RLIMIT_CPU
#endif
#ifdef RLIMIT_CPU
setrlimit (RLIMIT_CPU, &rlim);
# endif
# ifdef RLIMIT_DATA
#endif
#ifdef RLIMIT_DATA
setrlimit (RLIMIT_DATA, &rlim);
# endif
# ifdef RLIMIT_FSIZE
#endif
#ifdef RLIMIT_FSIZE
setrlimit (RLIMIT_FSIZE, &rlim);
# endif
# ifdef RLIMIT_NOFILE
#endif
#ifdef RLIMIT_NOFILE
setrlimit (RLIMIT_NOFILE, &rlim);
# endif
# ifdef RLIMIT_RSS
#endif
#ifdef RLIMIT_RSS
setrlimit (RLIMIT_RSS, &rlim);
# endif
# ifdef RLIMIT_STACK
#endif
#ifdef RLIMIT_STACK
setrlimit (RLIMIT_STACK, &rlim);
# endif
#else /* !HAVE_SYS_RESOURCE_H */
set_filesize_limit (30000);
/* don't know how to set the other limits... */
#endif /* !HAVE_SYS_RESOURCE_H */
#endif
signal (SIGALRM, SIG_IGN);
signal (SIGHUP, SIG_IGN);

View File

@ -11,11 +11,9 @@
#ident "$Id$"
#if HAVE_SYS_RESOURCE_H
# include <sys/time.h> /* for struct timeval on sunos4 */
#include <sys/time.h> /* for struct timeval on sunos4 */
/* XXX - is the above ok or should it be <time.h> on ultrix? */
# include <sys/resource.h>
#endif
#include <sys/resource.h>
#include "prototypes.h"
int set_filesize_limit (int blocks)