aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-08-03 10:50:18 -0400
committerNick Mathewson <nickm@torproject.org>2010-08-03 10:50:18 -0400
commit51377ae1bbc0ab73a0d688f5c808c90d806dd63c (patch)
tree8db533a54370af0843379064f6fc2e1c8b70ddf3 /src/common
parent3556d2708562bed27a0d3872466e5c832d42f2d8 (diff)
parent4aa56cbd2da93a7f77f53ee691604008e005839d (diff)
downloadtor-51377ae1bbc0ab73a0d688f5c808c90d806dd63c.tar
tor-51377ae1bbc0ab73a0d688f5c808c90d806dd63c.tar.gz
Merge commit 'sebastian/mlockall'
Diffstat (limited to 'src/common')
-rw-r--r--src/common/compat.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index ebe8c03e3..e9101a8d7 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -2297,30 +2297,18 @@ tor_set_max_memlock(void)
*/
struct rlimit limit;
- int ret;
-
- /* Do we want to report current limits first? This is not really needed. */
- ret = getrlimit(RLIMIT_MEMLOCK, &limit);
- if (ret == -1) {
- log_warn(LD_GENERAL, "Could not get RLIMIT_MEMLOCK: %s", strerror(errno));
- return -1;
- }
/* RLIM_INFINITY is -1 on some platforms. */
limit.rlim_cur = RLIM_INFINITY;
limit.rlim_max = RLIM_INFINITY;
- ret = setrlimit(RLIMIT_MEMLOCK, &limit);
- if (ret == -1) {
+ if (setrlimit(RLIMIT_MEMLOCK, &limit) == -1) {
if (errno == EPERM) {
log_warn(LD_GENERAL, "You appear to lack permissions to change memory "
"limits. Are you root?");
- log_warn(LD_GENERAL, "Unable to raise RLIMIT_MEMLOCK: %s",
- strerror(errno));
- } else {
- log_warn(LD_GENERAL, "Could not raise RLIMIT_MEMLOCK: %s",
- strerror(errno));
}
+ log_warn(LD_GENERAL, "Unable to raise RLIMIT_MEMLOCK: %s",
+ strerror(errno));
return -1;
}
@@ -2353,12 +2341,11 @@ tor_mlockall(void)
#if defined(HAVE_MLOCKALL) && HAVE_DECL_MLOCKALL && defined(RLIMIT_MEMLOCK)
if (tor_set_max_memlock() == 0) {
- /* Perhaps we only want to log this if we're in a verbose mode? */
- log_notice(LD_GENERAL, "RLIMIT_MEMLOCK is now set to RLIM_INFINITY.");
+ log_debug(LD_GENERAL, "RLIMIT_MEMLOCK is now set to RLIM_INFINITY.");
}
if (mlockall(MCL_CURRENT|MCL_FUTURE) == 0) {
- log_notice(LD_GENERAL, "Insecure OS paging is effectively disabled.");
+ log_info(LD_GENERAL, "Insecure OS paging is effectively disabled.");
return 0;
} else {
if (errno == ENOSYS) {