From: Mathieu Desnoyers Date: Sat, 7 Jan 2012 19:56:55 +0000 (-0500) Subject: runas: use CLONE_VM flag X-Git-Tag: v2.0-pre17~38 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=10d32e930a6b67c3f196ca3bf4f247d444d8c2b6;hp=47fb756380d79f439e0650841048cd2550d48903 runas: use CLONE_VM flag Having to clone the vma each time runas is executed brings a significant slowdown to the "start" operation when done with attached application, and to the file creation needed when an application is attaching to the sessiond. Use CLONE_VM flag to speed this up. Signed-off-by: Mathieu Desnoyers --- diff --git a/librunas/runas.c b/librunas/runas.c index b3fa81469..f612ccc75 100644 --- a/librunas/runas.c +++ b/librunas/runas.c @@ -230,7 +230,7 @@ int run_as(int (*cmd)(void *data), void *data, uid_t uid, gid_t gid) * where the stack grows up (HPPA). */ pid = clone(child_run_as, child_stack + (CHILD_STACK_SIZE / 2), - CLONE_FILES | SIGCHLD, + CLONE_FILES | SIGCHLD | CLONE_VM, &run_as_data, NULL); if (pid < 0) { perror("clone");