-/* $OpenBSD: param.c,v 1.51 2024/08/20 07:48:23 mvs Exp $ */
+/* $OpenBSD: param.c,v 1.52 2024/08/20 13:29:25 mvs Exp $ */
/* $NetBSD: param.c,v 1.16 1996/03/12 03:08:40 mrg Exp $ */
/*
int initialvnodes = NVNODE;
int maxprocess = NPROCESS; /* [a] */
int maxthread = 2 * NPROCESS; /* [a] */
-int maxfiles = 5 * (NPROCESS + MAXUSERS) + 80;
+int maxfiles = 5 * (NPROCESS + MAXUSERS) + 80; /* [a] */
long nmbclust = NMBCLUSTERS;
#ifndef BUFCACHEPERCENT
-/* $OpenBSD: kern_descrip.c,v 1.208 2024/06/22 10:22:29 jsg Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.209 2024/08/20 13:29:25 mvs Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
return (0);
}
if ((u_int)new >= lim_cur(RLIMIT_NOFILE) ||
- (u_int)new >= maxfiles) {
+ (u_int)new >= atomic_load_int(&maxfiles)) {
FRELE(fp, p);
return (EBADF);
}
case F_DUPFD_CLOEXEC:
newmin = (long)SCARG(uap, arg);
if ((u_int)newmin >= lim_cur(RLIMIT_NOFILE) ||
- (u_int)newmin >= maxfiles) {
+ (u_int)newmin >= atomic_load_int(&maxfiles)) {
error = EINVAL;
break;
}
* expanding the ofile array.
*/
restart:
- lim = min((int)lim_cur(RLIMIT_NOFILE), maxfiles);
+ lim = min((int)lim_cur(RLIMIT_NOFILE), atomic_load_int(&maxfiles));
last = min(fdp->fd_nfiles, lim);
if ((i = want) < fdp->fd_freefile)
i = fdp->fd_freefile;
int nfiles;
nfiles = atomic_inc_int_nv(&numfiles);
- if (nfiles > maxfiles) {
+ if (nfiles > atomic_load_int(&maxfiles)) {
atomic_dec_int(&numfiles);
tablefull("file");
return (NULL);
-/* $OpenBSD: kern_resource.c,v 1.87 2024/08/20 07:48:23 mvs Exp $ */
+/* $OpenBSD: kern_resource.c,v 1.88 2024/08/20 13:29:25 mvs Exp $ */
/* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */
/*-
maxlim = maxsmap;
break;
case RLIMIT_NOFILE:
- maxlim = maxfiles;
+ maxlim = atomic_load_int(&maxfiles);
break;
case RLIMIT_NPROC:
maxlim = atomic_load_int(&maxprocess);
-/* $OpenBSD: kern_sysctl.c,v 1.441 2024/08/20 07:48:23 mvs Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.442 2024/08/20 13:29:25 mvs Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
}
case KERN_OSREV:
case KERN_MAXPROC:
+ case KERN_MAXFILES:
case KERN_NFILES:
case KERN_TTYCOUNT:
case KERN_ARGMAX: