Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/inetd RLIMIT_NOFILE stabilized in NetBSD 17 years a...



details:   https://anonhg.NetBSD.org/src/rev/aae5f08572f0
branches:  trunk
changeset: 759725:aae5f08572f0
user:      pooka <pooka%NetBSD.org@localhost>
date:      Wed Dec 15 15:36:15 2010 +0000

description:
RLIMIT_NOFILE stabilized in NetBSD 17 years ago, so it's safe now
to remove the #ifdef's from around code which uses it.

diffstat:

 usr.sbin/inetd/inetd.c |  22 ++--------------------
 1 files changed, 2 insertions(+), 20 deletions(-)

diffs (90 lines):

diff -r 94bb78a0a132 -r aae5f08572f0 usr.sbin/inetd/inetd.c
--- a/usr.sbin/inetd/inetd.c    Wed Dec 15 15:07:54 2010 +0000
+++ b/usr.sbin/inetd/inetd.c    Wed Dec 15 15:36:15 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inetd.c,v 1.117 2010/12/15 13:13:28 pooka Exp $        */
+/*     $NetBSD: inetd.c,v 1.118 2010/12/15 15:36:15 pooka Exp $        */
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
 #if 0
 static char sccsid[] = "@(#)inetd.c    8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.117 2010/12/15 13:13:28 pooka Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.118 2010/12/15 15:36:15 pooka Exp $");
 #endif
 #endif /* not lint */
 
@@ -194,10 +194,6 @@
 #include <sys/resource.h>
 #include <sys/event.h>
 
-#ifndef RLIMIT_NOFILE
-#define RLIMIT_NOFILE  RLIMIT_OFILE
-#endif
-
 #ifndef NO_RPC
 #define RPC
 #endif
@@ -279,9 +275,7 @@
 #define FD_MARGIN      (8)
 rlim_t         rlim_ofile_cur = OPEN_MAX;
 
-#ifdef RLIMIT_NOFILE
 struct rlimit  rlim_ofile;
-#endif
 
 struct kevent  changebuf[64];
 size_t         changes;
@@ -470,7 +464,6 @@
                return (EXIT_FAILURE);
        }
 
-#ifdef RLIMIT_NOFILE
        if (getrlimit(RLIMIT_NOFILE, &rlim_ofile) < 0) {
                syslog(LOG_ERR, "getrlimit: %m");
        } else {
@@ -478,7 +471,6 @@
                if (rlim_ofile_cur == RLIM_INFINITY)    /* ! */
                        rlim_ofile_cur = OPEN_MAX;
        }
-#endif
 
        for (n = 0; n < (int)A_CNT(my_signals); n++) {
                int     signum;
@@ -738,11 +730,9 @@
                }
                dup2(0, 1);
                dup2(0, 2);
-#ifdef RLIMIT_NOFILE
                if (rlim_ofile.rlim_cur != rlim_ofile_cur &&
                    setrlimit(RLIMIT_NOFILE, &rlim_ofile) < 0)
                        syslog(LOG_ERR, "setrlimit: %m");
-#endif
                execv(sep->se_server, sep->se_argv);
                syslog(LOG_ERR, "cannot execute %s: %m", sep->se_server);
        reject:
@@ -1776,10 +1766,7 @@
 static void
 bump_nofile(void)
 {
-#ifdef RLIMIT_NOFILE
-
 #define FD_CHUNK       32
-
        struct rlimit rl;
 
        if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
@@ -1801,11 +1788,6 @@
 
        rlim_ofile_cur = rl.rlim_cur;
        return;
-
-#else
-       syslog(LOG_ERR, "bump_nofile: cannot extend file limit");
-       return;
-#endif
 }
 
 /*



Home | Main Index | Thread Index | Old Index