Pull up following revision(s) (requested by joerg in ticket #572):
sys/kern/uipc_sem.c: revision 1.56 lib/libc/gen/sysconf.c: revision 1.43 PR 54619: Remove semaphore limit introduce as part of GSoC 2016 with _SC_SEM_NSEMS_MAX. Report no limit for getconf(3). The ressource is naturally limited by the backing file descriptor, so no separate limit is necessary. Keep the accounting for debugging as it is part of the sysctl ABI exposed by the kernel.
This commit is contained in:
parent
225f4713de
commit
13e69c1523
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sysconf.c,v 1.41 2016/08/04 06:43:43 christos Exp $ */
|
||||
/* $NetBSD: sysconf.c,v 1.41.16.1 2019/12/18 20:20:17 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)sysconf.c 8.2 (Berkeley) 3/20/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: sysconf.c,v 1.41 2016/08/04 06:43:43 christos Exp $");
|
||||
__RCSID("$NetBSD: sysconf.c,v 1.41.16.1 2019/12/18 20:20:17 martin Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
@ -422,7 +422,7 @@ yesno: if (sysctl(mib, mib_len, &value, &len, NULL, 0) == -1)
|
|||
case _SC_TIMER_MAX:
|
||||
return _POSIX_TIMER_MAX;
|
||||
case _SC_SEM_NSEMS_MAX:
|
||||
return _POSIX_SEM_NSEMS_MAX;
|
||||
return LONG_MAX;
|
||||
case _SC_CPUTIME:
|
||||
return _POSIX_CPUTIME;
|
||||
case _SC_THREAD_CPUTIME:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uipc_sem.c,v 1.55 2019/03/01 03:03:19 christos Exp $ */
|
||||
/* $NetBSD: uipc_sem.c,v 1.55.4.1 2019/12/18 20:20:17 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2011, 2019 The NetBSD Foundation, Inc.
|
||||
|
@ -60,7 +60,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.55 2019/03/01 03:03:19 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.55.4.1 2019/12/18 20:20:17 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -92,7 +92,6 @@ MODULE(MODULE_CLASS_MISC, ksem, NULL);
|
|||
|
||||
#define SEM_MAX_NAMELEN NAME_MAX
|
||||
|
||||
#define SEM_NSEMS_MAX 256
|
||||
#define KS_UNLINKED 0x01
|
||||
|
||||
static kmutex_t ksem_lock __cacheline_aligned;
|
||||
|
@ -468,14 +467,7 @@ ksem_create(lwp_t *l, const char *name, ksem_t **ksret, mode_t mode, u_int val)
|
|||
len = 0;
|
||||
}
|
||||
|
||||
u_int cnt;
|
||||
uid_t uid = kauth_cred_getuid(l->l_cred);
|
||||
if ((cnt = chgsemcnt(uid, 1)) > SEM_NSEMS_MAX) {
|
||||
chgsemcnt(uid, -1);
|
||||
if (kname != NULL)
|
||||
kmem_free(kname, len);
|
||||
return ENOSPC;
|
||||
}
|
||||
chgsemcnt(kauth_cred_getuid(l->l_cred), 1);
|
||||
|
||||
ks = kmem_zalloc(sizeof(ksem_t), KM_SLEEP);
|
||||
mutex_init(&ks->ks_lock, MUTEX_DEFAULT, IPL_NONE);
|
||||
|
|
Loading…
Reference in New Issue