mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-01 05:16:05 +01:00
29490: add RLIMIT_RTTIME
This commit is contained in:
parent
9dc573c260
commit
c31caeb086
4 changed files with 42 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
2011-06-19 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 29490: Src/Builtins/rlimits.awk, Src/Builtins/rlimits.c,
|
||||
Src/Builtins/rlimits.mdd: add RLIMIT_RTTIME.
|
||||
|
||||
2011-06-18 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* Michel Dos Reis: 29482: Completion/Linux/Command/_modutils:
|
||||
|
@ -15006,5 +15011,5 @@
|
|||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.5372 $
|
||||
* $Revision: 1.5373 $
|
||||
*****************************************************
|
||||
|
|
|
@ -53,6 +53,7 @@ BEGIN {limidx = 0}
|
|||
if (limnam == "MSGQUEUE") { msg[limnum] = "Nmsgqueue" }
|
||||
if (limnam == "NICE") { msg[limnum] = "Nnice" }
|
||||
if (limnam == "RTPRIO") { msg[limnum] = "Nrt_priority" }
|
||||
if (limnam == "RTTIME") { msg[limnum] = "Urt_time" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,6 +100,7 @@ END {
|
|||
if(limtype == "M") { limtype = "MEMORY" }
|
||||
if(limtype == "N") { limtype = "NUMBER" }
|
||||
if(limtype == "T") { limtype = "TIME" }
|
||||
if(limtype == "U") { limtype = "MICROSECONDS" }
|
||||
}
|
||||
printf("\tZLIMTYPE_%s,\n", limtype)
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ enum {
|
|||
ZLIMTYPE_MEMORY,
|
||||
ZLIMTYPE_NUMBER,
|
||||
ZLIMTYPE_TIME,
|
||||
ZLIMTYPE_MICROSECONDS,
|
||||
ZLIMTYPE_UNKNOWN
|
||||
};
|
||||
|
||||
|
@ -113,10 +114,37 @@ showlimitvalue(int lim, rlim_t val)
|
|||
seconds. */
|
||||
printf("%d:%02d:%02d\n", (int)(val / 3600),
|
||||
(int)(val / 60) % 60, (int)(val % 60));
|
||||
} else if (limtype[lim] == ZLIMTYPE_MICROSECONDS) {
|
||||
/* microseconds */
|
||||
# ifdef RLIM_T_IS_QUAD_T
|
||||
printf("%qdus\n", val);
|
||||
# else
|
||||
# ifdef RLIM_T_IS_LONG_LONG
|
||||
printf("%lldus\n", val);
|
||||
# else
|
||||
# ifdef RLIM_T_IS_UNSIGNED
|
||||
printf("%luus\n", val);
|
||||
# else
|
||||
printf("%ldus\n", val);
|
||||
# endif /* RLIM_T_IS_UNSIGNED */
|
||||
# endif /* RLIM_T_IS_LONG_LONG */
|
||||
# endif /* RLIM_T_IS_QUAD_T */
|
||||
} else if (limtype[lim] == ZLIMTYPE_NUMBER ||
|
||||
limtype[lim] == ZLIMTYPE_UNKNOWN) {
|
||||
/* pure numeric resource */
|
||||
printf("%d\n", (int)val);
|
||||
# ifdef RLIM_T_IS_QUAD_T
|
||||
printf("%qd\n", val);
|
||||
# else
|
||||
# ifdef RLIM_T_IS_LONG_LONG
|
||||
printf("%lld\n", val);
|
||||
# else
|
||||
# ifdef RLIM_T_IS_UNSIGNED
|
||||
printf("%lu\n", val);
|
||||
# else
|
||||
printf("%ld\n", val);
|
||||
# endif /* RLIM_T_IS_UNSIGNED */
|
||||
# endif /* RLIM_T_IS_LONG_LONG */
|
||||
# endif /* RLIM_T_IS_QUAD_T */
|
||||
} else if (val >= 1024L * 1024L)
|
||||
/* memory resource -- display with `K' or `M' modifier */
|
||||
# ifdef RLIM_T_IS_QUAD_T
|
||||
|
@ -125,7 +153,7 @@ showlimitvalue(int lim, rlim_t val)
|
|||
printf("%qdkB\n", val / 1024L);
|
||||
# else
|
||||
# ifdef RLIM_T_IS_LONG_LONG
|
||||
printf("%lldMB\n", val / (1024L * 1024L));
|
||||
printf("%lldMB\n", val / (1024L * 1024L));
|
||||
else
|
||||
printf("%lldkB\n", val / 1024L);
|
||||
# else
|
||||
|
@ -539,7 +567,9 @@ bin_limit(char *nam, char **argv, Options ops, UNUSED(int func))
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
} else if (limtype[lim] == ZLIMTYPE_NUMBER || limtype[lim] == ZLIMTYPE_UNKNOWN) {
|
||||
} else if (limtype[lim] == ZLIMTYPE_NUMBER ||
|
||||
limtype[lim] == ZLIMTYPE_UNKNOWN ||
|
||||
limtype[lim] == ZLIMTYPE_MICROSECONDS) {
|
||||
/* pure numeric resource -- only a straight decimal number is
|
||||
permitted. */
|
||||
char *t = s;
|
||||
|
|
|
@ -14,7 +14,7 @@ rlimits.o rlimits..o: rlimits.h
|
|||
rlimits.h: rlimits.awk @RLIMITS_INC_H@
|
||||
$(AWK) -f $(sdir)/rlimits.awk @RLIMITS_INC_H@ /dev/null > rlimits.h
|
||||
@if grep ZLIMTYPE_UNKNOWN rlimits.h >/dev/null; then \
|
||||
echo >&2 WARNING: unknown limits: mail rlimits.h to developers; \
|
||||
echo >&2 WARNING: unknown limits: mail Src/Builtins/rlimits.h to developers; \
|
||||
else :; fi
|
||||
|
||||
clean-here: clean.rlimits
|
||||
|
|
Loading…
Reference in a new issue