363 int string2resource(const char *s) { |
371 int string2resource(const char *s) { |
364 if (!strcmp(s, "CORE")) return RLIMIT_CORE; |
372 if (!strcmp(s, "CORE")) return RLIMIT_CORE; |
365 if (!strcmp(s, "CPU")) return RLIMIT_CPU; |
373 if (!strcmp(s, "CPU")) return RLIMIT_CPU; |
366 if (!strcmp(s, "DATA")) return RLIMIT_DATA; |
374 if (!strcmp(s, "DATA")) return RLIMIT_DATA; |
367 if (!strcmp(s, "FSIZE")) return RLIMIT_FSIZE; |
375 if (!strcmp(s, "FSIZE")) return RLIMIT_FSIZE; |
|
376 if (!strcmp(s, "NOFILE")) return RLIMIT_NOFILE; |
|
377 if (!strcmp(s, "STACK")) return RLIMIT_STACK; |
|
378 #if !(defined(sun) || defined(__sun)) |
368 if (!strcmp(s, "MEMLOCK")) return RLIMIT_MEMLOCK; |
379 if (!strcmp(s, "MEMLOCK")) return RLIMIT_MEMLOCK; |
369 if (!strcmp(s, "NOFILE")) return RLIMIT_NOFILE; |
|
370 if (!strcmp(s, "NPROC")) return RLIMIT_NPROC; |
380 if (!strcmp(s, "NPROC")) return RLIMIT_NPROC; |
371 if (!strcmp(s, "RSS")) return RLIMIT_RSS; |
381 if (!strcmp(s, "RSS")) return RLIMIT_RSS; |
372 if (!strcmp(s, "STACK")) return RLIMIT_STACK; |
382 #endif |
373 return -1; |
383 return -1; |
374 } |
384 } |
375 |
385 |
376 int lc_setrlimit(lua_State *L) { |
386 int lc_setrlimit(lua_State *L) { |
377 int arguments = lua_gettop(L); |
387 int arguments = lua_gettop(L); |