Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] support RLIMIT_UMTXP on FreeBSD



Another build-time warning on FreeBSD-12:

nawk -f ./rlimits.awk /usr/include/sys/resource.h /dev/null > rlimits.h
WARNING: unknown limits: mail Src/Builtins/rlimits.h to developers

sys/resource.h defines a macro RLIMIT_UMTXP (=14), and /usr/bin/limits
refers to this as "umtxp". /usr/bin/ulimit (= builtin ulimit of /bin/sh)
uses the description "umtx shared locks" and the option '-o' for it.



diff --git a/Src/Builtins/rlimits.awk b/Src/Builtins/rlimits.awk
index fe2d0e931..e9c576c66 100644
--- a/Src/Builtins/rlimits.awk
+++ b/Src/Builtins/rlimits.awk
@@ -59,6 +59,7 @@ BEGIN {limidx = 0}
 	    if (limnam == "NPTS")    { msg[limnum] = "Npseudoterminals" }
 	    if (limnam == "SWAP")    { msg[limnum] = "Mswapsize" }
 	    if (limnam == "KQUEUES") { msg[limnum] = "Nkqueues" }
+	    if (limnam == "UMTXP")   { msg[limnum] = "Numtxp" }
         }
     }
 }
diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c
index 29f97b41d..6b552f3a9 100644
--- a/Src/Builtins/rlimits.c
+++ b/Src/Builtins/rlimits.c
@@ -413,6 +413,12 @@ printulimit(char *nam, int lim, int hard, int head)
 	    printf("-k: kqueues                         ");
 	break;
 # endif /* HAVE_RLIMIT_KQUEUES */
+# ifdef HAVE_RLIMIT_UMTXP
+    case RLIMIT_UMTXP:
+	if (head)
+	    printf("-o: umtx shared locks               ");
+	break;
+# endif /* HAVE_RLIMIT_UMTXP */
     default:
 	if (head)
 	    printf("-N %2d:                              ", lim);
@@ -894,6 +900,11 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
 		case 'T':
 		    res = RLIMIT_PTHREAD;
 		    break;
+# endif
+# ifdef HAVE_RLIMIT_UMTXP
+		case 'o':
+		    res = RLIMIT_UMTXP;
+		    break;
 # endif
 		default:
 		    /* unrecognised limit */
diff --git a/configure.ac b/configure.ac
index 8a2664ed2..2da134b90 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1880,6 +1880,7 @@ zsh_LIMIT_PRESENT(RLIMIT_POSIXLOCKS)
 zsh_LIMIT_PRESENT(RLIMIT_NPTS)
 zsh_LIMIT_PRESENT(RLIMIT_SWAP)
 zsh_LIMIT_PRESENT(RLIMIT_KQUEUES)
+zsh_LIMIT_PRESENT(RLIMIT_UMTXP)
 
 AH_TEMPLATE([RLIMIT_VMEM_IS_RSS],
 [Define to 1 if RLIMIT_VMEM and RLIMIT_RSS both exist and are equal.])






Messages sorted by: Reverse Date, Date, Thread, Author