/* Set the global per context limit of a resource (memory, file handle). This utility can do it either for the current context or a selected one. It uses the same options as ulimit, when possible */ #include #include #include #include #include "vutil.h" #include #include "old_syscall.p" static void set_ctxlim (int res, long lim, const char *msg) { if (call_set_ctxlimit(res,lim)==-1){ fprintf (stderr,"Error setting limit \"%s\": %s\n" ,msg,strerror(errno)); exit (-1); } } static void usage() { fprintf (stderr,"setctxlimit version %s\n",VERSION); fprintf (stderr ,"setctxlimit [ --ctx context ] limits\n" "\n" "-n Max. opened files\n"); } int main (int argc, char *argv[]) { int ret = -1; if (argc < 2){ usage(); }else{ ret = 0; for (int i=1; i