about summary refs log tree commit diff
path: root/Src/Builtins/rlimits.awk
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-10-18 10:24:52 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-10-18 10:24:52 +0000
commit9411b0e51a065a19e0c17caaf2d61298377a47c7 (patch)
tree25cfc121fae319e8407c630e9c29f9949bacdde8 /Src/Builtins/rlimits.awk
parent910dc80a58cf3bcf91c51a72f117a46a7c9f77cf (diff)
downloadzsh-9411b0e51a065a19e0c17caaf2d61298377a47c7.tar.gz
zsh-9411b0e51a065a19e0c17caaf2d61298377a47c7.tar.xz
zsh-9411b0e51a065a19e0c17caaf2d61298377a47c7.zip
zsh-workers/8320
Diffstat (limited to 'Src/Builtins/rlimits.awk')
-rw-r--r--Src/Builtins/rlimits.awk62
1 files changed, 37 insertions, 25 deletions
diff --git a/Src/Builtins/rlimits.awk b/Src/Builtins/rlimits.awk
index 56bd574e0..9d412eded 100644
--- a/Src/Builtins/rlimits.awk
+++ b/Src/Builtins/rlimits.awk
@@ -6,7 +6,7 @@
 #
 BEGIN {limidx = 0}
 
-/^[\t ]*(#[\t ]*define[\t _]*RLIMIT_[A-Z_]*[\t ]*[0-9][0-9]*|RLIMIT_[A-Z]*,[\t ]*)/ {
+/^[\t ]*(#[\t ]*define[\t _]*RLIMIT_[A-Z_]*[\t ]*[0-9][0-9]*|RLIMIT_[A-Z_]*,[\t ]*)/ {
     limindex = index($0, "RLIMIT_")
     limtail = substr($0, limindex, 80)
     split(limtail, tmp)
@@ -22,22 +22,22 @@ BEGIN {limidx = 0}
     if (lim[limnum] == "") {
 	lim[limnum] = limnam
 	if (limnum ~ /^[0-9]*$/) {
-	    if (limnam == "MEMLOCK") { msg[limnum] = "memorylocked" }
-	    if (limnam == "RSS")     { msg[limnum] = "resident" }
-	    if (limnam == "VMEM")    { msg[limnum] = "vmemorysize" }
-	    if (limnam == "NOFILE")  { msg[limnum] = "descriptors" }
-	    if (limnam == "OFILE")   { msg[limnum] = "descriptors" }
-	    if (limnam == "CORE")    { msg[limnum] = "coredumpsize" }
-	    if (limnam == "STACK")   { msg[limnum] = "stacksize" }
-	    if (limnam == "DATA")    { msg[limnum] = "datasize" }
-	    if (limnam == "FSIZE")   { msg[limnum] = "filesize" }
-	    if (limnam == "CPU")     { msg[limnum] = "cputime" }
-	    if (limnam == "NPROC")   { msg[limnum] = "maxproc" }
-	    if (limnam == "AS")      { msg[limnum] = "addressspace" }
-	    if (limnam == "TCACHE")  { msg[limnum] = "cachedthreads" }
-	    if (limnam == "AIO_OPS") { msg[limnum] = "aiooperations" }
-	    if (limnam == "AIO_MEM") { msg[limnum] = "aiomemorylocked" }
-	    if (limnam == "SBSIZE")  { msg[limnum] = "sbsize" }
+	    if (limnam == "AIO_MEM") { msg[limnum] = "Maiomemorylocked" }
+	    if (limnam == "AIO_OPS") { msg[limnum] = "Naiooperations" }
+	    if (limnam == "AS")      { msg[limnum] = "Maddressspace" }
+	    if (limnam == "CORE")    { msg[limnum] = "Mcoredumpsize" }
+	    if (limnam == "CPU")     { msg[limnum] = "Tcputime" }
+	    if (limnam == "DATA")    { msg[limnum] = "Mdatasize" }
+	    if (limnam == "FSIZE")   { msg[limnum] = "Mfilesize" }
+	    if (limnam == "MEMLOCK") { msg[limnum] = "Mmemorylocked" }
+	    if (limnam == "NOFILE")  { msg[limnum] = "Ndescriptors" }
+	    if (limnam == "NPROC")   { msg[limnum] = "Nmaxproc" }
+	    if (limnam == "OFILE")   { msg[limnum] = "Ndescriptors" }
+	    if (limnam == "RSS")     { msg[limnum] = "Mresident" }
+	    if (limnam == "SBSIZE")  { msg[limnum] = "Msktbuffersize" }
+	    if (limnam == "STACK")   { msg[limnum] = "Mstacksize" }
+	    if (limnam == "TCACHE")  { msg[limnum] = "Ncachedthreads" }
+	    if (limnam == "VMEM")    { msg[limnum] = "Mvmemorysize" }
         }
     }
 }
@@ -55,21 +55,33 @@ BEGIN {limidx = 0}
 END {
     if (limrev["MEMLOCK"] != "") {
         irss = limrev["RSS"]
-        msg[irss] = "memoryuse"
+        msg[irss] = "Mmemoryuse"
     }
     ps = "%s"
 
     printf("%s\n%s\n\n", "/** rlimits.h                              **/", "/** architecture-customized limits for zsh **/")
-    printf("#define ZSH_NLIMITS %d\n\nstatic char *recs[ZSH_NLIMITS+1] = {\n", 0 + nlimits)
+    printf("#define ZSH_NLIMITS %d\n\nstatic char const *recs[ZSH_NLIMITS] = {\n", 0 + nlimits)
 
     for (i = 0; i < 0 + nlimits; i++)
-	if (msg[i] == "") {
-            badlimit++
+	if (msg[i] == "")
             printf("\t%c%s%c,\n", 34, lim[i], 34)
-	} else
-	    printf("\t%c%s%c,\n", 34, msg[i], 34)
-    print "\tNULL"
+	else
+	    printf("\t%c%s%c,\n", 34, substr(msg[i], 2, 30), 34)
     print "};"
     print ""
-    exit(badlimit)
+    print "static int limtype[ZSH_NLIMITS] = {"
+    for (i = 0; i < 0 + nlimits; i++) {
+	if (msg[i] == "")
+	    limtype = "UNKNOWN"
+	else {
+	    limtype = substr(msg[i], 1, 1)
+	    if(limtype == "M") { limtype = "MEMORY" }
+	    if(limtype == "N") { limtype = "NUMBER" }
+	    if(limtype == "T") { limtype = "TIME" }
+	}
+	printf("\tZLIMTYPE_%s,\n", limtype)
+    }
+    print "};"
+
+    exit(0)
 }