summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-01-03 12:11:09 -0500
committerNick Mathewson <nickm@torproject.org>2011-01-03 12:11:09 -0500
commit1e295666d9f4116ac8b69788fed34bbde7fc725d (patch)
tree011667495d904d1edccee075fb6cb6fc512d4383
parent8708ffa655820df9db587228a6a60a9d1ccbf039 (diff)
downloadtor-1e295666d9f4116ac8b69788fed34bbde7fc725d.tar.gz
tor-1e295666d9f4116ac8b69788fed34bbde7fc725d.zip
Tweak GETINFO process/* code: no need to print an int as anything other than %d
-rw-r--r--changes/getinfo_process3
-rw-r--r--src/or/control.c8
2 files changed, 8 insertions, 3 deletions
diff --git a/changes/getinfo_process b/changes/getinfo_process
new file mode 100644
index 0000000000..c6eb6c0af4
--- /dev/null
+++ b/changes/getinfo_process
@@ -0,0 +1,3 @@
+ o Minor features
+ - Implement some GETINFO controller fields to provide information about
+ the Tor process's pid, euid, username, and resource limits.
diff --git a/src/or/control.c b/src/or/control.c
index e4ab387d79..58f4135c82 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1359,13 +1359,13 @@ getinfo_helper_misc(control_connection_t *conn, const char *question,
myPid = getpid();
#endif
- tor_asprintf(answer, U64_FORMAT, U64_PRINTF_ARG(myPid));
+ tor_asprintf(answer, "%d", myPid);
} else if (!strcmp(question, "process/uid")) {
#ifdef MS_WINDOWS
*answer = tor_strdup("-1");
#else
int myUid = geteuid();
- tor_asprintf(answer, U64_FORMAT, U64_PRINTF_ARG(myUid));
+ tor_asprintf(answer, "%d", myUid);
#endif
} else if (!strcmp(question, "process/user")) {
#ifdef MS_WINDOWS
@@ -1383,12 +1383,14 @@ getinfo_helper_misc(control_connection_t *conn, const char *question,
} else if (!strcmp(question, "process/descriptor-limit")) {
/** platform specifc limits are from the set_max_file_descriptors function
* of src/common/compat.c */
+ /* XXXX023 This is duplicated code from compat.c; it should turn into a
+ * function. */
#ifdef HAVE_GETRLIMIT
struct rlimit descriptorLimit;
if (getrlimit(RLIMIT_NOFILE, &descriptorLimit) == 0) {
tor_asprintf(answer, U64_FORMAT,
- U64_PRINTF_ARG(descriptorLimit.rlim_max));
+ U64_PRINTF_ARG(descriptorLimit.rlim_max));
} else {
*answer = tor_strdup("-1");
}