-/* $OpenBSD: init_main.c,v 1.20 1996/11/06 01:29:46 deraadt Exp $ */
+/* $OpenBSD: init_main.c,v 1.21 1997/03/27 05:35:28 millert Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
#include <sys/param.h>
#include <sys/filedesc.h>
+#include <sys/file.h>
#include <sys/errno.h>
#include <sys/exec.h>
#include <sys/kernel.h>
extern void nfs_init __P((void));
#endif
+#ifndef MIN
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
+
char copyright[] =
"Copyright (c) 1982, 1986, 1989, 1991, 1993\n\tThe Regents of the University of California. All rights reserved.\n\n";
limit0.pl_rlimit[i].rlim_cur =
limit0.pl_rlimit[i].rlim_max = RLIM_INFINITY;
limit0.pl_rlimit[RLIMIT_NOFILE].rlim_cur = NOFILE;
+ limit0.pl_rlimit[RLIMIT_NOFILE].rlim_max = MIN(NOFILE_MAX,
+ (maxfiles - NOFILE > NOFILE) ? maxfiles - NOFILE : NOFILE);
limit0.pl_rlimit[RLIMIT_NPROC].rlim_cur = MAXUPRC;
i = ptoa(cnt.v_free_count);
limit0.pl_rlimit[RLIMIT_RSS].rlim_max = i;
-/* $OpenBSD: param.h,v 1.11 1996/10/25 11:14:45 deraadt Exp $ */
+/* $OpenBSD: param.h,v 1.12 1997/03/27 05:35:25 millert Exp $ */
/* $NetBSD: param.h,v 1.23 1996/03/17 01:02:29 thorpej Exp $ */
/*-
#define MAXUPRC CHILD_MAX /* max simultaneous processes */
#define NCARGS ARG_MAX /* max bytes for an exec function */
#define NGROUPS NGROUPS_MAX /* max number groups */
-#define NOFILE OPEN_MAX /* max open files per process */
+#define NOFILE OPEN_MAX /* max open files per process (soft) */
+#define NOFILE_MAX 1024 /* max open files per process (hard) */
#define NOGROUP 65535 /* marker for empty group set member */
#define MAXHOSTNAMELEN 256 /* max hostname size */