From f721e0174521168b48ca8a64fc7cdc98e3f7c962 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 12 Feb 2004 17:17:31 +0000 Subject: [PATCH] Log max/cur files using getrlimit --- configure.in | 1 + src/yaz-proxy-main.cpp | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index c6265bc..93852c2 100644 --- a/configure.in +++ b/configure.in @@ -10,6 +10,7 @@ AM_PROG_LIBTOOL YAZ_INIT(threads,2.0.10) +AC_CHECK_FUNCS(setrlimit getrlimit) dnl dnl ----- libXSLT AC_SUBST(XSLT_LIBS) diff --git a/src/yaz-proxy-main.cpp b/src/yaz-proxy-main.cpp index 03c0f61..8c7c32e 100644 --- a/src/yaz-proxy-main.cpp +++ b/src/yaz-proxy-main.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-proxy-main.cpp,v 1.32 2004-02-10 15:02:19 adam Exp $ + * $Id: yaz-proxy-main.cpp,v 1.33 2004-02-12 17:17:31 adam Exp $ */ #include @@ -11,6 +11,11 @@ #include #include +#if HAVE_GETRLIMIT +#include +#include +#endif + #include #include @@ -182,7 +187,6 @@ static void child_run(Yaz_SocketManager *m, int run) chown(log_file, pw->pw_uid, pw->pw_gid); xfree(log_file); } - if (setuid(pw->pw_uid) < 0) { yaz_log(LOG_FATAL|LOG_ERRNO, "setuid"); @@ -190,6 +194,12 @@ static void child_run(Yaz_SocketManager *m, int run) } xfree(uid); } +#if HAVE_GETRLIMIT + struct rlimit limit_data; + getrlimit(RLIMIT_NOFILE, &limit_data); + yaz_log(LOG_LOG, "0 get limit NOFILE cur=%d max=%d", + limit_data.rlim_cur, limit_data.rlim_max); +#endif while (m->processEvent() > 0) ; -- 1.7.10.4