Source-Changes-HG archive

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

[src/trunk]: src PR 54619: Remove semaphore limit introduce as part of GSoC 2...



details:   https://anonhg.NetBSD.org/src/rev/d603b9cdd369
branches:  trunk
changeset: 847249:d603b9cdd369
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sun Dec 15 20:25:25 2019 +0000

description:
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.

diffstat:

 lib/libc/gen/sysconf.c |   6 +++---
 sys/kern/uipc_sem.c    |  14 +++-----------
 2 files changed, 6 insertions(+), 14 deletions(-)

diffs (69 lines):

diff -r 61558bc36efa -r d603b9cdd369 lib/libc/gen/sysconf.c
--- a/lib/libc/gen/sysconf.c    Sun Dec 15 19:24:11 2019 +0000
+++ b/lib/libc/gen/sysconf.c    Sun Dec 15 20:25:25 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysconf.c,v 1.42 2019/10/16 20:43:18 maya Exp $        */
+/*     $NetBSD: sysconf.c,v 1.43 2019/12/15 20:25:25 joerg 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.42 2019/10/16 20:43:18 maya Exp $");
+__RCSID("$NetBSD: sysconf.c,v 1.43 2019/12/15 20:25:25 joerg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -424,7 +424,7 @@
        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:
diff -r 61558bc36efa -r d603b9cdd369 sys/kern/uipc_sem.c
--- a/sys/kern/uipc_sem.c       Sun Dec 15 19:24:11 2019 +0000
+++ b/sys/kern/uipc_sem.c       Sun Dec 15 20:25:25 2019 +0000
@@ -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.56 2019/12/15 20:25:25 joerg 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.56 2019/12/15 20:25:25 joerg Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -92,7 +92,6 @@
 
 #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 @@
                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);



Home | Main Index | Thread Index | Old Index