do_fork(): RLIMIT_NPROC check
1. mcexec sets RLIMIT_NPROC to the number of mcexec threads. 2. do_fork() gets the current number of threads by calling rusage function. 3. do_fork() returns -EAGAIN when the limit is exceeded.
This commit is contained in:
@ -147,6 +147,12 @@ rusage_num_threads_dec()
|
||||
{
|
||||
__sync_sub_and_fetch(&monitor->rusage_num_threads, 1);
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
rusage_num_threads_get()
|
||||
{
|
||||
return monitor->rusage_num_threads;
|
||||
}
|
||||
#else
|
||||
static inline void
|
||||
rusage_total_memory_add(unsigned long size)
|
||||
@ -192,6 +198,12 @@ static inline void
|
||||
rusage_num_threads_dec()
|
||||
{
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
rusage_num_threads_get()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif // ENABLE_RUSAGE
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user