Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: sandbox/linux/seccomp/clone.cc

Issue 997009: Compute and pring the time that it takes to execute system calls. This data... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sandbox/linux/seccomp/access.cc ('k') | sandbox/linux/seccomp/debug.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "debug.h" 5 #include "debug.h"
6 #include "sandbox_impl.h" 6 #include "sandbox_impl.h"
7 7
8 namespace playground { 8 namespace playground {
9 9
10 int Sandbox::sandbox_clone(int flags, void* stack, int* pid, int* ctid, 10 int Sandbox::sandbox_clone(int flags, void* stack, int* pid, int* ctid,
11 void* tls, void *wrapper_sp) { 11 void* tls, void *wrapper_sp) {
12 Debug::syscall(__NR_clone, "Executing handler"); 12 long long tm;
13 Debug::syscall(&tm, __NR_clone, "Executing handler");
13 struct { 14 struct {
14 int sysnum; 15 int sysnum;
15 long long cookie; 16 long long cookie;
16 Clone clone_req; 17 Clone clone_req;
17 } __attribute__((packed)) request; 18 } __attribute__((packed)) request;
18 request.sysnum = __NR_clone; 19 request.sysnum = __NR_clone;
19 request.cookie = cookie(); 20 request.cookie = cookie();
20 request.clone_req.flags = flags; 21 request.clone_req.flags = flags;
21 request.clone_req.stack = stack; 22 request.clone_req.stack = stack;
22 request.clone_req.pid = pid; 23 request.clone_req.pid = pid;
(...skipping 13 matching lines...) Expand all
36 #error Unsupported target platform 37 #error Unsupported target platform
37 #endif 38 #endif
38 39
39 long rc; 40 long rc;
40 SysCalls sys; 41 SysCalls sys;
41 if (write(sys, processFdPub(), &request, sizeof(request)) != 42 if (write(sys, processFdPub(), &request, sizeof(request)) !=
42 sizeof(request) || 43 sizeof(request) ||
43 read(sys, threadFdPub(), &rc, sizeof(rc)) != sizeof(rc)) { 44 read(sys, threadFdPub(), &rc, sizeof(rc)) != sizeof(rc)) {
44 die("Failed to forward clone() request [sandbox]"); 45 die("Failed to forward clone() request [sandbox]");
45 } 46 }
47 Debug::elapsed(tm, __NR_clone);
46 return static_cast<int>(rc); 48 return static_cast<int>(rc);
47 } 49 }
48 50
49 bool Sandbox::process_clone(int parentMapsFd, int sandboxFd, int threadFdPub, 51 bool Sandbox::process_clone(int parentMapsFd, int sandboxFd, int threadFdPub,
50 int threadFd, SecureMem::Args* mem) { 52 int threadFd, SecureMem::Args* mem) {
51 // Read request 53 // Read request
52 Clone clone_req; 54 Clone clone_req;
53 SysCalls sys; 55 SysCalls sys;
54 if (read(sys, sandboxFd, &clone_req, sizeof(clone_req)) !=sizeof(clone_req)){ 56 if (read(sys, sandboxFd, &clone_req, sizeof(clone_req)) !=sizeof(clone_req)){
55 die("Failed to read parameters for clone() [process]"); 57 die("Failed to read parameters for clone() [process]");
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 107
106 SecureMem::sendSystemCall(threadFdPub, true, parentMapsFd, mem, 108 SecureMem::sendSystemCall(threadFdPub, true, parentMapsFd, mem,
107 __NR_clone, clone_req.flags, clone_req.stack, 109 __NR_clone, clone_req.flags, clone_req.stack,
108 clone_req.pid, clone_req.ctid, clone_req.tls); 110 clone_req.pid, clone_req.ctid, clone_req.tls);
109 return true; 111 return true;
110 } 112 }
111 } 113 }
112 } 114 }
113 115
114 } // namespace 116 } // namespace
OLDNEW
« no previous file with comments | « sandbox/linux/seccomp/access.cc ('k') | sandbox/linux/seccomp/debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698