diff options
| author | Paul Buetow <pbuetow@mimecast.com> | 2018-03-02 12:03:40 +0000 |
|---|---|---|
| committer | Paul Buetow <pbuetow@mimecast.com> | 2018-03-02 12:03:40 +0000 |
| commit | 0fecc645618380829406002fddc80b34be56c5f2 (patch) | |
| tree | c761c63b50cb00991db1097864d3c360dd64702a /ioreplay/src/utils/utils.h | |
| parent | 56f8cdff9aaa9bf00c5dc9441a7569374f2cbafb (diff) | |
Increase rlimits before dropping root
Diffstat (limited to 'ioreplay/src/utils/utils.h')
| -rw-r--r-- | ioreplay/src/utils/utils.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ioreplay/src/utils/utils.h b/ioreplay/src/utils/utils.h index cfe4dbc..3e86865 100644 --- a/ioreplay/src/utils/utils.h +++ b/ioreplay/src/utils/utils.h @@ -120,11 +120,15 @@ void chreplace(char *str, char replace, char with); void strunquote(char *str); /** - * @brief Drop root privileges + * @brief Set rlimits and drop root privileges + * + * This function firsts sets the user resource limits to SET_RLIMIT_NOFILE and + * SET_RLIMIT_NPROC and then attempts to drop the root user to the specified + * one. * * @param user The user to switch to */ -void drop_root(const char *user); +void set_limits_drop_root(const char *user); /** * @brief Retrieve current 1 min Linux load average @@ -162,4 +166,9 @@ bool is_number(char *str); */ void start_pthread(pthread_t *thread, void*(*cb)(void*), void *data); +/** + * @brief Testing various of the utilities + */ +void utils_test(void); + #endif // UTILS_H |
