Linux-2.6.12-rc2
[linux-flexiantxendom0-natty.git] / arch / um / kernel / syscall_user.c
1 /* 
2  * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3  * Licensed under the GPL
4  */
5
6 #include <stdlib.h>
7 #include <sys/time.h>
8 #include "kern_util.h"
9 #include "syscall_user.h"
10
11 struct {
12         int syscall;
13         int pid;
14         long result;
15         struct timeval start;
16         struct timeval end;
17 } syscall_record[1024];
18
19 int record_syscall_start(int syscall)
20 {
21         int max, index;
22
23         max = sizeof(syscall_record)/sizeof(syscall_record[0]);
24         index = next_syscall_index(max);
25
26         syscall_record[index].syscall = syscall;
27         syscall_record[index].pid = current_pid();
28         syscall_record[index].result = 0xdeadbeef;
29         gettimeofday(&syscall_record[index].start, NULL);
30         return(index);
31 }
32
33 void record_syscall_end(int index, long result)
34 {
35         syscall_record[index].result = result;
36         gettimeofday(&syscall_record[index].end, NULL);
37 }
38
39 /*
40  * Overrides for Emacs so that we follow Linus's tabbing style.
41  * Emacs will notice this stuff at the end of the file and automatically
42  * adjust the settings for this buffer only.  This must remain at the end
43  * of the file.
44  * ---------------------------------------------------------------------------
45  * Local variables:
46  * c-file-style: "linux"
47  * End:
48  */