├── README ├── stopwatch ├── Makefile ├── README ├── corei7.ods └── stopwatch.c └── yfkm2 ├── KNOWN_BUGS ├── README ├── patch ├── 2.6.42.7-1.fc15 │ └── linux-2.6-yfkm2.patch └── 3.3.0-0.rc5.git3.1.yfkm2.fc17 │ └── linux-3.3-yfkm2.patch ├── source ├── 2.6.42.7-1.fc15 │ ├── Makefile │ ├── arch │ │ └── x86 │ │ │ ├── include │ │ │ └── asm │ │ │ │ ├── unistd_32.h │ │ │ │ └── unistd_64.h │ │ │ └── kernel │ │ │ └── syscall_table_32.S │ ├── include │ │ └── asm-generic │ │ │ └── unistd.h │ └── samples │ │ └── yfkm2 │ │ ├── Makefile │ │ ├── userspace │ │ ├── Makefile │ │ ├── monitor.c │ │ └── notifyme.c │ │ ├── yfkm2.c │ │ └── yfkm2.c.orig └── 3.3.0-0.rc5.git3.1.fc17 │ ├── Makefile │ ├── arch │ └── x86 │ │ └── syscalls │ │ ├── syscall_32.tbl │ │ └── syscall_64.tbl │ └── samples │ └── yfkm2 │ ├── Makefile │ ├── userspace │ ├── Makefile │ ├── monitor.c │ └── notifyme.c │ └── yfkm2.c └── spec ├── 2.6.42.7-1.fc15 └── kernel.spec └── 3.3.0-0.rc5.git3.1.fc17 └── kernel.spec /README: -------------------------------------------------------------------------------- 1 | Linux Kernel Stuff 2 | -------------------------------------------------------------------------------- /stopwatch/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := stopwatch.o 2 | 3 | all: 4 | make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules 5 | 6 | clean: 7 | make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean 8 | -------------------------------------------------------------------------------- /stopwatch/README: -------------------------------------------------------------------------------- 1 | This is an attempt of comparing the execution time of small portions of code inside Kernel space. 2 | -------------------------------------------------------------------------------- /stopwatch/corei7.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/petersenna/Kernel/b5c6f6561472a1c413c76db6f0fabb03c1b7aad1/stopwatch/corei7.ods -------------------------------------------------------------------------------- /stopwatch/stopwatch.c: -------------------------------------------------------------------------------- 1 | /* 2 | * stopwatch - Kernel module for measuring execution time of specific code 3 | * inside Kernel space 4 | * Licensed under GPL v2. 5 | * Peter Senna Tschudin 6 | * 7 | */ 8 | 9 | #include 10 | #include /* kmalloc(), free()*/ 11 | #include /* timespec */ 12 | #include /* data structures used in this example */ 13 | 14 | MODULE_LICENSE("GPL"); 15 | 16 | #define VIDEO_MAX_FRAME 32 17 | 18 | void stopwatch (char msg[32], int repeats, int (*function)( struct timespec *ts_start, struct timespec *ts_end)); 19 | static int stopwatch_init(void); 20 | int ORIGINAL (struct timespec *ts_start, struct timespec *ts_end); 21 | int PROPOSED (struct timespec *ts_start, struct timespec *ts_end); 22 | static void stopwatch_exit(void); 23 | 24 | /* 25 | * stopwatch 26 | * @msg - Message that is printed before first result 27 | * @repeat count - How many times the test will be repeated? 28 | * @pointer to function - Pointer to a function that returns int and receives \ 29 | * two struct timespec as parameters 30 | * 31 | */ 32 | void stopwatch (char msg[32], int repeats, int (*function)( struct timespec *, struct timespec *)) 33 | { 34 | struct timespec begin, end, diff; 35 | int i = 0; 36 | 37 | printk ("%s", msg); 38 | 39 | for (i = repeats; i > 0; i--){ 40 | 41 | if (function( &begin, &end ) != 0) 42 | printk("Error"); 43 | 44 | diff = timespec_sub(end, begin); 45 | 46 | if (diff.tv_sec > 0) 47 | printk ("%lu\"%lu,", diff.tv_sec, diff.tv_nsec ); 48 | else 49 | printk ("%lu,", diff.tv_nsec ); 50 | } 51 | } 52 | 53 | 54 | /* 55 | * stopwatch_init 56 | * returns 0 on success (always) 57 | */ 58 | static int stopwatch_init(void) 59 | { 60 | printk ("Starting stopwatch...\n"); 61 | 62 | stopwatch("Proposed_code:, ", 512, &PROPOSED); 63 | stopwatch("\nOriginal_code:, ", 512, &ORIGINAL); 64 | 65 | return 0; 66 | } 67 | 68 | /* 69 | * ORIGINAL 70 | * @ts_start - Pointer to struct timespec containing the start time 71 | * @ts_end - Pointer to struct timespec containing the end time 72 | * 73 | * returns 0 on success or 1 on fail 74 | * 75 | */ 76 | int ORIGINAL (struct timespec *ts_start, struct timespec *ts_end) 77 | { 78 | unsigned int i; 79 | 80 | struct vb2_queue *q; 81 | 82 | q = kmalloc(sizeof(struct vb2_queue), __GFP_WAIT | __GFP_IO | __GFP_FS); 83 | 84 | q->num_buffers = VIDEO_MAX_FRAME; 85 | 86 | for (i = 0; i < VIDEO_MAX_FRAME; ++i) 87 | q->bufs[i] = (struct vb2_buffer *) kmalloc(sizeof(struct vb2_buffer), __GFP_WAIT | __GFP_IO | __GFP_FS); 88 | 89 | getnstimeofday (ts_start); /*stopwatch start*/ 90 | 91 | for (i = 0; i < q->num_buffers; ++i) 92 | q->bufs[i]->state = VB2_BUF_STATE_DEQUEUED; 93 | 94 | getnstimeofday (ts_end); /*stopwatch stop*/ 95 | 96 | for (i = 0; i < VIDEO_MAX_FRAME; ++i) 97 | kfree(q->bufs[i]); 98 | 99 | kfree(q); 100 | 101 | /* 102 | * Loop for testing if the result is correct 103 | * 104 | for (i = 0; i < q->num_buffers; ++i) 105 | if (q->bufs[i]->state != VB2_BUF_STATE_DEQUEUED) 106 | return 1; 107 | */ 108 | return 0; 109 | } 110 | 111 | /* 112 | * PROPOSED 113 | * @ts_start - Pointer to struct timespec containing the start time 114 | * @ts_end - Pointer to struct timespec containing the end time 115 | * 116 | * returns 0 on success or 1 on fail 117 | * 118 | */ 119 | int PROPOSED (struct timespec *ts_start, struct timespec *ts_end) 120 | { 121 | unsigned int i; 122 | 123 | struct vb2_queue *q; 124 | struct vb2_buffer *buf_ptr, *buf_ptr_end; 125 | 126 | q = kmalloc(sizeof(struct vb2_queue), __GFP_WAIT | __GFP_IO | __GFP_FS); 127 | 128 | q->num_buffers = VIDEO_MAX_FRAME; 129 | 130 | for (i = 0; i < VIDEO_MAX_FRAME; ++i) 131 | q->bufs[i] = (struct vb2_buffer *) kmalloc(sizeof(struct vb2_buffer), __GFP_WAIT | __GFP_IO | __GFP_FS); 132 | 133 | getnstimeofday (ts_start); /*stopwatch start*/ 134 | 135 | buf_ptr_end = q->bufs[q->num_buffers]; 136 | 137 | for (buf_ptr = q->bufs[0]; buf_ptr < buf_ptr_end; ++buf_ptr) 138 | buf_ptr->state = VB2_BUF_STATE_DEQUEUED; 139 | 140 | getnstimeofday (ts_end); /*stopwatch stop*/ 141 | 142 | for (i = 0; i < VIDEO_MAX_FRAME; ++i) 143 | kfree(q->bufs[i]); 144 | 145 | kfree(q); 146 | 147 | /* 148 | * Loop for testing if the result is correct 149 | * 150 | 151 | for (i = 0; i < q->num_buffers; ++i) 152 | if (q->bufs[i]->state != VB2_BUF_STATE_DEQUEUED) 153 | return 1; 154 | */ 155 | return 0; 156 | 157 | } 158 | 159 | /* 160 | * stopwatch_exit 161 | * 162 | */ 163 | static void stopwatch_exit(void) 164 | { 165 | 166 | printk ("Exiting...\n"); 167 | } 168 | 169 | 170 | module_init(stopwatch_init); 171 | module_exit(stopwatch_exit); 172 | -------------------------------------------------------------------------------- /yfkm2/KNOWN_BUGS: -------------------------------------------------------------------------------- 1 | 1 - The warning above was shown once on 3.3 Kernel under Fedora 17. Not sure about how to fix yet. 2 | 3 | [ 858.634304] 4 | [ 858.634324] =============================== 5 | [ 858.634350] [ INFO: suspicious RCU usage. ] 6 | [ 858.634375] 3.3.0-0.rc5.git3.1.yfkm2.fc17.x86_64 #1 Not tainted 7 | [ 858.634409] ------------------------------- 8 | [ 858.634435] kernel/pid.c:425 find_task_by_pid_ns() needs rcu_read_lock() protection! 9 | [ 858.634478] 10 | [ 858.634479] other info that might help us debug this: 11 | [ 858.634480] 12 | [ 858.634528] 13 | [ 858.634529] rcu_scheduler_active = 1, debug_locks = 0 14 | [ 858.634567] no locks held by monitor/10550. 15 | [ 858.634591] 16 | [ 858.634592] stack backtrace: 17 | [ 858.634620] Pid: 10550, comm: monitor Not tainted 3.3.0-0.rc5.git3.1.yfkm2.fc17.x86_64 #1 18 | [ 858.634666] Call Trace: 19 | [ 858.634688] [] lockdep_rcu_suspicious+0xe5/0x100 20 | [ 858.634727] [] find_task_by_pid_ns+0x81/0xa0 21 | [ 858.634762] [] find_task_by_vpid+0x22/0x30 22 | [ 858.634798] [] yfkm2_is_pid_running+0x15/0x40 23 | [ 858.634835] [] sys_yfkm2_monitor+0x14/0x80 24 | [ 858.634870] [] system_call_fastpath+0x16/0x1b 25 | 26 | -------------------------------------------------------------------------------- /yfkm2/README: -------------------------------------------------------------------------------- 1 | Your First Kernel Mod v2 2 | 3 | Version 1.2 at: http://goo.gl/beP0I 4 | 5 | The problem: Create two syscalls: 6 | - int yfkm2_monitor(pid) - syscall that receives a pid, verify the pid correspond to a running process. If so adds the pid to a Kernel linked list. 7 | - int yfkm2_notifyme(pid, pid) - syscall that receives two pids: monitor and notifyme. If monitor is saved at the linked list, saves notifyme pid on corresponding data node. If the Kernel thread is not running, start it. 8 | 9 | And create a Kernel thread that: 10 | Traverse the linked list looking for "monitor" pids that do not correspond to running processess any more. When found, if there are corresponding "notifyme" pids, kill the process identified by "notifyme" pid. Waits one second before traversing the list again. If the list is empty, exit. 11 | 12 | Instructions at the wiki. 13 | -------------------------------------------------------------------------------- /yfkm2/patch/2.6.42.7-1.fc15/linux-2.6-yfkm2.patch: -------------------------------------------------------------------------------- 1 | diff -uNrp a/arch/x86/include/asm/unistd_32.h b/arch/x86/include/asm/unistd_32.h 2 | --- a/arch/x86/include/asm/unistd_32.h 2012-02-23 18:18:43.465209574 -0200 3 | +++ b/arch/x86/include/asm/unistd_32.h 2012-02-25 17:48:40.534702633 -0200 4 | @@ -354,10 +354,12 @@ 5 | #define __NR_setns 346 6 | #define __NR_process_vm_readv 347 7 | #define __NR_process_vm_writev 348 8 | +#define __NR_sys_yfkm2_monitor 349 9 | +#define __NR_sys_yfkm2_notifyme 350 10 | 11 | #ifdef __KERNEL__ 12 | 13 | -#define NR_syscalls 349 14 | +#define NR_syscalls 351 15 | 16 | #define __ARCH_WANT_IPC_PARSE_VERSION 17 | #define __ARCH_WANT_OLD_READDIR 18 | diff -uNrp a/arch/x86/include/asm/unistd_64.h b/arch/x86/include/asm/unistd_64.h 19 | --- a/arch/x86/include/asm/unistd_64.h 2012-02-23 18:18:43.461209538 -0200 20 | +++ b/arch/x86/include/asm/unistd_64.h 2012-02-25 17:49:03.046919518 -0200 21 | @@ -686,6 +686,10 @@ __SYSCALL(__NR_getcpu, sys_getcpu) 22 | __SYSCALL(__NR_process_vm_readv, sys_process_vm_readv) 23 | #define __NR_process_vm_writev 311 24 | __SYSCALL(__NR_process_vm_writev, sys_process_vm_writev) 25 | +#define __NR_yfkm2_monitor 312 26 | +__SYSCALL(__NR_yfkm2_monitor, sys_yfkm2_monitor) 27 | +#define __NR_yfkm2_notifyme 313 28 | +__SYSCALL(__NR_yfkm2_notifyme, sys_yfkm2_notifyme) 29 | 30 | #ifndef __NO_STUBS 31 | #define __ARCH_WANT_OLD_READDIR 32 | diff -uNrp a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S 33 | --- a/arch/x86/kernel/syscall_table_32.S 2012-02-23 18:18:43.549210319 -0200 34 | +++ b/arch/x86/kernel/syscall_table_32.S 2012-02-25 17:49:26.534145883 -0200 35 | @@ -348,3 +348,5 @@ ENTRY(sys_call_table) 36 | .long sys_setns 37 | .long sys_process_vm_readv 38 | .long sys_process_vm_writev 39 | + .long sys_yfkm2_monitor 40 | + .long sys_yfkm2_notifyme /* 350 */ 41 | diff -uNrp a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h 42 | --- a/include/asm-generic/unistd.h 2012-02-23 18:18:43.647211189 -0200 43 | +++ b/include/asm-generic/unistd.h 2012-02-25 17:49:56.272432677 -0200 44 | @@ -692,8 +692,14 @@ __SC_COMP(__NR_process_vm_readv, sys_pro 45 | __SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \ 46 | compat_sys_process_vm_writev) 47 | 48 | +#define __NR_yfkm2_monitor 272 49 | +__SC_COMP(__NR_yfkm2_monitor, sys_yfkm2_monitor) 50 | +#define __NR_yfkm2_notifyme 273 51 | +__SC_COMP(__NR_yfkm2_notifyme, sys_yfkm2_notifyme) 52 | + 53 | + 54 | #undef __NR_syscalls 55 | -#define __NR_syscalls 272 56 | +#define __NR_syscalls 274 57 | 58 | /* 59 | * All syscalls below here should go away really, 60 | diff -uNrp a/Makefile b/Makefile 61 | --- a/Makefile 2012-02-23 18:18:43.684211518 -0200 62 | +++ b/Makefile 2012-02-24 13:43:48.621122552 -0200 63 | @@ -708,7 +708,7 @@ export mod_strip_cmd 64 | 65 | 66 | ifeq ($(KBUILD_EXTMOD),) 67 | -core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ 68 | +core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ samples/yfkm2/ 69 | 70 | vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ 71 | $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ 72 | diff -uNrp a/samples/yfkm2/Makefile b/samples/yfkm2/Makefile 73 | --- a/samples/yfkm2/Makefile 1969-12-31 21:00:00.000000000 -0300 74 | +++ b/samples/yfkm2/Makefile 2012-02-23 21:27:01.874969155 -0200 75 | @@ -0,0 +1 @@ 76 | +obj-y := yfkm2.o 77 | diff -uNrp a/samples/yfkm2/userspace/monitor.c b/samples/yfkm2/userspace/monitor.c 78 | --- a/samples/yfkm2/userspace/monitor.c 1969-12-31 21:00:00.000000000 -0300 79 | +++ b/samples/yfkm2/userspace/monitor.c 2012-02-28 18:11:44.017543007 -0300 80 | @@ -0,0 +1,28 @@ 81 | +#include 82 | +#include 83 | +#include 84 | + 85 | +#define SYS_yfkm2_monitor __NR_yfkm2_monitor 86 | +#define SYS_yfkm2_notifyme __NR_yfkm2_notifyme 87 | + 88 | +int main (int argc, char *argv[]) 89 | +{ 90 | + 91 | + if (argc < 2) { 92 | + printf("Error. Use %s \n", argv[0]); 93 | + return 1; 94 | + } 95 | + pid_t pid = atoi(argv[1]); 96 | + long ret; 97 | + 98 | + 99 | + ret = syscall(SYS_yfkm2_monitor, pid); 100 | + 101 | + if (ret == 0){ 102 | + printf("Sucess on adding %d!\n", pid); 103 | + return 0; 104 | + } else { 105 | + printf("Failure! Is %s a valid PID?\n", argv[1]); 106 | + return 1; 107 | + } 108 | +} 109 | diff -uNrp a/samples/yfkm2/userspace/notifyme.c b/samples/yfkm2/userspace/notifyme.c 110 | --- a/samples/yfkm2/userspace/notifyme.c 1969-12-31 21:00:00.000000000 -0300 111 | +++ b/samples/yfkm2/userspace/notifyme.c 2012-02-28 18:11:44.017543007 -0300 112 | @@ -0,0 +1,33 @@ 113 | +#include 114 | +#include 115 | +#include 116 | + 117 | +#define SYS_yfkm2_monitor __NR_yfkm2_monitor 118 | +#define SYS_yfkm2_notifyme __NR_yfkm2_notifyme 119 | + 120 | +int main (int argc, char *argv[]) 121 | +{ 122 | + 123 | + if (argc < 2) { 124 | + printf("Error. Use %s \n", argv[0]); 125 | + return 1; 126 | + } 127 | + 128 | + pid_t monitor, notifyme; 129 | + long ret; 130 | + 131 | + monitor = atoi(argv[1]); 132 | + notifyme = getpid(); 133 | + 134 | + ret = syscall(SYS_yfkm2_notifyme, monitor, notifyme); 135 | + 136 | + if (ret == 0){ 137 | + printf("Sucess on adding %d!\n", monitor); 138 | + printf("Finish %d to see what happens to me.\n", monitor); 139 | + while (1) 140 | + sleep (10); 141 | + } else { 142 | + printf("Failure! Is %s a valid PID?\n", argv[1]); 143 | + return 1; 144 | + } 145 | +} 146 | diff -uNrp a/samples/yfkm2/yfkm2.c b/samples/yfkm2/yfkm2.c 147 | --- a/samples/yfkm2/yfkm2.c 1969-12-31 21:00:00.000000000 -0300 148 | +++ b/samples/yfkm2/yfkm2.c 2012-03-23 20:03:18.577439365 -0300 149 | @@ -0,0 +1,215 @@ 150 | +/* 151 | + * yfkm2 - Your first Kernel Modification v2 152 | + * Peter Senna Tschudin 153 | + * 154 | + */ 155 | + 156 | +/* 157 | + * KNOWN BUGS: 158 | + * Does not work when trying to notify more than one process for same monitored 159 | + * PID. 160 | + * 161 | + */ 162 | + 163 | +/* 164 | + * TODO: 165 | + * 166 | + * Split .c in .c + .h 167 | + * 168 | + * Check if Kernel thread started correctly and treat possible errors 169 | + * 170 | + * Check if yfkm2_list->notify != 0 before seting new value 171 | + * 172 | + */ 173 | + 174 | +#include 175 | +#include 176 | +#include 177 | +#include 178 | +#include 179 | + 180 | +#define YFKM2_KT_TIMEOUT (1*HZ) /* 1 second */ 181 | + 182 | +struct yfkm2 { 183 | + pid_t monitor; /* PID to monitor */ 184 | + pid_t notifyme; /* PID to notify */ 185 | + struct list_head list; /* Linked List struct */ 186 | +}; 187 | + 188 | +/* How many Kernel Threads are running? */ 189 | +atomic_t yfkm2_kthread_run_count = ATOMIC_INIT(0); 190 | + 191 | +/* Define and initialize yfkm2_(linked)list */ 192 | +LIST_HEAD(yfkm2_list); 193 | + 194 | +/* Define and initialize yfkm2_(read&write)lock */ 195 | +DEFINE_RWLOCK(yfkm2_lock); 196 | + 197 | +/* 198 | + * yfkm2_is_pid_running(pid_t pid) 199 | + * 200 | + * Check if pid is running 201 | + * 202 | + * return 0 if pid is running 203 | + * return 1 if pid is not running 204 | + */ 205 | +int yfkm2_is_pid_running(pid_t pid) 206 | +{ 207 | + struct task_struct *q; 208 | + 209 | + rcu_read_lock(); 210 | + q = find_task_by_vpid(pid); 211 | + rcu_read_unlock(); 212 | + 213 | + if (q != NULL && q->pid == pid) 214 | + return 0; 215 | + else 216 | + return 1; 217 | +} 218 | + 219 | +/* 220 | + * yfkm2_kill(pid_t pid) 221 | + * 222 | + * Kills pid 223 | + * 224 | + * return 0 if pid was running and send SIGKILL to pid 225 | + * return 1 if pid is not running 226 | + */ 227 | +int yfkm2_kill(pid_t pid) 228 | +{ 229 | + struct task_struct *q; 230 | + int ret; 231 | + 232 | + rcu_read_lock(); 233 | + q = find_task_by_vpid(pid); 234 | + rcu_read_unlock(); 235 | + 236 | + if (q != NULL) { 237 | + force_sig(SIGKILL, q); 238 | + return 0; 239 | + } 240 | + 241 | + return 1; 242 | +} 243 | + 244 | +/* 245 | + * int yfkm2_kthread(void *data) 246 | + * 247 | + * The Kernel Thread 248 | + * 249 | + * Traverse the yfkm2_list looking for yfkm2->notifyme that are not 0. 250 | + * If any found, check if correspondent yfkm2->monitor is still running. If not 251 | + * kill yfkm2->notifyme. After traversing the list, check if the list is empty. 252 | + * If so return 0. If not sleep one second and start again. 253 | + * 254 | + * return 0 if yfkm2_list is empty 255 | + * should never return 1 256 | + */ 257 | +int yfkm2_kthread(void *data) /* data is NEVER used */ 258 | +{ 259 | + struct yfkm2 *yfkm2_tmp, *yfkm2_tmp2; 260 | + bool empty; 261 | + 262 | + while (true) { 263 | + /* Needs write protection due possible item removal from list */ 264 | + write_lock(&yfkm2_lock); /* Write lock */ 265 | + list_for_each_entry_safe(yfkm2_tmp, yfkm2_tmp2, 266 | + &yfkm2_list, list) { 267 | + if (yfkm2_tmp->notifyme != 0) { 268 | + if (yfkm2_is_pid_running(yfkm2_tmp->monitor) != 0) { 269 | + yfkm2_kill(yfkm2_tmp->notifyme); 270 | + list_del(&yfkm2_tmp->list); 271 | + kfree(yfkm2_tmp); 272 | + } 273 | + } 274 | + } 275 | + write_unlock(&yfkm2_lock); /* Write unlock */ 276 | + 277 | + read_lock(&yfkm2_lock); /* Read lock */ 278 | + empty = list_empty(&yfkm2_list); 279 | + read_unlock(&yfkm2_lock); /* Read unlock */ 280 | + 281 | + if (empty) { 282 | + /* The counter is increased at sys_yfkm2_notifyme() 283 | + * Before exit, decrease atomic run counter */ 284 | + atomic_dec(&yfkm2_kthread_run_count); 285 | + return 0; 286 | + } 287 | + 288 | + set_current_state(TASK_INTERRUPTIBLE); 289 | + schedule_timeout(YFKM2_KT_TIMEOUT); 290 | + } 291 | + /* Before exit, decrease atomic run counter */ 292 | + atomic_dec(&yfkm2_kthread_run_count); 293 | + return 1; 294 | +} 295 | + 296 | +/* 297 | + * asmlinkage long sys_yfkm2_monitor(pid_t monitor) 298 | + * 299 | + * The system call that check if monitor correspond to a running pid and stores 300 | + * monitor at yfkm2_list->monitor 301 | + * 302 | + * return 0 if pid is running 303 | + * return 1 if pid is not running 304 | + */ 305 | +asmlinkage long sys_yfkm2_monitor(pid_t monitor) 306 | +{ 307 | + struct yfkm2 *yfkm2_tmp; 308 | + 309 | + if (yfkm2_is_pid_running(monitor) == 0) { 310 | + 311 | + yfkm2_tmp = kmalloc(sizeof(*yfkm2_tmp), GFP_KERNEL); 312 | + yfkm2_tmp->monitor = monitor; 313 | + yfkm2_tmp->notifyme = 0; 314 | + 315 | + write_lock(&yfkm2_lock); 316 | + list_add(&yfkm2_tmp->list, &yfkm2_list); 317 | + write_unlock(&yfkm2_lock); 318 | + 319 | + return 0; 320 | + } 321 | + 322 | + 323 | + return 1; 324 | +} 325 | + 326 | +/* 327 | + * asmlinkage long sys_yfkm2_notifyme(pid_t monitor, pid_t notifyme) 328 | + * 329 | + * The system call that looks for monitor at yfkm2_list->monitor. If found 330 | + * store notifyme at yfkm2_list->notifyme. It also starts the kernel thread 331 | + * if it is not running. 332 | + * 333 | + * return 0 if pid is running 334 | + * return 1 if pid is not running 335 | + */ 336 | +asmlinkage long sys_yfkm2_notifyme(pid_t monitor, pid_t notifyme) 337 | +{ 338 | + struct yfkm2 *yfkm2_tmp; 339 | + bool found_monitored_pid = false; 340 | + 341 | + write_lock(&yfkm2_lock); /* Write lock */ 342 | + list_for_each_entry(yfkm2_tmp, &yfkm2_list, list) { 343 | + if (yfkm2_tmp->monitor == monitor) { 344 | + yfkm2_tmp->notifyme = notifyme; 345 | + 346 | + found_monitored_pid = true; 347 | + 348 | + break; 349 | + } 350 | + } 351 | + write_unlock(&yfkm2_lock); /* Write unlock */ 352 | + 353 | + if (found_monitored_pid) { 354 | + if (atomic_read(&yfkm2_kthread_run_count) < 1) { 355 | + /* The counter is decreased at yfkm2_kthread() 356 | + * Before start, increase atomic run counter */ 357 | + atomic_inc(&yfkm2_kthread_run_count); 358 | + kthread_run(&yfkm2_kthread, NULL, "yfkm2_kthread"); 359 | + } 360 | + 361 | + return 0; 362 | + } else 363 | + return 1; 364 | +} 365 | -------------------------------------------------------------------------------- /yfkm2/patch/3.3.0-0.rc5.git3.1.yfkm2.fc17/linux-3.3-yfkm2.patch: -------------------------------------------------------------------------------- 1 | diff -uNrp a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl 2 | --- a/arch/x86/syscalls/syscall_32.tbl 2012-03-03 22:45:57.172710473 -0300 3 | +++ b/arch/x86/syscalls/syscall_32.tbl 2012-03-03 23:02:46.723612727 -0300 4 | @@ -355,3 +355,5 @@ 5 | 346 i386 setns sys_setns 6 | 347 i386 process_vm_readv sys_process_vm_readv compat_sys_process_vm_readv 7 | 348 i386 process_vm_writev sys_process_vm_writev compat_sys_process_vm_writev 8 | +349 i386 yfkm2_monitor sys_yfkm2_monitor 9 | +350 i386 yfkm2_notifyme sys_yfkm2_notifyme 10 | diff -uNrp a/arch/x86/syscalls/syscall_64.tbl b/arch/x86/syscalls/syscall_64.tbl 11 | --- a/arch/x86/syscalls/syscall_64.tbl 2012-03-03 22:45:57.170710473 -0300 12 | +++ b/arch/x86/syscalls/syscall_64.tbl 2012-03-03 23:01:24.258620456 -0300 13 | @@ -318,3 +318,5 @@ 14 | 309 64 getcpu sys_getcpu 15 | 310 64 process_vm_readv sys_process_vm_readv 16 | 311 64 process_vm_writev sys_process_vm_writev 17 | +312 64 yfkm2_monitor sys_yfkm2_monitor 18 | +313 64 yfkm2_notifyme sys_yfkm2_notifyme 19 | diff -uNrp a/Makefile b/Makefile 20 | --- a/Makefile 2012-03-03 22:45:48.785710291 -0300 21 | +++ b/Makefile 2012-03-03 22:58:36.088602483 -0300 22 | @@ -708,7 +708,7 @@ export mod_strip_cmd 23 | 24 | 25 | ifeq ($(KBUILD_EXTMOD),) 26 | -core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ 27 | +core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ samples/yfkm2/ 28 | 29 | vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ 30 | $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ 31 | diff -uNrp a/samples/yfkm2/Makefile b/samples/yfkm2/Makefile 32 | --- a/samples/yfkm2/Makefile 1969-12-31 21:00:00.000000000 -0300 33 | +++ b/samples/yfkm2/Makefile 2012-03-03 22:57:25.198606089 -0300 34 | @@ -0,0 +1 @@ 35 | +obj-y := yfkm2.o 36 | diff -uNrp a/samples/yfkm2/userspace/Makefile b/samples/yfkm2/userspace/Makefile 37 | --- a/samples/yfkm2/userspace/Makefile 1969-12-31 21:00:00.000000000 -0300 38 | +++ b/samples/yfkm2/userspace/Makefile 2012-03-04 09:30:36.276690097 -0300 39 | @@ -0,0 +1,7 @@ 40 | +all: 41 | + gcc monitor.c -o monitor 42 | + gcc notifyme.c -o notifyme 43 | + 44 | +clean: 45 | + rm monitor 46 | + rm notifyme 47 | diff -uNrp a/samples/yfkm2/userspace/monitor.c b/samples/yfkm2/userspace/monitor.c 48 | --- a/samples/yfkm2/userspace/monitor.c 1969-12-31 21:00:00.000000000 -0300 49 | +++ b/samples/yfkm2/userspace/monitor.c 2012-03-03 22:57:25.212606088 -0300 50 | @@ -0,0 +1,28 @@ 51 | +#include 52 | +#include 53 | +#include 54 | + 55 | +#define SYS_yfkm2_monitor __NR_yfkm2_monitor 56 | +#define SYS_yfkm2_notifyme __NR_yfkm2_notifyme 57 | + 58 | +int main (int argc, char *argv[]) 59 | +{ 60 | + 61 | + if (argc < 2) { 62 | + printf("Error. Use %s \n", argv[0]); 63 | + return 1; 64 | + } 65 | + pid_t pid = atoi(argv[1]); 66 | + long ret; 67 | + 68 | + 69 | + ret = syscall(SYS_yfkm2_monitor, pid); 70 | + 71 | + if (ret == 0){ 72 | + printf("Sucess on adding %d!\n", pid); 73 | + return 0; 74 | + } else { 75 | + printf("Failure! Is %s a valid PID?\n", argv[1]); 76 | + return 1; 77 | + } 78 | +} 79 | Binary files a/samples/yfkm2/userspace/.monitor.c.swp and b/samples/yfkm2/userspace/.monitor.c.swp differ 80 | diff -uNrp a/samples/yfkm2/userspace/notifyme.c b/samples/yfkm2/userspace/notifyme.c 81 | --- a/samples/yfkm2/userspace/notifyme.c 1969-12-31 21:00:00.000000000 -0300 82 | +++ b/samples/yfkm2/userspace/notifyme.c 2012-03-03 22:57:25.210606088 -0300 83 | @@ -0,0 +1,33 @@ 84 | +#include 85 | +#include 86 | +#include 87 | + 88 | +#define SYS_yfkm2_monitor __NR_yfkm2_monitor 89 | +#define SYS_yfkm2_notifyme __NR_yfkm2_notifyme 90 | + 91 | +int main (int argc, char *argv[]) 92 | +{ 93 | + 94 | + if (argc < 2) { 95 | + printf("Error. Use %s \n", argv[0]); 96 | + return 1; 97 | + } 98 | + 99 | + pid_t monitor, notifyme; 100 | + long ret; 101 | + 102 | + monitor = atoi(argv[1]); 103 | + notifyme = getpid(); 104 | + 105 | + ret = syscall(SYS_yfkm2_notifyme, monitor, notifyme); 106 | + 107 | + if (ret == 0){ 108 | + printf("Sucess on adding %d!\n", monitor); 109 | + printf("Finish %d to see what happens to me.\n", monitor); 110 | + while (1) 111 | + sleep (10); 112 | + } else { 113 | + printf("Failure! Is %s a valid PID?\n", argv[1]); 114 | + return 1; 115 | + } 116 | +} 117 | diff -uNrp a/samples/yfkm2/yfkm2.c b/samples/yfkm2/yfkm2.c 118 | --- a/samples/yfkm2/yfkm2.c 1969-12-31 21:00:00.000000000 -0300 119 | +++ b/samples/yfkm2/yfkm2.c 2012-03-23 20:03:18.577439365 -0300 120 | @@ -0,0 +1,215 @@ 121 | +/* 122 | + * yfkm2 - Your first Kernel Modification v2 123 | + * Peter Senna Tschudin 124 | + * 125 | + */ 126 | + 127 | +/* 128 | + * KNOWN BUGS: 129 | + * Does not work when trying to notify more than one process for same monitored 130 | + * PID. 131 | + * 132 | + */ 133 | + 134 | +/* 135 | + * TODO: 136 | + * 137 | + * Split .c in .c + .h 138 | + * 139 | + * Check if Kernel thread started correctly and treat possible errors 140 | + * 141 | + * Check if yfkm2_list->notify != 0 before seting new value 142 | + * 143 | + */ 144 | + 145 | +#include 146 | +#include 147 | +#include 148 | +#include 149 | +#include 150 | + 151 | +#define YFKM2_KT_TIMEOUT (1*HZ) /* 1 second */ 152 | + 153 | +struct yfkm2 { 154 | + pid_t monitor; /* PID to monitor */ 155 | + pid_t notifyme; /* PID to notify */ 156 | + struct list_head list; /* Linked List struct */ 157 | +}; 158 | + 159 | +/* How many Kernel Threads are running? */ 160 | +atomic_t yfkm2_kthread_run_count = ATOMIC_INIT(0); 161 | + 162 | +/* Define and initialize yfkm2_(linked)list */ 163 | +LIST_HEAD(yfkm2_list); 164 | + 165 | +/* Define and initialize yfkm2_(read&write)lock */ 166 | +DEFINE_RWLOCK(yfkm2_lock); 167 | + 168 | +/* 169 | + * yfkm2_is_pid_running(pid_t pid) 170 | + * 171 | + * Check if pid is running 172 | + * 173 | + * return 0 if pid is running 174 | + * return 1 if pid is not running 175 | + */ 176 | +int yfkm2_is_pid_running(pid_t pid) 177 | +{ 178 | + struct task_struct *q; 179 | + 180 | + rcu_read_lock(); 181 | + q = find_task_by_vpid(pid); 182 | + rcu_read_unlock(); 183 | + 184 | + if (q != NULL && q->pid == pid) 185 | + return 0; 186 | + else 187 | + return 1; 188 | +} 189 | + 190 | +/* 191 | + * yfkm2_kill(pid_t pid) 192 | + * 193 | + * Kills pid 194 | + * 195 | + * return 0 if pid was running and send SIGKILL to pid 196 | + * return 1 if pid is not running 197 | + */ 198 | +int yfkm2_kill(pid_t pid) 199 | +{ 200 | + struct task_struct *q; 201 | + int ret; 202 | + 203 | + rcu_read_lock(); 204 | + q = find_task_by_vpid(pid); 205 | + rcu_read_unlock(); 206 | + 207 | + if (q != NULL) { 208 | + force_sig(SIGKILL, q); 209 | + return 0; 210 | + } 211 | + 212 | + return 1; 213 | +} 214 | + 215 | +/* 216 | + * int yfkm2_kthread(void *data) 217 | + * 218 | + * The Kernel Thread 219 | + * 220 | + * Traverse the yfkm2_list looking for yfkm2->notifyme that are not 0. 221 | + * If any found, check if correspondent yfkm2->monitor is still running. If not 222 | + * kill yfkm2->notifyme. After traversing the list, check if the list is empty. 223 | + * If so return 0. If not sleep one second and start again. 224 | + * 225 | + * return 0 if yfkm2_list is empty 226 | + * should never return 1 227 | + */ 228 | +int yfkm2_kthread(void *data) /* data is NEVER used */ 229 | +{ 230 | + struct yfkm2 *yfkm2_tmp, *yfkm2_tmp2; 231 | + bool empty; 232 | + 233 | + while (true) { 234 | + /* Needs write protection due possible item removal from list */ 235 | + write_lock(&yfkm2_lock); /* Write lock */ 236 | + list_for_each_entry_safe(yfkm2_tmp, yfkm2_tmp2, 237 | + &yfkm2_list, list) { 238 | + if (yfkm2_tmp->notifyme != 0) { 239 | + if (yfkm2_is_pid_running(yfkm2_tmp->monitor) != 0) { 240 | + yfkm2_kill(yfkm2_tmp->notifyme); 241 | + list_del(&yfkm2_tmp->list); 242 | + kfree(yfkm2_tmp); 243 | + } 244 | + } 245 | + } 246 | + write_unlock(&yfkm2_lock); /* Write unlock */ 247 | + 248 | + read_lock(&yfkm2_lock); /* Read lock */ 249 | + empty = list_empty(&yfkm2_list); 250 | + read_unlock(&yfkm2_lock); /* Read unlock */ 251 | + 252 | + if (empty) { 253 | + /* The counter is increased at sys_yfkm2_notifyme() 254 | + * Before exit, decrease atomic run counter */ 255 | + atomic_dec(&yfkm2_kthread_run_count); 256 | + return 0; 257 | + } 258 | + 259 | + set_current_state(TASK_INTERRUPTIBLE); 260 | + schedule_timeout(YFKM2_KT_TIMEOUT); 261 | + } 262 | + /* Before exit, decrease atomic run counter */ 263 | + atomic_dec(&yfkm2_kthread_run_count); 264 | + return 1; 265 | +} 266 | + 267 | +/* 268 | + * asmlinkage long sys_yfkm2_monitor(pid_t monitor) 269 | + * 270 | + * The system call that check if monitor correspond to a running pid and stores 271 | + * monitor at yfkm2_list->monitor 272 | + * 273 | + * return 0 if pid is running 274 | + * return 1 if pid is not running 275 | + */ 276 | +asmlinkage long sys_yfkm2_monitor(pid_t monitor) 277 | +{ 278 | + struct yfkm2 *yfkm2_tmp; 279 | + 280 | + if (yfkm2_is_pid_running(monitor) == 0) { 281 | + 282 | + yfkm2_tmp = kmalloc(sizeof(*yfkm2_tmp), GFP_KERNEL); 283 | + yfkm2_tmp->monitor = monitor; 284 | + yfkm2_tmp->notifyme = 0; 285 | + 286 | + write_lock(&yfkm2_lock); 287 | + list_add(&yfkm2_tmp->list, &yfkm2_list); 288 | + write_unlock(&yfkm2_lock); 289 | + 290 | + return 0; 291 | + } 292 | + 293 | + 294 | + return 1; 295 | +} 296 | + 297 | +/* 298 | + * asmlinkage long sys_yfkm2_notifyme(pid_t monitor, pid_t notifyme) 299 | + * 300 | + * The system call that looks for monitor at yfkm2_list->monitor. If found 301 | + * store notifyme at yfkm2_list->notifyme. It also starts the kernel thread 302 | + * if it is not running. 303 | + * 304 | + * return 0 if pid is running 305 | + * return 1 if pid is not running 306 | + */ 307 | +asmlinkage long sys_yfkm2_notifyme(pid_t monitor, pid_t notifyme) 308 | +{ 309 | + struct yfkm2 *yfkm2_tmp; 310 | + bool found_monitored_pid = false; 311 | + 312 | + write_lock(&yfkm2_lock); /* Write lock */ 313 | + list_for_each_entry(yfkm2_tmp, &yfkm2_list, list) { 314 | + if (yfkm2_tmp->monitor == monitor) { 315 | + yfkm2_tmp->notifyme = notifyme; 316 | + 317 | + found_monitored_pid = true; 318 | + 319 | + break; 320 | + } 321 | + } 322 | + write_unlock(&yfkm2_lock); /* Write unlock */ 323 | + 324 | + if (found_monitored_pid) { 325 | + if (atomic_read(&yfkm2_kthread_run_count) < 1) { 326 | + /* The counter is decreased at yfkm2_kthread() 327 | + * Before start, increase atomic run counter */ 328 | + atomic_inc(&yfkm2_kthread_run_count); 329 | + kthread_run(&yfkm2_kthread, NULL, "yfkm2_kthread"); 330 | + } 331 | + 332 | + return 0; 333 | + } else 334 | + return 1; 335 | +} 336 | -------------------------------------------------------------------------------- /yfkm2/source/2.6.42.7-1.fc15/Makefile: -------------------------------------------------------------------------------- 1 | VERSION = 3 2 | PATCHLEVEL = 2 3 | SUBLEVEL = 3 4 | EXTRAVERSION = 5 | NAME = Saber-toothed Squirrel 6 | 7 | # *DOCUMENTATION* 8 | # To see a list of typical targets execute "make help" 9 | # More info can be located in ./README 10 | # Comments in this file are targeted only to the developer, do not 11 | # expect to learn how to build the kernel reading this file. 12 | 13 | # Do not: 14 | # o use make's built-in rules and variables 15 | # (this increases performance and avoids hard-to-debug behaviour); 16 | # o print "Entering directory ..."; 17 | MAKEFLAGS += -rR --no-print-directory 18 | 19 | # Avoid funny character set dependencies 20 | unexport LC_ALL 21 | LC_COLLATE=C 22 | LC_NUMERIC=C 23 | export LC_COLLATE LC_NUMERIC 24 | 25 | # We are using a recursive build, so we need to do a little thinking 26 | # to get the ordering right. 27 | # 28 | # Most importantly: sub-Makefiles should only ever modify files in 29 | # their own directory. If in some directory we have a dependency on 30 | # a file in another dir (which doesn't happen often, but it's often 31 | # unavoidable when linking the built-in.o targets which finally 32 | # turn into vmlinux), we will call a sub make in that other dir, and 33 | # after that we are sure that everything which is in that other dir 34 | # is now up to date. 35 | # 36 | # The only cases where we need to modify files which have global 37 | # effects are thus separated out and done before the recursive 38 | # descending is started. They are now explicitly listed as the 39 | # prepare rule. 40 | 41 | # To put more focus on warnings, be less verbose as default 42 | # Use 'make V=1' to see the full commands 43 | 44 | ifeq ("$(origin V)", "command line") 45 | KBUILD_VERBOSE = $(V) 46 | endif 47 | ifndef KBUILD_VERBOSE 48 | KBUILD_VERBOSE = 0 49 | endif 50 | 51 | # Call a source code checker (by default, "sparse") as part of the 52 | # C compilation. 53 | # 54 | # Use 'make C=1' to enable checking of only re-compiled files. 55 | # Use 'make C=2' to enable checking of *all* source files, regardless 56 | # of whether they are re-compiled or not. 57 | # 58 | # See the file "Documentation/sparse.txt" for more details, including 59 | # where to get the "sparse" utility. 60 | 61 | ifeq ("$(origin C)", "command line") 62 | KBUILD_CHECKSRC = $(C) 63 | endif 64 | ifndef KBUILD_CHECKSRC 65 | KBUILD_CHECKSRC = 0 66 | endif 67 | 68 | # Use make M=dir to specify directory of external module to build 69 | # Old syntax make ... SUBDIRS=$PWD is still supported 70 | # Setting the environment variable KBUILD_EXTMOD take precedence 71 | ifdef SUBDIRS 72 | KBUILD_EXTMOD ?= $(SUBDIRS) 73 | endif 74 | 75 | ifeq ("$(origin M)", "command line") 76 | KBUILD_EXTMOD := $(M) 77 | endif 78 | 79 | # kbuild supports saving output files in a separate directory. 80 | # To locate output files in a separate directory two syntaxes are supported. 81 | # In both cases the working directory must be the root of the kernel src. 82 | # 1) O= 83 | # Use "make O=dir/to/store/output/files/" 84 | # 85 | # 2) Set KBUILD_OUTPUT 86 | # Set the environment variable KBUILD_OUTPUT to point to the directory 87 | # where the output files shall be placed. 88 | # export KBUILD_OUTPUT=dir/to/store/output/files/ 89 | # make 90 | # 91 | # The O= assignment takes precedence over the KBUILD_OUTPUT environment 92 | # variable. 93 | 94 | 95 | # KBUILD_SRC is set on invocation of make in OBJ directory 96 | # KBUILD_SRC is not intended to be used by the regular user (for now) 97 | ifeq ($(KBUILD_SRC),) 98 | 99 | # OK, Make called in directory where kernel src resides 100 | # Do we want to locate output files in a separate directory? 101 | ifeq ("$(origin O)", "command line") 102 | KBUILD_OUTPUT := $(O) 103 | endif 104 | 105 | ifeq ("$(origin W)", "command line") 106 | export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W) 107 | endif 108 | 109 | # That's our default target when none is given on the command line 110 | PHONY := _all 111 | _all: 112 | 113 | # Cancel implicit rules on top Makefile 114 | $(CURDIR)/Makefile Makefile: ; 115 | 116 | ifneq ($(KBUILD_OUTPUT),) 117 | # Invoke a second make in the output directory, passing relevant variables 118 | # check that the output directory actually exists 119 | saved-output := $(KBUILD_OUTPUT) 120 | KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) 121 | $(if $(KBUILD_OUTPUT),, \ 122 | $(error output directory "$(saved-output)" does not exist)) 123 | 124 | PHONY += $(MAKECMDGOALS) sub-make 125 | 126 | $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make 127 | $(Q)@: 128 | 129 | sub-make: FORCE 130 | $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ 131 | KBUILD_SRC=$(CURDIR) \ 132 | KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \ 133 | $(filter-out _all sub-make,$(MAKECMDGOALS)) 134 | 135 | # Leave processing to above invocation of make 136 | skip-makefile := 1 137 | endif # ifneq ($(KBUILD_OUTPUT),) 138 | endif # ifeq ($(KBUILD_SRC),) 139 | 140 | # We process the rest of the Makefile if this is the final invocation of make 141 | ifeq ($(skip-makefile),) 142 | 143 | # If building an external module we do not care about the all: rule 144 | # but instead _all depend on modules 145 | PHONY += all 146 | ifeq ($(KBUILD_EXTMOD),) 147 | _all: all 148 | else 149 | _all: modules 150 | endif 151 | 152 | srctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)) 153 | objtree := $(CURDIR) 154 | src := $(srctree) 155 | obj := $(objtree) 156 | 157 | VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD)) 158 | 159 | export srctree objtree VPATH 160 | 161 | 162 | # SUBARCH tells the usermode build what the underlying arch is. That is set 163 | # first, and if a usermode build is happening, the "ARCH=um" on the command 164 | # line overrides the setting of ARCH below. If a native build is happening, 165 | # then ARCH is assigned, getting whatever value it gets normally, and 166 | # SUBARCH is subsequently ignored. 167 | 168 | SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ 169 | -e s/arm.*/arm/ -e s/sa110/arm/ \ 170 | -e s/s390x/s390/ -e s/parisc64/parisc/ \ 171 | -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ 172 | -e s/sh[234].*/sh/ ) 173 | 174 | # Cross compiling and selecting different set of gcc/bin-utils 175 | # --------------------------------------------------------------------------- 176 | # 177 | # When performing cross compilation for other architectures ARCH shall be set 178 | # to the target architecture. (See arch/* for the possibilities). 179 | # ARCH can be set during invocation of make: 180 | # make ARCH=ia64 181 | # Another way is to have ARCH set in the environment. 182 | # The default ARCH is the host where make is executed. 183 | 184 | # CROSS_COMPILE specify the prefix used for all executables used 185 | # during compilation. Only gcc and related bin-utils executables 186 | # are prefixed with $(CROSS_COMPILE). 187 | # CROSS_COMPILE can be set on the command line 188 | # make CROSS_COMPILE=ia64-linux- 189 | # Alternatively CROSS_COMPILE can be set in the environment. 190 | # A third alternative is to store a setting in .config so that plain 191 | # "make" in the configured kernel build directory always uses that. 192 | # Default value for CROSS_COMPILE is not to prefix executables 193 | # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile 194 | export KBUILD_BUILDHOST := $(SUBARCH) 195 | ARCH ?= $(SUBARCH) 196 | CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%) 197 | 198 | # Architecture as present in compile.h 199 | UTS_MACHINE := $(ARCH) 200 | SRCARCH := $(ARCH) 201 | 202 | # Additional ARCH settings for x86 203 | ifeq ($(ARCH),i386) 204 | SRCARCH := x86 205 | endif 206 | ifeq ($(ARCH),x86_64) 207 | SRCARCH := x86 208 | endif 209 | 210 | # Additional ARCH settings for sparc 211 | ifeq ($(ARCH),sparc32) 212 | SRCARCH := sparc 213 | endif 214 | ifeq ($(ARCH),sparc64) 215 | SRCARCH := sparc 216 | endif 217 | 218 | # Additional ARCH settings for sh 219 | ifeq ($(ARCH),sh64) 220 | SRCARCH := sh 221 | endif 222 | 223 | # Additional ARCH settings for tile 224 | ifeq ($(ARCH),tilepro) 225 | SRCARCH := tile 226 | endif 227 | ifeq ($(ARCH),tilegx) 228 | SRCARCH := tile 229 | endif 230 | 231 | # Where to locate arch specific headers 232 | hdr-arch := $(SRCARCH) 233 | 234 | ifeq ($(ARCH),m68knommu) 235 | hdr-arch := m68k 236 | endif 237 | 238 | KCONFIG_CONFIG ?= .config 239 | export KCONFIG_CONFIG 240 | 241 | # SHELL used by kbuild 242 | CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ 243 | else if [ -x /bin/bash ]; then echo /bin/bash; \ 244 | else echo sh; fi ; fi) 245 | 246 | HOSTCC = gcc 247 | HOSTCXX = g++ 248 | HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer 249 | HOSTCXXFLAGS = -O2 250 | 251 | # Decide whether to build built-in, modular, or both. 252 | # Normally, just do built-in. 253 | 254 | KBUILD_MODULES := 255 | KBUILD_BUILTIN := 1 256 | 257 | # If we have only "make modules", don't compile built-in objects. 258 | # When we're building modules with modversions, we need to consider 259 | # the built-in objects during the descend as well, in order to 260 | # make sure the checksums are up to date before we record them. 261 | 262 | ifeq ($(MAKECMDGOALS),modules) 263 | KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) 264 | endif 265 | 266 | # If we have "make modules", compile modules 267 | # in addition to whatever we do anyway. 268 | # Just "make" or "make all" shall build modules as well 269 | 270 | ifneq ($(filter all _all modules,$(MAKECMDGOALS)),) 271 | KBUILD_MODULES := 1 272 | endif 273 | 274 | ifeq ($(MAKECMDGOALS),) 275 | KBUILD_MODULES := 1 276 | endif 277 | 278 | export KBUILD_MODULES KBUILD_BUILTIN 279 | export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD 280 | 281 | # Beautify output 282 | # --------------------------------------------------------------------------- 283 | # 284 | # Normally, we echo the whole command before executing it. By making 285 | # that echo $($(quiet)$(cmd)), we now have the possibility to set 286 | # $(quiet) to choose other forms of output instead, e.g. 287 | # 288 | # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@ 289 | # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< 290 | # 291 | # If $(quiet) is empty, the whole command will be printed. 292 | # If it is set to "quiet_", only the short version will be printed. 293 | # If it is set to "silent_", nothing will be printed at all, since 294 | # the variable $(silent_cmd_cc_o_c) doesn't exist. 295 | # 296 | # A simple variant is to prefix commands with $(Q) - that's useful 297 | # for commands that shall be hidden in non-verbose mode. 298 | # 299 | # $(Q)ln $@ :< 300 | # 301 | # If KBUILD_VERBOSE equals 0 then the above command will be hidden. 302 | # If KBUILD_VERBOSE equals 1 then the above command is displayed. 303 | 304 | ifeq ($(KBUILD_VERBOSE),1) 305 | quiet = 306 | Q = 307 | else 308 | quiet=quiet_ 309 | Q = @ 310 | endif 311 | 312 | # If the user is running make -s (silent mode), suppress echoing of 313 | # commands 314 | 315 | ifneq ($(findstring s,$(MAKEFLAGS)),) 316 | quiet=silent_ 317 | endif 318 | 319 | export quiet Q KBUILD_VERBOSE 320 | 321 | 322 | # Look for make include files relative to root of kernel src 323 | MAKEFLAGS += --include-dir=$(srctree) 324 | 325 | # We need some generic definitions (do not try to remake the file). 326 | $(srctree)/scripts/Kbuild.include: ; 327 | include $(srctree)/scripts/Kbuild.include 328 | 329 | # Make variables (CC, etc...) 330 | 331 | AS = $(CROSS_COMPILE)as 332 | LD = $(CROSS_COMPILE)ld 333 | CC = $(CROSS_COMPILE)gcc 334 | CPP = $(CC) -E 335 | AR = $(CROSS_COMPILE)ar 336 | NM = $(CROSS_COMPILE)nm 337 | STRIP = $(CROSS_COMPILE)strip 338 | OBJCOPY = $(CROSS_COMPILE)objcopy 339 | OBJDUMP = $(CROSS_COMPILE)objdump 340 | AWK = awk 341 | GENKSYMS = scripts/genksyms/genksyms 342 | INSTALLKERNEL := installkernel 343 | DEPMOD = /sbin/depmod 344 | KALLSYMS = scripts/kallsyms 345 | PERL = perl 346 | CHECK = sparse 347 | 348 | CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ 349 | -Wbitwise -Wno-return-void $(CF) 350 | CFLAGS_MODULE = 351 | AFLAGS_MODULE = 352 | LDFLAGS_MODULE = 353 | CFLAGS_KERNEL = 354 | AFLAGS_KERNEL = 355 | CFLAGS_GCOV = -fprofile-arcs -ftest-coverage 356 | 357 | 358 | # Use LINUXINCLUDE when you must reference the include/ directory. 359 | # Needed to be compatible with the O= option 360 | LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include \ 361 | -Iarch/$(hdr-arch)/include/generated -Iinclude \ 362 | $(if $(KBUILD_SRC), -I$(srctree)/include) \ 363 | -include $(srctree)/include/linux/kconfig.h 364 | 365 | KBUILD_CPPFLAGS := -D__KERNEL__ 366 | 367 | KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 368 | -fno-strict-aliasing -fno-common \ 369 | -Werror-implicit-function-declaration \ 370 | -Wno-format-security \ 371 | -fno-delete-null-pointer-checks 372 | KBUILD_AFLAGS_KERNEL := 373 | KBUILD_CFLAGS_KERNEL := 374 | KBUILD_AFLAGS := -D__ASSEMBLY__ 375 | KBUILD_AFLAGS_MODULE := -DMODULE 376 | KBUILD_CFLAGS_MODULE := -DMODULE 377 | KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds 378 | 379 | # Read KERNELRELEASE from include/config/kernel.release (if it exists) 380 | KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) 381 | KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) 382 | 383 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION 384 | export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC 385 | export CPP AR NM STRIP OBJCOPY OBJDUMP 386 | export MAKE AWK GENKSYMS INSTALLKERNEL PERL UTS_MACHINE 387 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS 388 | 389 | export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS 390 | export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV 391 | export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE 392 | export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE 393 | export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL 394 | export KBUILD_ARFLAGS 395 | 396 | # When compiling out-of-tree modules, put MODVERDIR in the module 397 | # tree rather than in the kernel tree. The kernel tree might 398 | # even be read-only. 399 | export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions 400 | 401 | # Files to ignore in find ... statements 402 | 403 | RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o 404 | export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS --exclude .pc --exclude .hg --exclude .git 405 | 406 | # =========================================================================== 407 | # Rules shared between *config targets and build targets 408 | 409 | # Basic helpers built in scripts/ 410 | PHONY += scripts_basic 411 | scripts_basic: 412 | $(Q)$(MAKE) $(build)=scripts/basic 413 | $(Q)rm -f .tmp_quiet_recordmcount 414 | 415 | # To avoid any implicit rule to kick in, define an empty command. 416 | scripts/basic/%: scripts_basic ; 417 | 418 | PHONY += outputmakefile 419 | # outputmakefile generates a Makefile in the output directory, if using a 420 | # separate output directory. This allows convenient use of make in the 421 | # output directory. 422 | outputmakefile: 423 | ifneq ($(KBUILD_SRC),) 424 | $(Q)ln -fsn $(srctree) source 425 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ 426 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) 427 | endif 428 | 429 | # Support for using generic headers in asm-generic 430 | PHONY += asm-generic 431 | asm-generic: 432 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ 433 | obj=arch/$(SRCARCH)/include/generated/asm 434 | 435 | # To make sure we do not include .config for any of the *config targets 436 | # catch them early, and hand them over to scripts/kconfig/Makefile 437 | # It is allowed to specify more targets when calling make, including 438 | # mixing *config targets and build targets. 439 | # For example 'make oldconfig all'. 440 | # Detect when mixed targets is specified, and make a second invocation 441 | # of make so .config is not included in this case either (for *config). 442 | 443 | no-dot-config-targets := clean mrproper distclean \ 444 | cscope gtags TAGS tags help %docs check% coccicheck \ 445 | include/linux/version.h headers_% \ 446 | kernelversion %src-pkg 447 | 448 | config-targets := 0 449 | mixed-targets := 0 450 | dot-config := 1 451 | 452 | ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) 453 | ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) 454 | dot-config := 0 455 | endif 456 | endif 457 | 458 | ifeq ($(KBUILD_EXTMOD),) 459 | ifneq ($(filter config %config,$(MAKECMDGOALS)),) 460 | config-targets := 1 461 | ifneq ($(filter-out config %config,$(MAKECMDGOALS)),) 462 | mixed-targets := 1 463 | endif 464 | endif 465 | endif 466 | 467 | ifeq ($(mixed-targets),1) 468 | # =========================================================================== 469 | # We're called with mixed targets (*config and build targets). 470 | # Handle them one by one. 471 | 472 | %:: FORCE 473 | $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= $@ 474 | 475 | else 476 | ifeq ($(config-targets),1) 477 | # =========================================================================== 478 | # *config targets only - make sure prerequisites are updated, and descend 479 | # in scripts/kconfig to make the *config target 480 | 481 | # Read arch specific Makefile to set KBUILD_DEFCONFIG as needed. 482 | # KBUILD_DEFCONFIG may point out an alternative default configuration 483 | # used for 'make defconfig' 484 | include $(srctree)/arch/$(SRCARCH)/Makefile 485 | export KBUILD_DEFCONFIG KBUILD_KCONFIG 486 | 487 | config: scripts_basic outputmakefile FORCE 488 | $(Q)mkdir -p include/linux include/config 489 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ 490 | 491 | %config: scripts_basic outputmakefile FORCE 492 | $(Q)mkdir -p include/linux include/config 493 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ 494 | 495 | else 496 | # =========================================================================== 497 | # Build targets only - this includes vmlinux, arch specific targets, clean 498 | # targets and others. In general all targets except *config targets. 499 | 500 | ifeq ($(KBUILD_EXTMOD),) 501 | # Additional helpers built in scripts/ 502 | # Carefully list dependencies so we do not try to build scripts twice 503 | # in parallel 504 | PHONY += scripts 505 | scripts: scripts_basic include/config/auto.conf include/config/tristate.conf 506 | $(Q)$(MAKE) $(build)=$(@) 507 | 508 | # Objects we will link into vmlinux / subdirs we need to visit 509 | init-y := init/ 510 | drivers-y := drivers/ sound/ firmware/ 511 | net-y := net/ 512 | libs-y := lib/ 513 | core-y := usr/ 514 | endif # KBUILD_EXTMOD 515 | 516 | ifeq ($(dot-config),1) 517 | # Read in config 518 | -include include/config/auto.conf 519 | 520 | ifeq ($(KBUILD_EXTMOD),) 521 | # Read in dependencies to all Kconfig* files, make sure to run 522 | # oldconfig if changes are detected. 523 | -include include/config/auto.conf.cmd 524 | 525 | # To avoid any implicit rule to kick in, define an empty command 526 | $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; 527 | 528 | # If .config is newer than include/config/auto.conf, someone tinkered 529 | # with it and forgot to run make oldconfig. 530 | # if auto.conf.cmd is missing then we are probably in a cleaned tree so 531 | # we execute the config step to be sure to catch updated Kconfig files 532 | include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd 533 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig 534 | else 535 | # external modules needs include/generated/autoconf.h and include/config/auto.conf 536 | # but do not care if they are up-to-date. Use auto.conf to trigger the test 537 | PHONY += include/config/auto.conf 538 | 539 | include/config/auto.conf: 540 | $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \ 541 | echo; \ 542 | echo " ERROR: Kernel configuration is invalid."; \ 543 | echo " include/generated/autoconf.h or $@ are missing.";\ 544 | echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ 545 | echo; \ 546 | /bin/false) 547 | 548 | endif # KBUILD_EXTMOD 549 | 550 | else 551 | # Dummy target needed, because used as prerequisite 552 | include/config/auto.conf: ; 553 | endif # $(dot-config) 554 | 555 | # The all: target is the default when no target is given on the 556 | # command line. 557 | # This allow a user to issue only 'make' to build a kernel including modules 558 | # Defaults to vmlinux, but the arch makefile usually adds further targets 559 | all: vmlinux 560 | 561 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE 562 | KBUILD_CFLAGS += -Os 563 | else 564 | KBUILD_CFLAGS += -O2 565 | endif 566 | 567 | include $(srctree)/arch/$(SRCARCH)/Makefile 568 | 569 | ifneq ($(CONFIG_FRAME_WARN),0) 570 | KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) 571 | endif 572 | 573 | # Force gcc to behave correct even for buggy distributions 574 | ifndef CONFIG_CC_STACKPROTECTOR 575 | KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) 576 | endif 577 | 578 | # This warning generated too much noise in a regular build. 579 | # Use make W=1 to enable this warning (see scripts/Makefile.build) 580 | KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) 581 | 582 | ifdef CONFIG_FRAME_POINTER 583 | KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls 584 | else 585 | # Some targets (ARM with Thumb2, for example), can't be built with frame 586 | # pointers. For those, we don't have FUNCTION_TRACER automatically 587 | # select FRAME_POINTER. However, FUNCTION_TRACER adds -pg, and this is 588 | # incompatible with -fomit-frame-pointer with current GCC, so we don't use 589 | # -fomit-frame-pointer with FUNCTION_TRACER. 590 | ifndef CONFIG_FUNCTION_TRACER 591 | KBUILD_CFLAGS += -fomit-frame-pointer 592 | endif 593 | endif 594 | 595 | ifdef CONFIG_DEBUG_INFO 596 | KBUILD_CFLAGS += -g 597 | KBUILD_AFLAGS += -gdwarf-2 598 | endif 599 | 600 | ifdef CONFIG_DEBUG_INFO_REDUCED 601 | KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) 602 | endif 603 | 604 | ifdef CONFIG_FUNCTION_TRACER 605 | KBUILD_CFLAGS += -pg 606 | ifdef CONFIG_DYNAMIC_FTRACE 607 | ifdef CONFIG_HAVE_C_RECORDMCOUNT 608 | BUILD_C_RECORDMCOUNT := y 609 | export BUILD_C_RECORDMCOUNT 610 | endif 611 | endif 612 | endif 613 | 614 | # We trigger additional mismatches with less inlining 615 | ifdef CONFIG_DEBUG_SECTION_MISMATCH 616 | KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) 617 | endif 618 | 619 | # arch Makefile may override CC so keep this after arch Makefile is included 620 | NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) 621 | CHECKFLAGS += $(NOSTDINC_FLAGS) 622 | 623 | # warn about C99 declaration after statement 624 | KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) 625 | 626 | # disable pointer signed / unsigned warnings in gcc 4.0 627 | KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign) 628 | 629 | # disable invalid "can't wrap" optimizations for signed / pointers 630 | KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow) 631 | 632 | # conserve stack if available 633 | KBUILD_CFLAGS += $(call cc-option,-fconserve-stack) 634 | 635 | # use the deterministic mode of AR if available 636 | KBUILD_ARFLAGS := $(call ar-option,D) 637 | 638 | # check for 'asm goto' 639 | ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y) 640 | KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO 641 | endif 642 | 643 | # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments 644 | # But warn user when we do so 645 | warn-assign = \ 646 | $(warning "WARNING: Appending $$K$(1) ($(K$(1))) from $(origin K$(1)) to kernel $$$(1)") 647 | 648 | ifneq ($(KCPPFLAGS),) 649 | $(call warn-assign,CPPFLAGS) 650 | KBUILD_CPPFLAGS += $(KCPPFLAGS) 651 | endif 652 | ifneq ($(KAFLAGS),) 653 | $(call warn-assign,AFLAGS) 654 | KBUILD_AFLAGS += $(KAFLAGS) 655 | endif 656 | ifneq ($(KCFLAGS),) 657 | $(call warn-assign,CFLAGS) 658 | KBUILD_CFLAGS += $(KCFLAGS) 659 | endif 660 | 661 | # Use --build-id when available. 662 | LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ 663 | $(call cc-ldoption, -Wl$(comma)--build-id,)) 664 | KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID) 665 | LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID) 666 | 667 | ifeq ($(CONFIG_STRIP_ASM_SYMS),y) 668 | LDFLAGS_vmlinux += $(call ld-option, -X,) 669 | endif 670 | 671 | # Default kernel image to build when no specific target is given. 672 | # KBUILD_IMAGE may be overruled on the command line or 673 | # set in the environment 674 | # Also any assignments in arch/$(ARCH)/Makefile take precedence over 675 | # this default value 676 | export KBUILD_IMAGE ?= vmlinux 677 | 678 | # 679 | # INSTALL_PATH specifies where to place the updated kernel and system map 680 | # images. Default is /boot, but you can set it to other values 681 | export INSTALL_PATH ?= /boot 682 | 683 | # 684 | # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory 685 | # relocations required by build roots. This is not defined in the 686 | # makefile but the argument can be passed to make if needed. 687 | # 688 | 689 | MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) 690 | export MODLIB 691 | 692 | # 693 | # INSTALL_MOD_STRIP, if defined, will cause modules to be 694 | # stripped after they are installed. If INSTALL_MOD_STRIP is '1', then 695 | # the default option --strip-debug will be used. Otherwise, 696 | # INSTALL_MOD_STRIP value will be used as the options to the strip command. 697 | 698 | ifdef INSTALL_MOD_STRIP 699 | ifeq ($(INSTALL_MOD_STRIP),1) 700 | mod_strip_cmd = $(STRIP) --strip-debug 701 | else 702 | mod_strip_cmd = $(STRIP) $(INSTALL_MOD_STRIP) 703 | endif # INSTALL_MOD_STRIP=1 704 | else 705 | mod_strip_cmd = true 706 | endif # INSTALL_MOD_STRIP 707 | export mod_strip_cmd 708 | 709 | 710 | ifeq ($(KBUILD_EXTMOD),) 711 | core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ samples/yfkm2/ 712 | 713 | vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ 714 | $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ 715 | $(net-y) $(net-m) $(libs-y) $(libs-m))) 716 | 717 | vmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \ 718 | $(init-n) $(init-) \ 719 | $(core-n) $(core-) $(drivers-n) $(drivers-) \ 720 | $(net-n) $(net-) $(libs-n) $(libs-)))) 721 | 722 | init-y := $(patsubst %/, %/built-in.o, $(init-y)) 723 | core-y := $(patsubst %/, %/built-in.o, $(core-y)) 724 | drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y)) 725 | net-y := $(patsubst %/, %/built-in.o, $(net-y)) 726 | libs-y1 := $(patsubst %/, %/lib.a, $(libs-y)) 727 | libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y)) 728 | libs-y := $(libs-y1) $(libs-y2) 729 | 730 | # Build vmlinux 731 | # --------------------------------------------------------------------------- 732 | # vmlinux is built from the objects selected by $(vmlinux-init) and 733 | # $(vmlinux-main). Most are built-in.o files from top-level directories 734 | # in the kernel tree, others are specified in arch/$(ARCH)/Makefile. 735 | # Ordering when linking is important, and $(vmlinux-init) must be first. 736 | # 737 | # vmlinux 738 | # ^ 739 | # | 740 | # +-< $(vmlinux-init) 741 | # | +--< init/version.o + more 742 | # | 743 | # +--< $(vmlinux-main) 744 | # | +--< driver/built-in.o mm/built-in.o + more 745 | # | 746 | # +-< kallsyms.o (see description in CONFIG_KALLSYMS section) 747 | # 748 | # vmlinux version (uname -v) cannot be updated during normal 749 | # descending-into-subdirs phase since we do not yet know if we need to 750 | # update vmlinux. 751 | # Therefore this step is delayed until just before final link of vmlinux - 752 | # except in the kallsyms case where it is done just before adding the 753 | # symbols to the kernel. 754 | # 755 | # System.map is generated to document addresses of all kernel symbols 756 | 757 | vmlinux-init := $(head-y) $(init-y) 758 | vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y) 759 | vmlinux-all := $(vmlinux-init) $(vmlinux-main) 760 | vmlinux-lds := arch/$(SRCARCH)/kernel/vmlinux.lds 761 | export KBUILD_VMLINUX_OBJS := $(vmlinux-all) 762 | 763 | # Rule to link vmlinux - also used during CONFIG_KALLSYMS 764 | # May be overridden by arch/$(ARCH)/Makefile 765 | quiet_cmd_vmlinux__ ?= LD $@ 766 | cmd_vmlinux__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) -o $@ \ 767 | -T $(vmlinux-lds) $(vmlinux-init) \ 768 | --start-group $(vmlinux-main) --end-group \ 769 | $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o FORCE ,$^) 770 | 771 | ifdef AFTER_LINK 772 | cmd_vmlinux__ += ; $(AFTER_LINK) 773 | endif 774 | 775 | # Generate new vmlinux version 776 | quiet_cmd_vmlinux_version = GEN .version 777 | cmd_vmlinux_version = set -e; \ 778 | if [ ! -r .version ]; then \ 779 | rm -f .version; \ 780 | echo 1 >.version; \ 781 | else \ 782 | mv .version .old_version; \ 783 | expr 0$$(cat .old_version) + 1 >.version; \ 784 | fi; \ 785 | $(MAKE) $(build)=init 786 | 787 | # Generate System.map 788 | quiet_cmd_sysmap = SYSMAP 789 | cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap 790 | 791 | # Link of vmlinux 792 | # If CONFIG_KALLSYMS is set .version is already updated 793 | # Generate System.map and verify that the content is consistent 794 | # Use + in front of the vmlinux_version rule to silent warning with make -j2 795 | # First command is ':' to allow us to use + in front of the rule 796 | define rule_vmlinux__ 797 | : 798 | $(if $(CONFIG_KALLSYMS),,+$(call cmd,vmlinux_version)) 799 | 800 | $(call cmd,vmlinux__) 801 | $(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd 802 | 803 | $(Q)$(if $($(quiet)cmd_sysmap), \ 804 | echo ' $($(quiet)cmd_sysmap) System.map' &&) \ 805 | $(cmd_sysmap) $@ System.map; \ 806 | if [ $$? -ne 0 ]; then \ 807 | rm -f $@; \ 808 | /bin/false; \ 809 | fi; 810 | $(verify_kallsyms) 811 | endef 812 | 813 | 814 | ifdef CONFIG_KALLSYMS 815 | # Generate section listing all symbols and add it into vmlinux $(kallsyms.o) 816 | # It's a three stage process: 817 | # o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is 818 | # empty 819 | # Running kallsyms on that gives us .tmp_kallsyms1.o with 820 | # the right size - vmlinux version (uname -v) is updated during this step 821 | # o .tmp_vmlinux2 now has a __kallsyms section of the right size, 822 | # but due to the added section, some addresses have shifted. 823 | # From here, we generate a correct .tmp_kallsyms2.o 824 | # o The correct .tmp_kallsyms2.o is linked into the final vmlinux. 825 | # o Verify that the System.map from vmlinux matches the map from 826 | # .tmp_vmlinux2, just in case we did not generate kallsyms correctly. 827 | # o If 'make KALLSYMS_EXTRA_PASS=1" was used, do an extra pass using 828 | # .tmp_vmlinux3 and .tmp_kallsyms3.o. This is only meant as a 829 | # temporary bypass to allow the kernel to be built while the 830 | # maintainers work out what went wrong with kallsyms. 831 | 832 | last_kallsyms := 2 833 | 834 | ifdef KALLSYMS_EXTRA_PASS 835 | ifneq ($(KALLSYMS_EXTRA_PASS),0) 836 | last_kallsyms := 3 837 | endif 838 | endif 839 | 840 | kallsyms.o := .tmp_kallsyms$(last_kallsyms).o 841 | 842 | define verify_kallsyms 843 | $(Q)$(if $($(quiet)cmd_sysmap), \ 844 | echo ' $($(quiet)cmd_sysmap) .tmp_System.map' &&) \ 845 | $(cmd_sysmap) .tmp_vmlinux$(last_kallsyms) .tmp_System.map 846 | $(Q)cmp -s System.map .tmp_System.map || \ 847 | (echo Inconsistent kallsyms data; \ 848 | echo This is a bug - please report about it; \ 849 | echo Try "make KALLSYMS_EXTRA_PASS=1" as a workaround; \ 850 | rm .tmp_kallsyms* ; /bin/false ) 851 | endef 852 | 853 | # Update vmlinux version before link 854 | # Use + in front of this rule to silent warning about make -j1 855 | # First command is ':' to allow us to use + in front of this rule 856 | cmd_ksym_ld = $(cmd_vmlinux__) 857 | define rule_ksym_ld 858 | : 859 | +$(call cmd,vmlinux_version) 860 | $(call cmd,vmlinux__) 861 | $(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd 862 | endef 863 | 864 | # Generate .S file with all kernel symbols 865 | quiet_cmd_kallsyms = KSYM $@ 866 | cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) \ 867 | $(if $(CONFIG_KALLSYMS_ALL),--all-symbols) > $@ 868 | 869 | .tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE 870 | $(call if_changed_dep,as_o_S) 871 | 872 | .tmp_kallsyms%.S: .tmp_vmlinux% $(KALLSYMS) 873 | $(call cmd,kallsyms) 874 | 875 | # .tmp_vmlinux1 must be complete except kallsyms, so update vmlinux version 876 | .tmp_vmlinux1: $(vmlinux-lds) $(vmlinux-all) FORCE 877 | $(call if_changed_rule,ksym_ld) 878 | 879 | .tmp_vmlinux2: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms1.o FORCE 880 | $(call if_changed,vmlinux__) 881 | 882 | .tmp_vmlinux3: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms2.o FORCE 883 | $(call if_changed,vmlinux__) 884 | 885 | # Needs to visit scripts/ before $(KALLSYMS) can be used. 886 | $(KALLSYMS): scripts ; 887 | 888 | # Generate some data for debugging strange kallsyms problems 889 | debug_kallsyms: .tmp_map$(last_kallsyms) 890 | 891 | .tmp_map%: .tmp_vmlinux% FORCE 892 | ($(OBJDUMP) -h $< | $(AWK) '/^ +[0-9]/{print $$4 " 0 " $$2}'; $(NM) $<) | sort > $@ 893 | 894 | .tmp_map3: .tmp_map2 895 | 896 | .tmp_map2: .tmp_map1 897 | 898 | endif # ifdef CONFIG_KALLSYMS 899 | 900 | # Do modpost on a prelinked vmlinux. The finally linked vmlinux has 901 | # relevant sections renamed as per the linker script. 902 | quiet_cmd_vmlinux-modpost = LD $@ 903 | cmd_vmlinux-modpost = $(LD) $(LDFLAGS) -r -o $@ \ 904 | $(vmlinux-init) --start-group $(vmlinux-main) --end-group \ 905 | $(filter-out $(vmlinux-init) $(vmlinux-main) FORCE ,$^) 906 | define rule_vmlinux-modpost 907 | : 908 | +$(call cmd,vmlinux-modpost) 909 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@ 910 | $(Q)echo 'cmd_$@ := $(cmd_vmlinux-modpost)' > $(dot-target).cmd 911 | endef 912 | 913 | # vmlinux image - including updated kernel symbols 914 | vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o $(kallsyms.o) FORCE 915 | ifdef CONFIG_HEADERS_CHECK 916 | $(Q)$(MAKE) -f $(srctree)/Makefile headers_check 917 | endif 918 | ifdef CONFIG_SAMPLES 919 | $(Q)$(MAKE) $(build)=samples 920 | endif 921 | ifdef CONFIG_BUILD_DOCSRC 922 | $(Q)$(MAKE) $(build)=Documentation 923 | endif 924 | $(call vmlinux-modpost) 925 | $(call if_changed_rule,vmlinux__) 926 | $(Q)rm -f .old_version 927 | 928 | # build vmlinux.o first to catch section mismatch errors early 929 | ifdef CONFIG_KALLSYMS 930 | .tmp_vmlinux1: vmlinux.o 931 | endif 932 | 933 | modpost-init := $(filter-out init/built-in.o, $(vmlinux-init)) 934 | vmlinux.o: $(modpost-init) $(vmlinux-main) FORCE 935 | $(call if_changed_rule,vmlinux-modpost) 936 | 937 | # The actual objects are generated when descending, 938 | # make sure no implicit rule kicks in 939 | $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ; 940 | 941 | # Handle descending into subdirectories listed in $(vmlinux-dirs) 942 | # Preset locale variables to speed up the build process. Limit locale 943 | # tweaks to this spot to avoid wrong language settings when running 944 | # make menuconfig etc. 945 | # Error messages still appears in the original language 946 | 947 | PHONY += $(vmlinux-dirs) 948 | $(vmlinux-dirs): prepare scripts 949 | $(Q)$(MAKE) $(build)=$@ 950 | 951 | # Store (new) KERNELRELASE string in include/config/kernel.release 952 | include/config/kernel.release: include/config/auto.conf FORCE 953 | $(Q)rm -f $@ 954 | $(Q)echo "2.6.$$((40 + $(PATCHLEVEL)))$(EXTRAVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" > $@ 955 | 956 | 957 | # Things we need to do before we recursively start building the kernel 958 | # or the modules are listed in "prepare". 959 | # A multi level approach is used. prepareN is processed before prepareN-1. 960 | # archprepare is used in arch Makefiles and when processed asm symlink, 961 | # version.h and scripts_basic is processed / created. 962 | 963 | # Listed in dependency order 964 | PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 965 | 966 | # prepare3 is used to check if we are building in a separate output directory, 967 | # and if so do: 968 | # 1) Check that make has not been executed in the kernel src $(srctree) 969 | prepare3: include/config/kernel.release 970 | ifneq ($(KBUILD_SRC),) 971 | @$(kecho) ' Using $(srctree) as source for kernel' 972 | $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ 973 | echo " $(srctree) is not clean, please run 'make mrproper'";\ 974 | echo " in the '$(srctree)' directory.";\ 975 | /bin/false; \ 976 | fi; 977 | endif 978 | 979 | # prepare2 creates a makefile if using a separate output directory 980 | prepare2: prepare3 outputmakefile asm-generic 981 | 982 | prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \ 983 | include/config/auto.conf 984 | $(cmd_crmodverdir) 985 | 986 | archprepare: prepare1 scripts_basic 987 | 988 | prepare0: archprepare FORCE 989 | $(Q)$(MAKE) $(build)=. 990 | 991 | # All the preparing.. 992 | prepare: prepare0 993 | 994 | # Generate some files 995 | # --------------------------------------------------------------------------- 996 | 997 | # KERNELRELEASE can change from a few different places, meaning version.h 998 | # needs to be updated, so this check is forced on all builds 999 | 1000 | uts_len := 64 1001 | define filechk_utsrelease.h 1002 | if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \ 1003 | echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ 1004 | exit 1; \ 1005 | fi; \ 1006 | (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\";) 1007 | endef 1008 | 1009 | define filechk_version.h 1010 | (echo \#define LINUX_VERSION_CODE $(shell \ 1011 | expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \ 1012 | echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) 1013 | endef 1014 | 1015 | include/linux/version.h: $(srctree)/Makefile FORCE 1016 | $(call filechk,version.h) 1017 | 1018 | include/generated/utsrelease.h: include/config/kernel.release FORCE 1019 | $(call filechk,utsrelease.h) 1020 | 1021 | PHONY += headerdep 1022 | headerdep: 1023 | $(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \ 1024 | $(srctree)/scripts/headerdep.pl -I$(srctree)/include 1025 | 1026 | # --------------------------------------------------------------------------- 1027 | 1028 | PHONY += depend dep 1029 | depend dep: 1030 | @echo '*** Warning: make $@ is unnecessary now.' 1031 | 1032 | # --------------------------------------------------------------------------- 1033 | # Firmware install 1034 | INSTALL_FW_PATH=$(INSTALL_MOD_PATH)/lib/firmware 1035 | export INSTALL_FW_PATH 1036 | 1037 | PHONY += firmware_install 1038 | firmware_install: FORCE 1039 | @mkdir -p $(objtree)/firmware 1040 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_install 1041 | 1042 | # --------------------------------------------------------------------------- 1043 | # Kernel headers 1044 | 1045 | #Default location for installed headers 1046 | export INSTALL_HDR_PATH = $(objtree)/usr 1047 | 1048 | hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj 1049 | 1050 | # If we do an all arch process set dst to asm-$(hdr-arch) 1051 | hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm) 1052 | 1053 | PHONY += __headers 1054 | __headers: include/linux/version.h scripts_basic asm-generic FORCE 1055 | $(Q)$(MAKE) $(build)=scripts build_unifdef 1056 | 1057 | PHONY += headers_install_all 1058 | headers_install_all: 1059 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh install 1060 | 1061 | PHONY += headers_install 1062 | headers_install: __headers 1063 | $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild),, \ 1064 | $(error Headers not exportable for the $(SRCARCH) architecture)) 1065 | $(Q)$(MAKE) $(hdr-inst)=include 1066 | $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst) 1067 | 1068 | PHONY += headers_check_all 1069 | headers_check_all: headers_install_all 1070 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/headers.sh check 1071 | 1072 | PHONY += headers_check 1073 | headers_check: headers_install 1074 | $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1 1075 | $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst) HDRCHECK=1 1076 | 1077 | # --------------------------------------------------------------------------- 1078 | # Modules 1079 | 1080 | ifdef CONFIG_MODULES 1081 | 1082 | # By default, build modules as well 1083 | 1084 | all: modules 1085 | 1086 | # Build modules 1087 | # 1088 | # A module can be listed more than once in obj-m resulting in 1089 | # duplicate lines in modules.order files. Those are removed 1090 | # using awk while concatenating to the final file. 1091 | 1092 | PHONY += modules 1093 | modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin 1094 | $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order 1095 | @$(kecho) ' Building modules, stage 2.'; 1096 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost 1097 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modbuild 1098 | 1099 | modules.builtin: $(vmlinux-dirs:%=%/modules.builtin) 1100 | $(Q)$(AWK) '!x[$$0]++' $^ > $(objtree)/modules.builtin 1101 | 1102 | %/modules.builtin: include/config/auto.conf 1103 | $(Q)$(MAKE) $(modbuiltin)=$* 1104 | 1105 | 1106 | # Target to prepare building external modules 1107 | PHONY += modules_prepare 1108 | modules_prepare: prepare scripts 1109 | 1110 | # Target to install modules 1111 | PHONY += modules_install 1112 | modules_install: _modinst_ _modinst_post 1113 | 1114 | PHONY += _modinst_ 1115 | _modinst_: 1116 | @rm -rf $(MODLIB)/kernel 1117 | @rm -f $(MODLIB)/source 1118 | @mkdir -p $(MODLIB)/kernel 1119 | @ln -s $(srctree) $(MODLIB)/source 1120 | @if [ ! $(objtree) -ef $(MODLIB)/build ]; then \ 1121 | rm -f $(MODLIB)/build ; \ 1122 | ln -s $(objtree) $(MODLIB)/build ; \ 1123 | fi 1124 | @cp -f $(objtree)/modules.order $(MODLIB)/ 1125 | @cp -f $(objtree)/modules.builtin $(MODLIB)/ 1126 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst 1127 | 1128 | # This depmod is only for convenience to give the initial 1129 | # boot a modules.dep even before / is mounted read-write. However the 1130 | # boot script depmod is the master version. 1131 | PHONY += _modinst_post 1132 | _modinst_post: _modinst_ 1133 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modinst 1134 | $(call cmd,depmod) 1135 | 1136 | else # CONFIG_MODULES 1137 | 1138 | # Modules not configured 1139 | # --------------------------------------------------------------------------- 1140 | 1141 | modules modules_install: FORCE 1142 | @echo 1143 | @echo "The present kernel configuration has modules disabled." 1144 | @echo "Type 'make config' and enable loadable module support." 1145 | @echo "Then build a kernel with module support enabled." 1146 | @echo 1147 | @exit 1 1148 | 1149 | endif # CONFIG_MODULES 1150 | 1151 | ### 1152 | # Cleaning is done on three levels. 1153 | # make clean Delete most generated files 1154 | # Leave enough to build external modules 1155 | # make mrproper Delete the current configuration, and all generated files 1156 | # make distclean Remove editor backup files, patch leftover files and the like 1157 | 1158 | # Directories & files removed with 'make clean' 1159 | CLEAN_DIRS += $(MODVERDIR) 1160 | CLEAN_FILES += vmlinux System.map \ 1161 | .tmp_kallsyms* .tmp_version .tmp_vmlinux* .tmp_System.map 1162 | 1163 | # Directories & files removed with 'make mrproper' 1164 | MRPROPER_DIRS += include/config usr/include include/generated \ 1165 | arch/*/include/generated 1166 | MRPROPER_FILES += .config .config.old .version .old_version \ 1167 | include/linux/version.h \ 1168 | Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS 1169 | 1170 | # clean - Delete most, but leave enough to build external modules 1171 | # 1172 | clean: rm-dirs := $(CLEAN_DIRS) 1173 | clean: rm-files := $(CLEAN_FILES) 1174 | clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs) Documentation) 1175 | 1176 | PHONY += $(clean-dirs) clean archclean 1177 | $(clean-dirs): 1178 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) 1179 | 1180 | clean: archclean 1181 | 1182 | # mrproper - Delete all generated files, including .config 1183 | # 1184 | mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS)) 1185 | mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) 1186 | mrproper-dirs := $(addprefix _mrproper_,Documentation/DocBook scripts) 1187 | 1188 | PHONY += $(mrproper-dirs) mrproper archmrproper 1189 | $(mrproper-dirs): 1190 | $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) 1191 | 1192 | mrproper: clean archmrproper $(mrproper-dirs) 1193 | $(call cmd,rmdirs) 1194 | $(call cmd,rmfiles) 1195 | 1196 | # distclean 1197 | # 1198 | PHONY += distclean 1199 | 1200 | distclean: mrproper 1201 | @find $(srctree) $(RCS_FIND_IGNORE) \ 1202 | \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ 1203 | -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ 1204 | -o -name '.*.rej' \ 1205 | -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ 1206 | -type f -print | xargs rm -f 1207 | 1208 | 1209 | # Packaging of the kernel to various formats 1210 | # --------------------------------------------------------------------------- 1211 | # rpm target kept for backward compatibility 1212 | package-dir := $(srctree)/scripts/package 1213 | 1214 | %src-pkg: FORCE 1215 | $(Q)$(MAKE) $(build)=$(package-dir) $@ 1216 | %pkg: include/config/kernel.release FORCE 1217 | $(Q)$(MAKE) $(build)=$(package-dir) $@ 1218 | rpm: include/config/kernel.release FORCE 1219 | $(Q)$(MAKE) $(build)=$(package-dir) $@ 1220 | 1221 | 1222 | # Brief documentation of the typical targets used 1223 | # --------------------------------------------------------------------------- 1224 | 1225 | boards := $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*_defconfig) 1226 | boards := $(notdir $(boards)) 1227 | board-dirs := $(dir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/*/*_defconfig)) 1228 | board-dirs := $(sort $(notdir $(board-dirs:/=))) 1229 | 1230 | help: 1231 | @echo 'Cleaning targets:' 1232 | @echo ' clean - Remove most generated files but keep the config and' 1233 | @echo ' enough build support to build external modules' 1234 | @echo ' mrproper - Remove all generated files + config + various backup files' 1235 | @echo ' distclean - mrproper + remove editor backup and patch files' 1236 | @echo '' 1237 | @echo 'Configuration targets:' 1238 | @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help 1239 | @echo '' 1240 | @echo 'Other generic targets:' 1241 | @echo ' all - Build all targets marked with [*]' 1242 | @echo '* vmlinux - Build the bare kernel' 1243 | @echo '* modules - Build all modules' 1244 | @echo ' modules_install - Install all modules to INSTALL_MOD_PATH (default: /)' 1245 | @echo ' firmware_install- Install all firmware to INSTALL_FW_PATH' 1246 | @echo ' (default: $$(INSTALL_MOD_PATH)/lib/firmware)' 1247 | @echo ' dir/ - Build all files in dir and below' 1248 | @echo ' dir/file.[oisS] - Build specified target only' 1249 | @echo ' dir/file.lst - Build specified mixed source/assembly target only' 1250 | @echo ' (requires a recent binutils and recent build (System.map))' 1251 | @echo ' dir/file.ko - Build module including final link' 1252 | @echo ' modules_prepare - Set up for building external modules' 1253 | @echo ' tags/TAGS - Generate tags file for editors' 1254 | @echo ' cscope - Generate cscope index' 1255 | @echo ' gtags - Generate GNU GLOBAL index' 1256 | @echo ' kernelrelease - Output the release version string' 1257 | @echo ' kernelversion - Output the version stored in Makefile' 1258 | @echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \ 1259 | echo ' (default: $(INSTALL_HDR_PATH))'; \ 1260 | echo '' 1261 | @echo 'Static analysers' 1262 | @echo ' checkstack - Generate a list of stack hogs' 1263 | @echo ' namespacecheck - Name space analysis on compiled kernel' 1264 | @echo ' versioncheck - Sanity check on version.h usage' 1265 | @echo ' includecheck - Check for duplicate included header files' 1266 | @echo ' export_report - List the usages of all exported symbols' 1267 | @echo ' headers_check - Sanity check on exported headers' 1268 | @echo ' headerdep - Detect inclusion cycles in headers' 1269 | @$(MAKE) -f $(srctree)/scripts/Makefile.help checker-help 1270 | @echo '' 1271 | @echo 'Kernel packaging:' 1272 | @$(MAKE) $(build)=$(package-dir) help 1273 | @echo '' 1274 | @echo 'Documentation targets:' 1275 | @$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp 1276 | @echo '' 1277 | @echo 'Architecture specific targets ($(SRCARCH)):' 1278 | @$(if $(archhelp),$(archhelp),\ 1279 | echo ' No architecture specific help defined for $(SRCARCH)') 1280 | @echo '' 1281 | @$(if $(boards), \ 1282 | $(foreach b, $(boards), \ 1283 | printf " %-24s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \ 1284 | echo '') 1285 | @$(if $(board-dirs), \ 1286 | $(foreach b, $(board-dirs), \ 1287 | printf " %-16s - Show %s-specific targets\\n" help-$(b) $(b);) \ 1288 | printf " %-16s - Show all of the above\\n" help-boards; \ 1289 | echo '') 1290 | 1291 | @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' 1292 | @echo ' make V=2 [targets] 2 => give reason for rebuild of target' 1293 | @echo ' make O=dir [targets] Locate all output files in "dir", including .config' 1294 | @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)' 1295 | @echo ' make C=2 [targets] Force check of all c source with $$CHECK' 1296 | @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections' 1297 | @echo ' make W=n [targets] Enable extra gcc checks, n=1,2,3 where' 1298 | @echo ' 1: warnings which may be relevant and do not occur too often' 1299 | @echo ' 2: warnings which occur quite often but may still be relevant' 1300 | @echo ' 3: more obscure warnings, can most likely be ignored' 1301 | @echo ' Multiple levels can be combined with W=12 or W=123' 1302 | @echo '' 1303 | @echo 'Execute "make" or "make all" to build all targets marked with [*] ' 1304 | @echo 'For further info see the ./README file' 1305 | 1306 | 1307 | help-board-dirs := $(addprefix help-,$(board-dirs)) 1308 | 1309 | help-boards: $(help-board-dirs) 1310 | 1311 | boards-per-dir = $(notdir $(wildcard $(srctree)/arch/$(SRCARCH)/configs/$*/*_defconfig)) 1312 | 1313 | $(help-board-dirs): help-%: 1314 | @echo 'Architecture specific targets ($(SRCARCH) $*):' 1315 | @$(if $(boards-per-dir), \ 1316 | $(foreach b, $(boards-per-dir), \ 1317 | printf " %-24s - Build for %s\\n" $*/$(b) $(subst _defconfig,,$(b));) \ 1318 | echo '') 1319 | 1320 | 1321 | # Documentation targets 1322 | # --------------------------------------------------------------------------- 1323 | %docs: scripts_basic FORCE 1324 | $(Q)$(MAKE) $(build)=scripts build_docproc 1325 | $(Q)$(MAKE) $(build)=Documentation/DocBook $@ 1326 | 1327 | else # KBUILD_EXTMOD 1328 | 1329 | ### 1330 | # External module support. 1331 | # When building external modules the kernel used as basis is considered 1332 | # read-only, and no consistency checks are made and the make 1333 | # system is not used on the basis kernel. If updates are required 1334 | # in the basis kernel ordinary make commands (without M=...) must 1335 | # be used. 1336 | # 1337 | # The following are the only valid targets when building external 1338 | # modules. 1339 | # make M=dir clean Delete all automatically generated files 1340 | # make M=dir modules Make all modules in specified dir 1341 | # make M=dir Same as 'make M=dir modules' 1342 | # make M=dir modules_install 1343 | # Install the modules built in the module directory 1344 | # Assumes install directory is already created 1345 | 1346 | # We are always building modules 1347 | KBUILD_MODULES := 1 1348 | PHONY += crmodverdir 1349 | crmodverdir: 1350 | $(cmd_crmodverdir) 1351 | 1352 | PHONY += $(objtree)/Module.symvers 1353 | $(objtree)/Module.symvers: 1354 | @test -e $(objtree)/Module.symvers || ( \ 1355 | echo; \ 1356 | echo " WARNING: Symbol version dump $(objtree)/Module.symvers"; \ 1357 | echo " is missing; modules will have no dependencies and modversions."; \ 1358 | echo ) 1359 | 1360 | module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD)) 1361 | PHONY += $(module-dirs) modules 1362 | $(module-dirs): crmodverdir $(objtree)/Module.symvers 1363 | $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) 1364 | 1365 | modules: $(module-dirs) 1366 | @$(kecho) ' Building modules, stage 2.'; 1367 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost 1368 | 1369 | PHONY += modules_install 1370 | modules_install: _emodinst_ _emodinst_post 1371 | 1372 | install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra) 1373 | PHONY += _emodinst_ 1374 | _emodinst_: 1375 | $(Q)mkdir -p $(MODLIB)/$(install-dir) 1376 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst 1377 | 1378 | PHONY += _emodinst_post 1379 | _emodinst_post: _emodinst_ 1380 | $(call cmd,depmod) 1381 | 1382 | clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD)) 1383 | 1384 | PHONY += $(clean-dirs) clean 1385 | $(clean-dirs): 1386 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) 1387 | 1388 | clean: rm-dirs := $(MODVERDIR) 1389 | clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers 1390 | 1391 | help: 1392 | @echo ' Building external modules.' 1393 | @echo ' Syntax: make -C path/to/kernel/src M=$$PWD target' 1394 | @echo '' 1395 | @echo ' modules - default target, build the module(s)' 1396 | @echo ' modules_install - install the module' 1397 | @echo ' clean - remove generated files in module directory only' 1398 | @echo '' 1399 | 1400 | # Dummies... 1401 | PHONY += prepare scripts 1402 | prepare: ; 1403 | scripts: ; 1404 | endif # KBUILD_EXTMOD 1405 | 1406 | clean: $(clean-dirs) 1407 | $(call cmd,rmdirs) 1408 | $(call cmd,rmfiles) 1409 | @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ 1410 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ 1411 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ 1412 | -o -name '*.symtypes' -o -name 'modules.order' \ 1413 | -o -name modules.builtin -o -name '.tmp_*.o.*' \ 1414 | -o -name '*.gcno' \) -type f -print | xargs rm -f 1415 | 1416 | # Generate tags for editors 1417 | # --------------------------------------------------------------------------- 1418 | quiet_cmd_tags = GEN $@ 1419 | cmd_tags = $(CONFIG_SHELL) $(srctree)/scripts/tags.sh $@ 1420 | 1421 | tags TAGS cscope gtags: FORCE 1422 | $(call cmd,tags) 1423 | 1424 | # Scripts to check various things for consistency 1425 | # --------------------------------------------------------------------------- 1426 | 1427 | PHONY += includecheck versioncheck coccicheck namespacecheck export_report 1428 | 1429 | includecheck: 1430 | find $(srctree)/* $(RCS_FIND_IGNORE) \ 1431 | -name '*.[hcS]' -type f -print | sort \ 1432 | | xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl 1433 | 1434 | versioncheck: 1435 | find $(srctree)/* $(RCS_FIND_IGNORE) \ 1436 | -name '*.[hcS]' -type f -print | sort \ 1437 | | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl 1438 | 1439 | coccicheck: 1440 | $(Q)$(CONFIG_SHELL) $(srctree)/scripts/$@ 1441 | 1442 | namespacecheck: 1443 | $(PERL) $(srctree)/scripts/namespace.pl 1444 | 1445 | export_report: 1446 | $(PERL) $(srctree)/scripts/export_report.pl 1447 | 1448 | endif #ifeq ($(config-targets),1) 1449 | endif #ifeq ($(mixed-targets),1) 1450 | 1451 | PHONY += checkstack kernelrelease kernelversion 1452 | 1453 | # UML needs a little special treatment here. It wants to use the host 1454 | # toolchain, so needs $(SUBARCH) passed to checkstack.pl. Everyone 1455 | # else wants $(ARCH), including people doing cross-builds, which means 1456 | # that $(SUBARCH) doesn't work here. 1457 | ifeq ($(ARCH), um) 1458 | CHECKSTACK_ARCH := $(SUBARCH) 1459 | else 1460 | CHECKSTACK_ARCH := $(ARCH) 1461 | endif 1462 | checkstack: 1463 | $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \ 1464 | $(PERL) $(src)/scripts/checkstack.pl $(CHECKSTACK_ARCH) 1465 | 1466 | kernelrelease: 1467 | @echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" 1468 | 1469 | kernelversion: 1470 | @echo $(KERNELVERSION) 1471 | 1472 | # Single targets 1473 | # --------------------------------------------------------------------------- 1474 | # Single targets are compatible with: 1475 | # - build with mixed source and output 1476 | # - build with separate output dir 'make O=...' 1477 | # - external modules 1478 | # 1479 | # target-dir => where to store outputfile 1480 | # build-dir => directory in kernel source tree to use 1481 | 1482 | ifeq ($(KBUILD_EXTMOD),) 1483 | build-dir = $(patsubst %/,%,$(dir $@)) 1484 | target-dir = $(dir $@) 1485 | else 1486 | zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@))) 1487 | build-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash)) 1488 | target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@)) 1489 | endif 1490 | 1491 | %.s: %.c prepare scripts FORCE 1492 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1493 | %.i: %.c prepare scripts FORCE 1494 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1495 | %.o: %.c prepare scripts FORCE 1496 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1497 | %.lst: %.c prepare scripts FORCE 1498 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1499 | %.s: %.S prepare scripts FORCE 1500 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1501 | %.o: %.S prepare scripts FORCE 1502 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1503 | %.symtypes: %.c prepare scripts FORCE 1504 | $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1505 | 1506 | # Modules 1507 | /: prepare scripts FORCE 1508 | $(cmd_crmodverdir) 1509 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ 1510 | $(build)=$(build-dir) 1511 | %/: prepare scripts FORCE 1512 | $(cmd_crmodverdir) 1513 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ 1514 | $(build)=$(build-dir) 1515 | %.ko: prepare scripts FORCE 1516 | $(cmd_crmodverdir) 1517 | $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ 1518 | $(build)=$(build-dir) $(@:.ko=.o) 1519 | $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost 1520 | 1521 | # FIXME Should go into a make.lib or something 1522 | # =========================================================================== 1523 | 1524 | quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs))) 1525 | cmd_rmdirs = rm -rf $(rm-dirs) 1526 | 1527 | quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) 1528 | cmd_rmfiles = rm -f $(rm-files) 1529 | 1530 | # Run depmod only if we have System.map and depmod is executable 1531 | quiet_cmd_depmod = DEPMOD $(KERNELRELEASE) 1532 | cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \ 1533 | $(KERNELRELEASE) 1534 | 1535 | # Create temporary dir for module support files 1536 | # clean it up only when building all modules 1537 | cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \ 1538 | $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*) 1539 | 1540 | a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ 1541 | $(KBUILD_AFLAGS_KERNEL) \ 1542 | $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(KBUILD_CPPFLAGS) \ 1543 | $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) 1544 | 1545 | quiet_cmd_as_o_S = AS $@ 1546 | cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< 1547 | 1548 | # read all saved command lines 1549 | 1550 | targets := $(wildcard $(sort $(targets))) 1551 | cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) 1552 | 1553 | ifneq ($(cmd_files),) 1554 | $(cmd_files): ; # Do not try to update included dependency files 1555 | include $(cmd_files) 1556 | endif 1557 | 1558 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir 1559 | # Usage: 1560 | # $(Q)$(MAKE) $(clean)=dir 1561 | clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj 1562 | 1563 | endif # skip-makefile 1564 | 1565 | PHONY += FORCE 1566 | FORCE: 1567 | 1568 | # Declare the contents of the .PHONY variable as phony. We keep that 1569 | # information in a variable so we can use it in if_changed and friends. 1570 | .PHONY: $(PHONY) 1571 | -------------------------------------------------------------------------------- /yfkm2/source/2.6.42.7-1.fc15/arch/x86/include/asm/unistd_32.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_X86_UNISTD_32_H 2 | #define _ASM_X86_UNISTD_32_H 3 | 4 | /* 5 | * This file contains the system call numbers. 6 | */ 7 | 8 | #define __NR_restart_syscall 0 9 | #define __NR_exit 1 10 | #define __NR_fork 2 11 | #define __NR_read 3 12 | #define __NR_write 4 13 | #define __NR_open 5 14 | #define __NR_close 6 15 | #define __NR_waitpid 7 16 | #define __NR_creat 8 17 | #define __NR_link 9 18 | #define __NR_unlink 10 19 | #define __NR_execve 11 20 | #define __NR_chdir 12 21 | #define __NR_time 13 22 | #define __NR_mknod 14 23 | #define __NR_chmod 15 24 | #define __NR_lchown 16 25 | #define __NR_break 17 26 | #define __NR_oldstat 18 27 | #define __NR_lseek 19 28 | #define __NR_getpid 20 29 | #define __NR_mount 21 30 | #define __NR_umount 22 31 | #define __NR_setuid 23 32 | #define __NR_getuid 24 33 | #define __NR_stime 25 34 | #define __NR_ptrace 26 35 | #define __NR_alarm 27 36 | #define __NR_oldfstat 28 37 | #define __NR_pause 29 38 | #define __NR_utime 30 39 | #define __NR_stty 31 40 | #define __NR_gtty 32 41 | #define __NR_access 33 42 | #define __NR_nice 34 43 | #define __NR_ftime 35 44 | #define __NR_sync 36 45 | #define __NR_kill 37 46 | #define __NR_rename 38 47 | #define __NR_mkdir 39 48 | #define __NR_rmdir 40 49 | #define __NR_dup 41 50 | #define __NR_pipe 42 51 | #define __NR_times 43 52 | #define __NR_prof 44 53 | #define __NR_brk 45 54 | #define __NR_setgid 46 55 | #define __NR_getgid 47 56 | #define __NR_signal 48 57 | #define __NR_geteuid 49 58 | #define __NR_getegid 50 59 | #define __NR_acct 51 60 | #define __NR_umount2 52 61 | #define __NR_lock 53 62 | #define __NR_ioctl 54 63 | #define __NR_fcntl 55 64 | #define __NR_mpx 56 65 | #define __NR_setpgid 57 66 | #define __NR_ulimit 58 67 | #define __NR_oldolduname 59 68 | #define __NR_umask 60 69 | #define __NR_chroot 61 70 | #define __NR_ustat 62 71 | #define __NR_dup2 63 72 | #define __NR_getppid 64 73 | #define __NR_getpgrp 65 74 | #define __NR_setsid 66 75 | #define __NR_sigaction 67 76 | #define __NR_sgetmask 68 77 | #define __NR_ssetmask 69 78 | #define __NR_setreuid 70 79 | #define __NR_setregid 71 80 | #define __NR_sigsuspend 72 81 | #define __NR_sigpending 73 82 | #define __NR_sethostname 74 83 | #define __NR_setrlimit 75 84 | #define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */ 85 | #define __NR_getrusage 77 86 | #define __NR_gettimeofday 78 87 | #define __NR_settimeofday 79 88 | #define __NR_getgroups 80 89 | #define __NR_setgroups 81 90 | #define __NR_select 82 91 | #define __NR_symlink 83 92 | #define __NR_oldlstat 84 93 | #define __NR_readlink 85 94 | #define __NR_uselib 86 95 | #define __NR_swapon 87 96 | #define __NR_reboot 88 97 | #define __NR_readdir 89 98 | #define __NR_mmap 90 99 | #define __NR_munmap 91 100 | #define __NR_truncate 92 101 | #define __NR_ftruncate 93 102 | #define __NR_fchmod 94 103 | #define __NR_fchown 95 104 | #define __NR_getpriority 96 105 | #define __NR_setpriority 97 106 | #define __NR_profil 98 107 | #define __NR_statfs 99 108 | #define __NR_fstatfs 100 109 | #define __NR_ioperm 101 110 | #define __NR_socketcall 102 111 | #define __NR_syslog 103 112 | #define __NR_setitimer 104 113 | #define __NR_getitimer 105 114 | #define __NR_stat 106 115 | #define __NR_lstat 107 116 | #define __NR_fstat 108 117 | #define __NR_olduname 109 118 | #define __NR_iopl 110 119 | #define __NR_vhangup 111 120 | #define __NR_idle 112 121 | #define __NR_vm86old 113 122 | #define __NR_wait4 114 123 | #define __NR_swapoff 115 124 | #define __NR_sysinfo 116 125 | #define __NR_ipc 117 126 | #define __NR_fsync 118 127 | #define __NR_sigreturn 119 128 | #define __NR_clone 120 129 | #define __NR_setdomainname 121 130 | #define __NR_uname 122 131 | #define __NR_modify_ldt 123 132 | #define __NR_adjtimex 124 133 | #define __NR_mprotect 125 134 | #define __NR_sigprocmask 126 135 | #define __NR_create_module 127 136 | #define __NR_init_module 128 137 | #define __NR_delete_module 129 138 | #define __NR_get_kernel_syms 130 139 | #define __NR_quotactl 131 140 | #define __NR_getpgid 132 141 | #define __NR_fchdir 133 142 | #define __NR_bdflush 134 143 | #define __NR_sysfs 135 144 | #define __NR_personality 136 145 | #define __NR_afs_syscall 137 /* Syscall for Andrew File System */ 146 | #define __NR_setfsuid 138 147 | #define __NR_setfsgid 139 148 | #define __NR__llseek 140 149 | #define __NR_getdents 141 150 | #define __NR__newselect 142 151 | #define __NR_flock 143 152 | #define __NR_msync 144 153 | #define __NR_readv 145 154 | #define __NR_writev 146 155 | #define __NR_getsid 147 156 | #define __NR_fdatasync 148 157 | #define __NR__sysctl 149 158 | #define __NR_mlock 150 159 | #define __NR_munlock 151 160 | #define __NR_mlockall 152 161 | #define __NR_munlockall 153 162 | #define __NR_sched_setparam 154 163 | #define __NR_sched_getparam 155 164 | #define __NR_sched_setscheduler 156 165 | #define __NR_sched_getscheduler 157 166 | #define __NR_sched_yield 158 167 | #define __NR_sched_get_priority_max 159 168 | #define __NR_sched_get_priority_min 160 169 | #define __NR_sched_rr_get_interval 161 170 | #define __NR_nanosleep 162 171 | #define __NR_mremap 163 172 | #define __NR_setresuid 164 173 | #define __NR_getresuid 165 174 | #define __NR_vm86 166 175 | #define __NR_query_module 167 176 | #define __NR_poll 168 177 | #define __NR_nfsservctl 169 178 | #define __NR_setresgid 170 179 | #define __NR_getresgid 171 180 | #define __NR_prctl 172 181 | #define __NR_rt_sigreturn 173 182 | #define __NR_rt_sigaction 174 183 | #define __NR_rt_sigprocmask 175 184 | #define __NR_rt_sigpending 176 185 | #define __NR_rt_sigtimedwait 177 186 | #define __NR_rt_sigqueueinfo 178 187 | #define __NR_rt_sigsuspend 179 188 | #define __NR_pread64 180 189 | #define __NR_pwrite64 181 190 | #define __NR_chown 182 191 | #define __NR_getcwd 183 192 | #define __NR_capget 184 193 | #define __NR_capset 185 194 | #define __NR_sigaltstack 186 195 | #define __NR_sendfile 187 196 | #define __NR_getpmsg 188 /* some people actually want streams */ 197 | #define __NR_putpmsg 189 /* some people actually want streams */ 198 | #define __NR_vfork 190 199 | #define __NR_ugetrlimit 191 /* SuS compliant getrlimit */ 200 | #define __NR_mmap2 192 201 | #define __NR_truncate64 193 202 | #define __NR_ftruncate64 194 203 | #define __NR_stat64 195 204 | #define __NR_lstat64 196 205 | #define __NR_fstat64 197 206 | #define __NR_lchown32 198 207 | #define __NR_getuid32 199 208 | #define __NR_getgid32 200 209 | #define __NR_geteuid32 201 210 | #define __NR_getegid32 202 211 | #define __NR_setreuid32 203 212 | #define __NR_setregid32 204 213 | #define __NR_getgroups32 205 214 | #define __NR_setgroups32 206 215 | #define __NR_fchown32 207 216 | #define __NR_setresuid32 208 217 | #define __NR_getresuid32 209 218 | #define __NR_setresgid32 210 219 | #define __NR_getresgid32 211 220 | #define __NR_chown32 212 221 | #define __NR_setuid32 213 222 | #define __NR_setgid32 214 223 | #define __NR_setfsuid32 215 224 | #define __NR_setfsgid32 216 225 | #define __NR_pivot_root 217 226 | #define __NR_mincore 218 227 | #define __NR_madvise 219 228 | #define __NR_madvise1 219 /* delete when C lib stub is removed */ 229 | #define __NR_getdents64 220 230 | #define __NR_fcntl64 221 231 | /* 223 is unused */ 232 | #define __NR_gettid 224 233 | #define __NR_readahead 225 234 | #define __NR_setxattr 226 235 | #define __NR_lsetxattr 227 236 | #define __NR_fsetxattr 228 237 | #define __NR_getxattr 229 238 | #define __NR_lgetxattr 230 239 | #define __NR_fgetxattr 231 240 | #define __NR_listxattr 232 241 | #define __NR_llistxattr 233 242 | #define __NR_flistxattr 234 243 | #define __NR_removexattr 235 244 | #define __NR_lremovexattr 236 245 | #define __NR_fremovexattr 237 246 | #define __NR_tkill 238 247 | #define __NR_sendfile64 239 248 | #define __NR_futex 240 249 | #define __NR_sched_setaffinity 241 250 | #define __NR_sched_getaffinity 242 251 | #define __NR_set_thread_area 243 252 | #define __NR_get_thread_area 244 253 | #define __NR_io_setup 245 254 | #define __NR_io_destroy 246 255 | #define __NR_io_getevents 247 256 | #define __NR_io_submit 248 257 | #define __NR_io_cancel 249 258 | #define __NR_fadvise64 250 259 | /* 251 is available for reuse (was briefly sys_set_zone_reclaim) */ 260 | #define __NR_exit_group 252 261 | #define __NR_lookup_dcookie 253 262 | #define __NR_epoll_create 254 263 | #define __NR_epoll_ctl 255 264 | #define __NR_epoll_wait 256 265 | #define __NR_remap_file_pages 257 266 | #define __NR_set_tid_address 258 267 | #define __NR_timer_create 259 268 | #define __NR_timer_settime (__NR_timer_create+1) 269 | #define __NR_timer_gettime (__NR_timer_create+2) 270 | #define __NR_timer_getoverrun (__NR_timer_create+3) 271 | #define __NR_timer_delete (__NR_timer_create+4) 272 | #define __NR_clock_settime (__NR_timer_create+5) 273 | #define __NR_clock_gettime (__NR_timer_create+6) 274 | #define __NR_clock_getres (__NR_timer_create+7) 275 | #define __NR_clock_nanosleep (__NR_timer_create+8) 276 | #define __NR_statfs64 268 277 | #define __NR_fstatfs64 269 278 | #define __NR_tgkill 270 279 | #define __NR_utimes 271 280 | #define __NR_fadvise64_64 272 281 | #define __NR_vserver 273 282 | #define __NR_mbind 274 283 | #define __NR_get_mempolicy 275 284 | #define __NR_set_mempolicy 276 285 | #define __NR_mq_open 277 286 | #define __NR_mq_unlink (__NR_mq_open+1) 287 | #define __NR_mq_timedsend (__NR_mq_open+2) 288 | #define __NR_mq_timedreceive (__NR_mq_open+3) 289 | #define __NR_mq_notify (__NR_mq_open+4) 290 | #define __NR_mq_getsetattr (__NR_mq_open+5) 291 | #define __NR_kexec_load 283 292 | #define __NR_waitid 284 293 | /* #define __NR_sys_setaltroot 285 */ 294 | #define __NR_add_key 286 295 | #define __NR_request_key 287 296 | #define __NR_keyctl 288 297 | #define __NR_ioprio_set 289 298 | #define __NR_ioprio_get 290 299 | #define __NR_inotify_init 291 300 | #define __NR_inotify_add_watch 292 301 | #define __NR_inotify_rm_watch 293 302 | #define __NR_migrate_pages 294 303 | #define __NR_openat 295 304 | #define __NR_mkdirat 296 305 | #define __NR_mknodat 297 306 | #define __NR_fchownat 298 307 | #define __NR_futimesat 299 308 | #define __NR_fstatat64 300 309 | #define __NR_unlinkat 301 310 | #define __NR_renameat 302 311 | #define __NR_linkat 303 312 | #define __NR_symlinkat 304 313 | #define __NR_readlinkat 305 314 | #define __NR_fchmodat 306 315 | #define __NR_faccessat 307 316 | #define __NR_pselect6 308 317 | #define __NR_ppoll 309 318 | #define __NR_unshare 310 319 | #define __NR_set_robust_list 311 320 | #define __NR_get_robust_list 312 321 | #define __NR_splice 313 322 | #define __NR_sync_file_range 314 323 | #define __NR_tee 315 324 | #define __NR_vmsplice 316 325 | #define __NR_move_pages 317 326 | #define __NR_getcpu 318 327 | #define __NR_epoll_pwait 319 328 | #define __NR_utimensat 320 329 | #define __NR_signalfd 321 330 | #define __NR_timerfd_create 322 331 | #define __NR_eventfd 323 332 | #define __NR_fallocate 324 333 | #define __NR_timerfd_settime 325 334 | #define __NR_timerfd_gettime 326 335 | #define __NR_signalfd4 327 336 | #define __NR_eventfd2 328 337 | #define __NR_epoll_create1 329 338 | #define __NR_dup3 330 339 | #define __NR_pipe2 331 340 | #define __NR_inotify_init1 332 341 | #define __NR_preadv 333 342 | #define __NR_pwritev 334 343 | #define __NR_rt_tgsigqueueinfo 335 344 | #define __NR_perf_event_open 336 345 | #define __NR_recvmmsg 337 346 | #define __NR_fanotify_init 338 347 | #define __NR_fanotify_mark 339 348 | #define __NR_prlimit64 340 349 | #define __NR_name_to_handle_at 341 350 | #define __NR_open_by_handle_at 342 351 | #define __NR_clock_adjtime 343 352 | #define __NR_syncfs 344 353 | #define __NR_sendmmsg 345 354 | #define __NR_setns 346 355 | #define __NR_process_vm_readv 347 356 | #define __NR_process_vm_writev 348 357 | #define __NR_sys_yfkm2_monitor 349 358 | #define __NR_sys_yfkm2_notifyme 350 359 | 360 | #ifdef __KERNEL__ 361 | 362 | #define NR_syscalls 351 363 | 364 | #define __ARCH_WANT_IPC_PARSE_VERSION 365 | #define __ARCH_WANT_OLD_READDIR 366 | #define __ARCH_WANT_OLD_STAT 367 | #define __ARCH_WANT_STAT64 368 | #define __ARCH_WANT_SYS_ALARM 369 | #define __ARCH_WANT_SYS_GETHOSTNAME 370 | #define __ARCH_WANT_SYS_IPC 371 | #define __ARCH_WANT_SYS_PAUSE 372 | #define __ARCH_WANT_SYS_SGETMASK 373 | #define __ARCH_WANT_SYS_SIGNAL 374 | #define __ARCH_WANT_SYS_TIME 375 | #define __ARCH_WANT_SYS_UTIME 376 | #define __ARCH_WANT_SYS_WAITPID 377 | #define __ARCH_WANT_SYS_SOCKETCALL 378 | #define __ARCH_WANT_SYS_FADVISE64 379 | #define __ARCH_WANT_SYS_GETPGRP 380 | #define __ARCH_WANT_SYS_LLSEEK 381 | #define __ARCH_WANT_SYS_NICE 382 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT 383 | #define __ARCH_WANT_SYS_OLD_UNAME 384 | #define __ARCH_WANT_SYS_OLD_MMAP 385 | #define __ARCH_WANT_SYS_OLD_SELECT 386 | #define __ARCH_WANT_SYS_OLDUMOUNT 387 | #define __ARCH_WANT_SYS_SIGPENDING 388 | #define __ARCH_WANT_SYS_SIGPROCMASK 389 | #define __ARCH_WANT_SYS_RT_SIGACTION 390 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND 391 | 392 | /* 393 | * "Conditional" syscalls 394 | * 395 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 396 | * but it doesn't work on all toolchains, so we just do it by hand 397 | */ 398 | #ifndef cond_syscall 399 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 400 | #endif 401 | 402 | #endif /* __KERNEL__ */ 403 | #endif /* _ASM_X86_UNISTD_32_H */ 404 | -------------------------------------------------------------------------------- /yfkm2/source/2.6.42.7-1.fc15/arch/x86/include/asm/unistd_64.h: -------------------------------------------------------------------------------- 1 | #ifndef _ASM_X86_UNISTD_64_H 2 | #define _ASM_X86_UNISTD_64_H 3 | 4 | #ifndef __SYSCALL 5 | #define __SYSCALL(a, b) 6 | #endif 7 | 8 | /* 9 | * This file contains the system call numbers. 10 | * 11 | * Note: holes are not allowed. 12 | */ 13 | 14 | /* at least 8 syscall per cacheline */ 15 | #define __NR_read 0 16 | __SYSCALL(__NR_read, sys_read) 17 | #define __NR_write 1 18 | __SYSCALL(__NR_write, sys_write) 19 | #define __NR_open 2 20 | __SYSCALL(__NR_open, sys_open) 21 | #define __NR_close 3 22 | __SYSCALL(__NR_close, sys_close) 23 | #define __NR_stat 4 24 | __SYSCALL(__NR_stat, sys_newstat) 25 | #define __NR_fstat 5 26 | __SYSCALL(__NR_fstat, sys_newfstat) 27 | #define __NR_lstat 6 28 | __SYSCALL(__NR_lstat, sys_newlstat) 29 | #define __NR_poll 7 30 | __SYSCALL(__NR_poll, sys_poll) 31 | 32 | #define __NR_lseek 8 33 | __SYSCALL(__NR_lseek, sys_lseek) 34 | #define __NR_mmap 9 35 | __SYSCALL(__NR_mmap, sys_mmap) 36 | #define __NR_mprotect 10 37 | __SYSCALL(__NR_mprotect, sys_mprotect) 38 | #define __NR_munmap 11 39 | __SYSCALL(__NR_munmap, sys_munmap) 40 | #define __NR_brk 12 41 | __SYSCALL(__NR_brk, sys_brk) 42 | #define __NR_rt_sigaction 13 43 | __SYSCALL(__NR_rt_sigaction, sys_rt_sigaction) 44 | #define __NR_rt_sigprocmask 14 45 | __SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask) 46 | #define __NR_rt_sigreturn 15 47 | __SYSCALL(__NR_rt_sigreturn, stub_rt_sigreturn) 48 | 49 | #define __NR_ioctl 16 50 | __SYSCALL(__NR_ioctl, sys_ioctl) 51 | #define __NR_pread64 17 52 | __SYSCALL(__NR_pread64, sys_pread64) 53 | #define __NR_pwrite64 18 54 | __SYSCALL(__NR_pwrite64, sys_pwrite64) 55 | #define __NR_readv 19 56 | __SYSCALL(__NR_readv, sys_readv) 57 | #define __NR_writev 20 58 | __SYSCALL(__NR_writev, sys_writev) 59 | #define __NR_access 21 60 | __SYSCALL(__NR_access, sys_access) 61 | #define __NR_pipe 22 62 | __SYSCALL(__NR_pipe, sys_pipe) 63 | #define __NR_select 23 64 | __SYSCALL(__NR_select, sys_select) 65 | 66 | #define __NR_sched_yield 24 67 | __SYSCALL(__NR_sched_yield, sys_sched_yield) 68 | #define __NR_mremap 25 69 | __SYSCALL(__NR_mremap, sys_mremap) 70 | #define __NR_msync 26 71 | __SYSCALL(__NR_msync, sys_msync) 72 | #define __NR_mincore 27 73 | __SYSCALL(__NR_mincore, sys_mincore) 74 | #define __NR_madvise 28 75 | __SYSCALL(__NR_madvise, sys_madvise) 76 | #define __NR_shmget 29 77 | __SYSCALL(__NR_shmget, sys_shmget) 78 | #define __NR_shmat 30 79 | __SYSCALL(__NR_shmat, sys_shmat) 80 | #define __NR_shmctl 31 81 | __SYSCALL(__NR_shmctl, sys_shmctl) 82 | 83 | #define __NR_dup 32 84 | __SYSCALL(__NR_dup, sys_dup) 85 | #define __NR_dup2 33 86 | __SYSCALL(__NR_dup2, sys_dup2) 87 | #define __NR_pause 34 88 | __SYSCALL(__NR_pause, sys_pause) 89 | #define __NR_nanosleep 35 90 | __SYSCALL(__NR_nanosleep, sys_nanosleep) 91 | #define __NR_getitimer 36 92 | __SYSCALL(__NR_getitimer, sys_getitimer) 93 | #define __NR_alarm 37 94 | __SYSCALL(__NR_alarm, sys_alarm) 95 | #define __NR_setitimer 38 96 | __SYSCALL(__NR_setitimer, sys_setitimer) 97 | #define __NR_getpid 39 98 | __SYSCALL(__NR_getpid, sys_getpid) 99 | 100 | #define __NR_sendfile 40 101 | __SYSCALL(__NR_sendfile, sys_sendfile64) 102 | #define __NR_socket 41 103 | __SYSCALL(__NR_socket, sys_socket) 104 | #define __NR_connect 42 105 | __SYSCALL(__NR_connect, sys_connect) 106 | #define __NR_accept 43 107 | __SYSCALL(__NR_accept, sys_accept) 108 | #define __NR_sendto 44 109 | __SYSCALL(__NR_sendto, sys_sendto) 110 | #define __NR_recvfrom 45 111 | __SYSCALL(__NR_recvfrom, sys_recvfrom) 112 | #define __NR_sendmsg 46 113 | __SYSCALL(__NR_sendmsg, sys_sendmsg) 114 | #define __NR_recvmsg 47 115 | __SYSCALL(__NR_recvmsg, sys_recvmsg) 116 | 117 | #define __NR_shutdown 48 118 | __SYSCALL(__NR_shutdown, sys_shutdown) 119 | #define __NR_bind 49 120 | __SYSCALL(__NR_bind, sys_bind) 121 | #define __NR_listen 50 122 | __SYSCALL(__NR_listen, sys_listen) 123 | #define __NR_getsockname 51 124 | __SYSCALL(__NR_getsockname, sys_getsockname) 125 | #define __NR_getpeername 52 126 | __SYSCALL(__NR_getpeername, sys_getpeername) 127 | #define __NR_socketpair 53 128 | __SYSCALL(__NR_socketpair, sys_socketpair) 129 | #define __NR_setsockopt 54 130 | __SYSCALL(__NR_setsockopt, sys_setsockopt) 131 | #define __NR_getsockopt 55 132 | __SYSCALL(__NR_getsockopt, sys_getsockopt) 133 | 134 | #define __NR_clone 56 135 | __SYSCALL(__NR_clone, stub_clone) 136 | #define __NR_fork 57 137 | __SYSCALL(__NR_fork, stub_fork) 138 | #define __NR_vfork 58 139 | __SYSCALL(__NR_vfork, stub_vfork) 140 | #define __NR_execve 59 141 | __SYSCALL(__NR_execve, stub_execve) 142 | #define __NR_exit 60 143 | __SYSCALL(__NR_exit, sys_exit) 144 | #define __NR_wait4 61 145 | __SYSCALL(__NR_wait4, sys_wait4) 146 | #define __NR_kill 62 147 | __SYSCALL(__NR_kill, sys_kill) 148 | #define __NR_uname 63 149 | __SYSCALL(__NR_uname, sys_newuname) 150 | 151 | #define __NR_semget 64 152 | __SYSCALL(__NR_semget, sys_semget) 153 | #define __NR_semop 65 154 | __SYSCALL(__NR_semop, sys_semop) 155 | #define __NR_semctl 66 156 | __SYSCALL(__NR_semctl, sys_semctl) 157 | #define __NR_shmdt 67 158 | __SYSCALL(__NR_shmdt, sys_shmdt) 159 | #define __NR_msgget 68 160 | __SYSCALL(__NR_msgget, sys_msgget) 161 | #define __NR_msgsnd 69 162 | __SYSCALL(__NR_msgsnd, sys_msgsnd) 163 | #define __NR_msgrcv 70 164 | __SYSCALL(__NR_msgrcv, sys_msgrcv) 165 | #define __NR_msgctl 71 166 | __SYSCALL(__NR_msgctl, sys_msgctl) 167 | 168 | #define __NR_fcntl 72 169 | __SYSCALL(__NR_fcntl, sys_fcntl) 170 | #define __NR_flock 73 171 | __SYSCALL(__NR_flock, sys_flock) 172 | #define __NR_fsync 74 173 | __SYSCALL(__NR_fsync, sys_fsync) 174 | #define __NR_fdatasync 75 175 | __SYSCALL(__NR_fdatasync, sys_fdatasync) 176 | #define __NR_truncate 76 177 | __SYSCALL(__NR_truncate, sys_truncate) 178 | #define __NR_ftruncate 77 179 | __SYSCALL(__NR_ftruncate, sys_ftruncate) 180 | #define __NR_getdents 78 181 | __SYSCALL(__NR_getdents, sys_getdents) 182 | #define __NR_getcwd 79 183 | __SYSCALL(__NR_getcwd, sys_getcwd) 184 | 185 | #define __NR_chdir 80 186 | __SYSCALL(__NR_chdir, sys_chdir) 187 | #define __NR_fchdir 81 188 | __SYSCALL(__NR_fchdir, sys_fchdir) 189 | #define __NR_rename 82 190 | __SYSCALL(__NR_rename, sys_rename) 191 | #define __NR_mkdir 83 192 | __SYSCALL(__NR_mkdir, sys_mkdir) 193 | #define __NR_rmdir 84 194 | __SYSCALL(__NR_rmdir, sys_rmdir) 195 | #define __NR_creat 85 196 | __SYSCALL(__NR_creat, sys_creat) 197 | #define __NR_link 86 198 | __SYSCALL(__NR_link, sys_link) 199 | #define __NR_unlink 87 200 | __SYSCALL(__NR_unlink, sys_unlink) 201 | 202 | #define __NR_symlink 88 203 | __SYSCALL(__NR_symlink, sys_symlink) 204 | #define __NR_readlink 89 205 | __SYSCALL(__NR_readlink, sys_readlink) 206 | #define __NR_chmod 90 207 | __SYSCALL(__NR_chmod, sys_chmod) 208 | #define __NR_fchmod 91 209 | __SYSCALL(__NR_fchmod, sys_fchmod) 210 | #define __NR_chown 92 211 | __SYSCALL(__NR_chown, sys_chown) 212 | #define __NR_fchown 93 213 | __SYSCALL(__NR_fchown, sys_fchown) 214 | #define __NR_lchown 94 215 | __SYSCALL(__NR_lchown, sys_lchown) 216 | #define __NR_umask 95 217 | __SYSCALL(__NR_umask, sys_umask) 218 | 219 | #define __NR_gettimeofday 96 220 | __SYSCALL(__NR_gettimeofday, sys_gettimeofday) 221 | #define __NR_getrlimit 97 222 | __SYSCALL(__NR_getrlimit, sys_getrlimit) 223 | #define __NR_getrusage 98 224 | __SYSCALL(__NR_getrusage, sys_getrusage) 225 | #define __NR_sysinfo 99 226 | __SYSCALL(__NR_sysinfo, sys_sysinfo) 227 | #define __NR_times 100 228 | __SYSCALL(__NR_times, sys_times) 229 | #define __NR_ptrace 101 230 | __SYSCALL(__NR_ptrace, sys_ptrace) 231 | #define __NR_getuid 102 232 | __SYSCALL(__NR_getuid, sys_getuid) 233 | #define __NR_syslog 103 234 | __SYSCALL(__NR_syslog, sys_syslog) 235 | 236 | /* at the very end the stuff that never runs during the benchmarks */ 237 | #define __NR_getgid 104 238 | __SYSCALL(__NR_getgid, sys_getgid) 239 | #define __NR_setuid 105 240 | __SYSCALL(__NR_setuid, sys_setuid) 241 | #define __NR_setgid 106 242 | __SYSCALL(__NR_setgid, sys_setgid) 243 | #define __NR_geteuid 107 244 | __SYSCALL(__NR_geteuid, sys_geteuid) 245 | #define __NR_getegid 108 246 | __SYSCALL(__NR_getegid, sys_getegid) 247 | #define __NR_setpgid 109 248 | __SYSCALL(__NR_setpgid, sys_setpgid) 249 | #define __NR_getppid 110 250 | __SYSCALL(__NR_getppid, sys_getppid) 251 | #define __NR_getpgrp 111 252 | __SYSCALL(__NR_getpgrp, sys_getpgrp) 253 | 254 | #define __NR_setsid 112 255 | __SYSCALL(__NR_setsid, sys_setsid) 256 | #define __NR_setreuid 113 257 | __SYSCALL(__NR_setreuid, sys_setreuid) 258 | #define __NR_setregid 114 259 | __SYSCALL(__NR_setregid, sys_setregid) 260 | #define __NR_getgroups 115 261 | __SYSCALL(__NR_getgroups, sys_getgroups) 262 | #define __NR_setgroups 116 263 | __SYSCALL(__NR_setgroups, sys_setgroups) 264 | #define __NR_setresuid 117 265 | __SYSCALL(__NR_setresuid, sys_setresuid) 266 | #define __NR_getresuid 118 267 | __SYSCALL(__NR_getresuid, sys_getresuid) 268 | #define __NR_setresgid 119 269 | __SYSCALL(__NR_setresgid, sys_setresgid) 270 | 271 | #define __NR_getresgid 120 272 | __SYSCALL(__NR_getresgid, sys_getresgid) 273 | #define __NR_getpgid 121 274 | __SYSCALL(__NR_getpgid, sys_getpgid) 275 | #define __NR_setfsuid 122 276 | __SYSCALL(__NR_setfsuid, sys_setfsuid) 277 | #define __NR_setfsgid 123 278 | __SYSCALL(__NR_setfsgid, sys_setfsgid) 279 | #define __NR_getsid 124 280 | __SYSCALL(__NR_getsid, sys_getsid) 281 | #define __NR_capget 125 282 | __SYSCALL(__NR_capget, sys_capget) 283 | #define __NR_capset 126 284 | __SYSCALL(__NR_capset, sys_capset) 285 | 286 | #define __NR_rt_sigpending 127 287 | __SYSCALL(__NR_rt_sigpending, sys_rt_sigpending) 288 | #define __NR_rt_sigtimedwait 128 289 | __SYSCALL(__NR_rt_sigtimedwait, sys_rt_sigtimedwait) 290 | #define __NR_rt_sigqueueinfo 129 291 | __SYSCALL(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo) 292 | #define __NR_rt_sigsuspend 130 293 | __SYSCALL(__NR_rt_sigsuspend, sys_rt_sigsuspend) 294 | #define __NR_sigaltstack 131 295 | __SYSCALL(__NR_sigaltstack, stub_sigaltstack) 296 | #define __NR_utime 132 297 | __SYSCALL(__NR_utime, sys_utime) 298 | #define __NR_mknod 133 299 | __SYSCALL(__NR_mknod, sys_mknod) 300 | 301 | /* Only needed for a.out */ 302 | #define __NR_uselib 134 303 | __SYSCALL(__NR_uselib, sys_ni_syscall) 304 | #define __NR_personality 135 305 | __SYSCALL(__NR_personality, sys_personality) 306 | 307 | #define __NR_ustat 136 308 | __SYSCALL(__NR_ustat, sys_ustat) 309 | #define __NR_statfs 137 310 | __SYSCALL(__NR_statfs, sys_statfs) 311 | #define __NR_fstatfs 138 312 | __SYSCALL(__NR_fstatfs, sys_fstatfs) 313 | #define __NR_sysfs 139 314 | __SYSCALL(__NR_sysfs, sys_sysfs) 315 | 316 | #define __NR_getpriority 140 317 | __SYSCALL(__NR_getpriority, sys_getpriority) 318 | #define __NR_setpriority 141 319 | __SYSCALL(__NR_setpriority, sys_setpriority) 320 | #define __NR_sched_setparam 142 321 | __SYSCALL(__NR_sched_setparam, sys_sched_setparam) 322 | #define __NR_sched_getparam 143 323 | __SYSCALL(__NR_sched_getparam, sys_sched_getparam) 324 | #define __NR_sched_setscheduler 144 325 | __SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler) 326 | #define __NR_sched_getscheduler 145 327 | __SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler) 328 | #define __NR_sched_get_priority_max 146 329 | __SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max) 330 | #define __NR_sched_get_priority_min 147 331 | __SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min) 332 | #define __NR_sched_rr_get_interval 148 333 | __SYSCALL(__NR_sched_rr_get_interval, sys_sched_rr_get_interval) 334 | 335 | #define __NR_mlock 149 336 | __SYSCALL(__NR_mlock, sys_mlock) 337 | #define __NR_munlock 150 338 | __SYSCALL(__NR_munlock, sys_munlock) 339 | #define __NR_mlockall 151 340 | __SYSCALL(__NR_mlockall, sys_mlockall) 341 | #define __NR_munlockall 152 342 | __SYSCALL(__NR_munlockall, sys_munlockall) 343 | 344 | #define __NR_vhangup 153 345 | __SYSCALL(__NR_vhangup, sys_vhangup) 346 | 347 | #define __NR_modify_ldt 154 348 | __SYSCALL(__NR_modify_ldt, sys_modify_ldt) 349 | 350 | #define __NR_pivot_root 155 351 | __SYSCALL(__NR_pivot_root, sys_pivot_root) 352 | 353 | #define __NR__sysctl 156 354 | __SYSCALL(__NR__sysctl, sys_sysctl) 355 | 356 | #define __NR_prctl 157 357 | __SYSCALL(__NR_prctl, sys_prctl) 358 | #define __NR_arch_prctl 158 359 | __SYSCALL(__NR_arch_prctl, sys_arch_prctl) 360 | 361 | #define __NR_adjtimex 159 362 | __SYSCALL(__NR_adjtimex, sys_adjtimex) 363 | 364 | #define __NR_setrlimit 160 365 | __SYSCALL(__NR_setrlimit, sys_setrlimit) 366 | 367 | #define __NR_chroot 161 368 | __SYSCALL(__NR_chroot, sys_chroot) 369 | 370 | #define __NR_sync 162 371 | __SYSCALL(__NR_sync, sys_sync) 372 | 373 | #define __NR_acct 163 374 | __SYSCALL(__NR_acct, sys_acct) 375 | 376 | #define __NR_settimeofday 164 377 | __SYSCALL(__NR_settimeofday, sys_settimeofday) 378 | 379 | #define __NR_mount 165 380 | __SYSCALL(__NR_mount, sys_mount) 381 | #define __NR_umount2 166 382 | __SYSCALL(__NR_umount2, sys_umount) 383 | 384 | #define __NR_swapon 167 385 | __SYSCALL(__NR_swapon, sys_swapon) 386 | #define __NR_swapoff 168 387 | __SYSCALL(__NR_swapoff, sys_swapoff) 388 | 389 | #define __NR_reboot 169 390 | __SYSCALL(__NR_reboot, sys_reboot) 391 | 392 | #define __NR_sethostname 170 393 | __SYSCALL(__NR_sethostname, sys_sethostname) 394 | #define __NR_setdomainname 171 395 | __SYSCALL(__NR_setdomainname, sys_setdomainname) 396 | 397 | #define __NR_iopl 172 398 | __SYSCALL(__NR_iopl, stub_iopl) 399 | #define __NR_ioperm 173 400 | __SYSCALL(__NR_ioperm, sys_ioperm) 401 | 402 | #define __NR_create_module 174 403 | __SYSCALL(__NR_create_module, sys_ni_syscall) 404 | #define __NR_init_module 175 405 | __SYSCALL(__NR_init_module, sys_init_module) 406 | #define __NR_delete_module 176 407 | __SYSCALL(__NR_delete_module, sys_delete_module) 408 | #define __NR_get_kernel_syms 177 409 | __SYSCALL(__NR_get_kernel_syms, sys_ni_syscall) 410 | #define __NR_query_module 178 411 | __SYSCALL(__NR_query_module, sys_ni_syscall) 412 | 413 | #define __NR_quotactl 179 414 | __SYSCALL(__NR_quotactl, sys_quotactl) 415 | 416 | #define __NR_nfsservctl 180 417 | __SYSCALL(__NR_nfsservctl, sys_ni_syscall) 418 | 419 | /* reserved for LiS/STREAMS */ 420 | #define __NR_getpmsg 181 421 | __SYSCALL(__NR_getpmsg, sys_ni_syscall) 422 | #define __NR_putpmsg 182 423 | __SYSCALL(__NR_putpmsg, sys_ni_syscall) 424 | 425 | /* reserved for AFS */ 426 | #define __NR_afs_syscall 183 427 | __SYSCALL(__NR_afs_syscall, sys_ni_syscall) 428 | 429 | /* reserved for tux */ 430 | #define __NR_tuxcall 184 431 | __SYSCALL(__NR_tuxcall, sys_ni_syscall) 432 | 433 | #define __NR_security 185 434 | __SYSCALL(__NR_security, sys_ni_syscall) 435 | 436 | #define __NR_gettid 186 437 | __SYSCALL(__NR_gettid, sys_gettid) 438 | 439 | #define __NR_readahead 187 440 | __SYSCALL(__NR_readahead, sys_readahead) 441 | #define __NR_setxattr 188 442 | __SYSCALL(__NR_setxattr, sys_setxattr) 443 | #define __NR_lsetxattr 189 444 | __SYSCALL(__NR_lsetxattr, sys_lsetxattr) 445 | #define __NR_fsetxattr 190 446 | __SYSCALL(__NR_fsetxattr, sys_fsetxattr) 447 | #define __NR_getxattr 191 448 | __SYSCALL(__NR_getxattr, sys_getxattr) 449 | #define __NR_lgetxattr 192 450 | __SYSCALL(__NR_lgetxattr, sys_lgetxattr) 451 | #define __NR_fgetxattr 193 452 | __SYSCALL(__NR_fgetxattr, sys_fgetxattr) 453 | #define __NR_listxattr 194 454 | __SYSCALL(__NR_listxattr, sys_listxattr) 455 | #define __NR_llistxattr 195 456 | __SYSCALL(__NR_llistxattr, sys_llistxattr) 457 | #define __NR_flistxattr 196 458 | __SYSCALL(__NR_flistxattr, sys_flistxattr) 459 | #define __NR_removexattr 197 460 | __SYSCALL(__NR_removexattr, sys_removexattr) 461 | #define __NR_lremovexattr 198 462 | __SYSCALL(__NR_lremovexattr, sys_lremovexattr) 463 | #define __NR_fremovexattr 199 464 | __SYSCALL(__NR_fremovexattr, sys_fremovexattr) 465 | #define __NR_tkill 200 466 | __SYSCALL(__NR_tkill, sys_tkill) 467 | #define __NR_time 201 468 | __SYSCALL(__NR_time, sys_time) 469 | #define __NR_futex 202 470 | __SYSCALL(__NR_futex, sys_futex) 471 | #define __NR_sched_setaffinity 203 472 | __SYSCALL(__NR_sched_setaffinity, sys_sched_setaffinity) 473 | #define __NR_sched_getaffinity 204 474 | __SYSCALL(__NR_sched_getaffinity, sys_sched_getaffinity) 475 | #define __NR_set_thread_area 205 476 | __SYSCALL(__NR_set_thread_area, sys_ni_syscall) /* use arch_prctl */ 477 | #define __NR_io_setup 206 478 | __SYSCALL(__NR_io_setup, sys_io_setup) 479 | #define __NR_io_destroy 207 480 | __SYSCALL(__NR_io_destroy, sys_io_destroy) 481 | #define __NR_io_getevents 208 482 | __SYSCALL(__NR_io_getevents, sys_io_getevents) 483 | #define __NR_io_submit 209 484 | __SYSCALL(__NR_io_submit, sys_io_submit) 485 | #define __NR_io_cancel 210 486 | __SYSCALL(__NR_io_cancel, sys_io_cancel) 487 | #define __NR_get_thread_area 211 488 | __SYSCALL(__NR_get_thread_area, sys_ni_syscall) /* use arch_prctl */ 489 | #define __NR_lookup_dcookie 212 490 | __SYSCALL(__NR_lookup_dcookie, sys_lookup_dcookie) 491 | #define __NR_epoll_create 213 492 | __SYSCALL(__NR_epoll_create, sys_epoll_create) 493 | #define __NR_epoll_ctl_old 214 494 | __SYSCALL(__NR_epoll_ctl_old, sys_ni_syscall) 495 | #define __NR_epoll_wait_old 215 496 | __SYSCALL(__NR_epoll_wait_old, sys_ni_syscall) 497 | #define __NR_remap_file_pages 216 498 | __SYSCALL(__NR_remap_file_pages, sys_remap_file_pages) 499 | #define __NR_getdents64 217 500 | __SYSCALL(__NR_getdents64, sys_getdents64) 501 | #define __NR_set_tid_address 218 502 | __SYSCALL(__NR_set_tid_address, sys_set_tid_address) 503 | #define __NR_restart_syscall 219 504 | __SYSCALL(__NR_restart_syscall, sys_restart_syscall) 505 | #define __NR_semtimedop 220 506 | __SYSCALL(__NR_semtimedop, sys_semtimedop) 507 | #define __NR_fadvise64 221 508 | __SYSCALL(__NR_fadvise64, sys_fadvise64) 509 | #define __NR_timer_create 222 510 | __SYSCALL(__NR_timer_create, sys_timer_create) 511 | #define __NR_timer_settime 223 512 | __SYSCALL(__NR_timer_settime, sys_timer_settime) 513 | #define __NR_timer_gettime 224 514 | __SYSCALL(__NR_timer_gettime, sys_timer_gettime) 515 | #define __NR_timer_getoverrun 225 516 | __SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun) 517 | #define __NR_timer_delete 226 518 | __SYSCALL(__NR_timer_delete, sys_timer_delete) 519 | #define __NR_clock_settime 227 520 | __SYSCALL(__NR_clock_settime, sys_clock_settime) 521 | #define __NR_clock_gettime 228 522 | __SYSCALL(__NR_clock_gettime, sys_clock_gettime) 523 | #define __NR_clock_getres 229 524 | __SYSCALL(__NR_clock_getres, sys_clock_getres) 525 | #define __NR_clock_nanosleep 230 526 | __SYSCALL(__NR_clock_nanosleep, sys_clock_nanosleep) 527 | #define __NR_exit_group 231 528 | __SYSCALL(__NR_exit_group, sys_exit_group) 529 | #define __NR_epoll_wait 232 530 | __SYSCALL(__NR_epoll_wait, sys_epoll_wait) 531 | #define __NR_epoll_ctl 233 532 | __SYSCALL(__NR_epoll_ctl, sys_epoll_ctl) 533 | #define __NR_tgkill 234 534 | __SYSCALL(__NR_tgkill, sys_tgkill) 535 | #define __NR_utimes 235 536 | __SYSCALL(__NR_utimes, sys_utimes) 537 | #define __NR_vserver 236 538 | __SYSCALL(__NR_vserver, sys_ni_syscall) 539 | #define __NR_mbind 237 540 | __SYSCALL(__NR_mbind, sys_mbind) 541 | #define __NR_set_mempolicy 238 542 | __SYSCALL(__NR_set_mempolicy, sys_set_mempolicy) 543 | #define __NR_get_mempolicy 239 544 | __SYSCALL(__NR_get_mempolicy, sys_get_mempolicy) 545 | #define __NR_mq_open 240 546 | __SYSCALL(__NR_mq_open, sys_mq_open) 547 | #define __NR_mq_unlink 241 548 | __SYSCALL(__NR_mq_unlink, sys_mq_unlink) 549 | #define __NR_mq_timedsend 242 550 | __SYSCALL(__NR_mq_timedsend, sys_mq_timedsend) 551 | #define __NR_mq_timedreceive 243 552 | __SYSCALL(__NR_mq_timedreceive, sys_mq_timedreceive) 553 | #define __NR_mq_notify 244 554 | __SYSCALL(__NR_mq_notify, sys_mq_notify) 555 | #define __NR_mq_getsetattr 245 556 | __SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr) 557 | #define __NR_kexec_load 246 558 | __SYSCALL(__NR_kexec_load, sys_kexec_load) 559 | #define __NR_waitid 247 560 | __SYSCALL(__NR_waitid, sys_waitid) 561 | #define __NR_add_key 248 562 | __SYSCALL(__NR_add_key, sys_add_key) 563 | #define __NR_request_key 249 564 | __SYSCALL(__NR_request_key, sys_request_key) 565 | #define __NR_keyctl 250 566 | __SYSCALL(__NR_keyctl, sys_keyctl) 567 | #define __NR_ioprio_set 251 568 | __SYSCALL(__NR_ioprio_set, sys_ioprio_set) 569 | #define __NR_ioprio_get 252 570 | __SYSCALL(__NR_ioprio_get, sys_ioprio_get) 571 | #define __NR_inotify_init 253 572 | __SYSCALL(__NR_inotify_init, sys_inotify_init) 573 | #define __NR_inotify_add_watch 254 574 | __SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch) 575 | #define __NR_inotify_rm_watch 255 576 | __SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch) 577 | #define __NR_migrate_pages 256 578 | __SYSCALL(__NR_migrate_pages, sys_migrate_pages) 579 | #define __NR_openat 257 580 | __SYSCALL(__NR_openat, sys_openat) 581 | #define __NR_mkdirat 258 582 | __SYSCALL(__NR_mkdirat, sys_mkdirat) 583 | #define __NR_mknodat 259 584 | __SYSCALL(__NR_mknodat, sys_mknodat) 585 | #define __NR_fchownat 260 586 | __SYSCALL(__NR_fchownat, sys_fchownat) 587 | #define __NR_futimesat 261 588 | __SYSCALL(__NR_futimesat, sys_futimesat) 589 | #define __NR_newfstatat 262 590 | __SYSCALL(__NR_newfstatat, sys_newfstatat) 591 | #define __NR_unlinkat 263 592 | __SYSCALL(__NR_unlinkat, sys_unlinkat) 593 | #define __NR_renameat 264 594 | __SYSCALL(__NR_renameat, sys_renameat) 595 | #define __NR_linkat 265 596 | __SYSCALL(__NR_linkat, sys_linkat) 597 | #define __NR_symlinkat 266 598 | __SYSCALL(__NR_symlinkat, sys_symlinkat) 599 | #define __NR_readlinkat 267 600 | __SYSCALL(__NR_readlinkat, sys_readlinkat) 601 | #define __NR_fchmodat 268 602 | __SYSCALL(__NR_fchmodat, sys_fchmodat) 603 | #define __NR_faccessat 269 604 | __SYSCALL(__NR_faccessat, sys_faccessat) 605 | #define __NR_pselect6 270 606 | __SYSCALL(__NR_pselect6, sys_pselect6) 607 | #define __NR_ppoll 271 608 | __SYSCALL(__NR_ppoll, sys_ppoll) 609 | #define __NR_unshare 272 610 | __SYSCALL(__NR_unshare, sys_unshare) 611 | #define __NR_set_robust_list 273 612 | __SYSCALL(__NR_set_robust_list, sys_set_robust_list) 613 | #define __NR_get_robust_list 274 614 | __SYSCALL(__NR_get_robust_list, sys_get_robust_list) 615 | #define __NR_splice 275 616 | __SYSCALL(__NR_splice, sys_splice) 617 | #define __NR_tee 276 618 | __SYSCALL(__NR_tee, sys_tee) 619 | #define __NR_sync_file_range 277 620 | __SYSCALL(__NR_sync_file_range, sys_sync_file_range) 621 | #define __NR_vmsplice 278 622 | __SYSCALL(__NR_vmsplice, sys_vmsplice) 623 | #define __NR_move_pages 279 624 | __SYSCALL(__NR_move_pages, sys_move_pages) 625 | #define __NR_utimensat 280 626 | __SYSCALL(__NR_utimensat, sys_utimensat) 627 | #define __NR_epoll_pwait 281 628 | __SYSCALL(__NR_epoll_pwait, sys_epoll_pwait) 629 | #define __NR_signalfd 282 630 | __SYSCALL(__NR_signalfd, sys_signalfd) 631 | #define __NR_timerfd_create 283 632 | __SYSCALL(__NR_timerfd_create, sys_timerfd_create) 633 | #define __NR_eventfd 284 634 | __SYSCALL(__NR_eventfd, sys_eventfd) 635 | #define __NR_fallocate 285 636 | __SYSCALL(__NR_fallocate, sys_fallocate) 637 | #define __NR_timerfd_settime 286 638 | __SYSCALL(__NR_timerfd_settime, sys_timerfd_settime) 639 | #define __NR_timerfd_gettime 287 640 | __SYSCALL(__NR_timerfd_gettime, sys_timerfd_gettime) 641 | #define __NR_accept4 288 642 | __SYSCALL(__NR_accept4, sys_accept4) 643 | #define __NR_signalfd4 289 644 | __SYSCALL(__NR_signalfd4, sys_signalfd4) 645 | #define __NR_eventfd2 290 646 | __SYSCALL(__NR_eventfd2, sys_eventfd2) 647 | #define __NR_epoll_create1 291 648 | __SYSCALL(__NR_epoll_create1, sys_epoll_create1) 649 | #define __NR_dup3 292 650 | __SYSCALL(__NR_dup3, sys_dup3) 651 | #define __NR_pipe2 293 652 | __SYSCALL(__NR_pipe2, sys_pipe2) 653 | #define __NR_inotify_init1 294 654 | __SYSCALL(__NR_inotify_init1, sys_inotify_init1) 655 | #define __NR_preadv 295 656 | __SYSCALL(__NR_preadv, sys_preadv) 657 | #define __NR_pwritev 296 658 | __SYSCALL(__NR_pwritev, sys_pwritev) 659 | #define __NR_rt_tgsigqueueinfo 297 660 | __SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo) 661 | #define __NR_perf_event_open 298 662 | __SYSCALL(__NR_perf_event_open, sys_perf_event_open) 663 | #define __NR_recvmmsg 299 664 | __SYSCALL(__NR_recvmmsg, sys_recvmmsg) 665 | #define __NR_fanotify_init 300 666 | __SYSCALL(__NR_fanotify_init, sys_fanotify_init) 667 | #define __NR_fanotify_mark 301 668 | __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) 669 | #define __NR_prlimit64 302 670 | __SYSCALL(__NR_prlimit64, sys_prlimit64) 671 | #define __NR_name_to_handle_at 303 672 | __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) 673 | #define __NR_open_by_handle_at 304 674 | __SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) 675 | #define __NR_clock_adjtime 305 676 | __SYSCALL(__NR_clock_adjtime, sys_clock_adjtime) 677 | #define __NR_syncfs 306 678 | __SYSCALL(__NR_syncfs, sys_syncfs) 679 | #define __NR_sendmmsg 307 680 | __SYSCALL(__NR_sendmmsg, sys_sendmmsg) 681 | #define __NR_setns 308 682 | __SYSCALL(__NR_setns, sys_setns) 683 | #define __NR_getcpu 309 684 | __SYSCALL(__NR_getcpu, sys_getcpu) 685 | #define __NR_process_vm_readv 310 686 | __SYSCALL(__NR_process_vm_readv, sys_process_vm_readv) 687 | #define __NR_process_vm_writev 311 688 | __SYSCALL(__NR_process_vm_writev, sys_process_vm_writev) 689 | #define __NR_yfkm2_monitor 312 690 | __SYSCALL(__NR_yfkm2_monitor, sys_yfkm2_monitor) 691 | #define __NR_yfkm2_notifyme 313 692 | __SYSCALL(__NR_yfkm2_notifyme, sys_yfkm2_notifyme) 693 | 694 | #ifndef __NO_STUBS 695 | #define __ARCH_WANT_OLD_READDIR 696 | #define __ARCH_WANT_OLD_STAT 697 | #define __ARCH_WANT_SYS_ALARM 698 | #define __ARCH_WANT_SYS_GETHOSTNAME 699 | #define __ARCH_WANT_SYS_PAUSE 700 | #define __ARCH_WANT_SYS_SGETMASK 701 | #define __ARCH_WANT_SYS_SIGNAL 702 | #define __ARCH_WANT_SYS_UTIME 703 | #define __ARCH_WANT_SYS_WAITPID 704 | #define __ARCH_WANT_SYS_SOCKETCALL 705 | #define __ARCH_WANT_SYS_FADVISE64 706 | #define __ARCH_WANT_SYS_GETPGRP 707 | #define __ARCH_WANT_SYS_LLSEEK 708 | #define __ARCH_WANT_SYS_NICE 709 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT 710 | #define __ARCH_WANT_SYS_OLD_UNAME 711 | #define __ARCH_WANT_SYS_OLDUMOUNT 712 | #define __ARCH_WANT_SYS_SIGPENDING 713 | #define __ARCH_WANT_SYS_SIGPROCMASK 714 | #define __ARCH_WANT_SYS_RT_SIGACTION 715 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND 716 | #define __ARCH_WANT_SYS_TIME 717 | #define __ARCH_WANT_COMPAT_SYS_TIME 718 | #endif /* __NO_STUBS */ 719 | 720 | #ifdef __KERNEL__ 721 | 722 | #ifndef COMPILE_OFFSETS 723 | #include 724 | #define NR_syscalls (__NR_syscall_max + 1) 725 | #endif 726 | 727 | /* 728 | * "Conditional" syscalls 729 | * 730 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 731 | * but it doesn't work on all toolchains, so we just do it by hand 732 | */ 733 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 734 | #endif /* __KERNEL__ */ 735 | 736 | #endif /* _ASM_X86_UNISTD_64_H */ 737 | -------------------------------------------------------------------------------- /yfkm2/source/2.6.42.7-1.fc15/arch/x86/kernel/syscall_table_32.S: -------------------------------------------------------------------------------- 1 | ENTRY(sys_call_table) 2 | .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */ 3 | .long sys_exit 4 | .long ptregs_fork 5 | .long sys_read 6 | .long sys_write 7 | .long sys_open /* 5 */ 8 | .long sys_close 9 | .long sys_waitpid 10 | .long sys_creat 11 | .long sys_link 12 | .long sys_unlink /* 10 */ 13 | .long ptregs_execve 14 | .long sys_chdir 15 | .long sys_time 16 | .long sys_mknod 17 | .long sys_chmod /* 15 */ 18 | .long sys_lchown16 19 | .long sys_ni_syscall /* old break syscall holder */ 20 | .long sys_stat 21 | .long sys_lseek 22 | .long sys_getpid /* 20 */ 23 | .long sys_mount 24 | .long sys_oldumount 25 | .long sys_setuid16 26 | .long sys_getuid16 27 | .long sys_stime /* 25 */ 28 | .long sys_ptrace 29 | .long sys_alarm 30 | .long sys_fstat 31 | .long sys_pause 32 | .long sys_utime /* 30 */ 33 | .long sys_ni_syscall /* old stty syscall holder */ 34 | .long sys_ni_syscall /* old gtty syscall holder */ 35 | .long sys_access 36 | .long sys_nice 37 | .long sys_ni_syscall /* 35 - old ftime syscall holder */ 38 | .long sys_sync 39 | .long sys_kill 40 | .long sys_rename 41 | .long sys_mkdir 42 | .long sys_rmdir /* 40 */ 43 | .long sys_dup 44 | .long sys_pipe 45 | .long sys_times 46 | .long sys_ni_syscall /* old prof syscall holder */ 47 | .long sys_brk /* 45 */ 48 | .long sys_setgid16 49 | .long sys_getgid16 50 | .long sys_signal 51 | .long sys_geteuid16 52 | .long sys_getegid16 /* 50 */ 53 | .long sys_acct 54 | .long sys_umount /* recycled never used phys() */ 55 | .long sys_ni_syscall /* old lock syscall holder */ 56 | .long sys_ioctl 57 | .long sys_fcntl /* 55 */ 58 | .long sys_ni_syscall /* old mpx syscall holder */ 59 | .long sys_setpgid 60 | .long sys_ni_syscall /* old ulimit syscall holder */ 61 | .long sys_olduname 62 | .long sys_umask /* 60 */ 63 | .long sys_chroot 64 | .long sys_ustat 65 | .long sys_dup2 66 | .long sys_getppid 67 | .long sys_getpgrp /* 65 */ 68 | .long sys_setsid 69 | .long sys_sigaction 70 | .long sys_sgetmask 71 | .long sys_ssetmask 72 | .long sys_setreuid16 /* 70 */ 73 | .long sys_setregid16 74 | .long sys_sigsuspend 75 | .long sys_sigpending 76 | .long sys_sethostname 77 | .long sys_setrlimit /* 75 */ 78 | .long sys_old_getrlimit 79 | .long sys_getrusage 80 | .long sys_gettimeofday 81 | .long sys_settimeofday 82 | .long sys_getgroups16 /* 80 */ 83 | .long sys_setgroups16 84 | .long sys_old_select 85 | .long sys_symlink 86 | .long sys_lstat 87 | .long sys_readlink /* 85 */ 88 | .long sys_uselib 89 | .long sys_swapon 90 | .long sys_reboot 91 | .long sys_old_readdir 92 | .long sys_old_mmap /* 90 */ 93 | .long sys_munmap 94 | .long sys_truncate 95 | .long sys_ftruncate 96 | .long sys_fchmod 97 | .long sys_fchown16 /* 95 */ 98 | .long sys_getpriority 99 | .long sys_setpriority 100 | .long sys_ni_syscall /* old profil syscall holder */ 101 | .long sys_statfs 102 | .long sys_fstatfs /* 100 */ 103 | .long sys_ioperm 104 | .long sys_socketcall 105 | .long sys_syslog 106 | .long sys_setitimer 107 | .long sys_getitimer /* 105 */ 108 | .long sys_newstat 109 | .long sys_newlstat 110 | .long sys_newfstat 111 | .long sys_uname 112 | .long ptregs_iopl /* 110 */ 113 | .long sys_vhangup 114 | .long sys_ni_syscall /* old "idle" system call */ 115 | .long ptregs_vm86old 116 | .long sys_wait4 117 | .long sys_swapoff /* 115 */ 118 | .long sys_sysinfo 119 | .long sys_ipc 120 | .long sys_fsync 121 | .long ptregs_sigreturn 122 | .long ptregs_clone /* 120 */ 123 | .long sys_setdomainname 124 | .long sys_newuname 125 | .long sys_modify_ldt 126 | .long sys_adjtimex 127 | .long sys_mprotect /* 125 */ 128 | .long sys_sigprocmask 129 | .long sys_ni_syscall /* old "create_module" */ 130 | .long sys_init_module 131 | .long sys_delete_module 132 | .long sys_ni_syscall /* 130: old "get_kernel_syms" */ 133 | .long sys_quotactl 134 | .long sys_getpgid 135 | .long sys_fchdir 136 | .long sys_bdflush 137 | .long sys_sysfs /* 135 */ 138 | .long sys_personality 139 | .long sys_ni_syscall /* reserved for afs_syscall */ 140 | .long sys_setfsuid16 141 | .long sys_setfsgid16 142 | .long sys_llseek /* 140 */ 143 | .long sys_getdents 144 | .long sys_select 145 | .long sys_flock 146 | .long sys_msync 147 | .long sys_readv /* 145 */ 148 | .long sys_writev 149 | .long sys_getsid 150 | .long sys_fdatasync 151 | .long sys_sysctl 152 | .long sys_mlock /* 150 */ 153 | .long sys_munlock 154 | .long sys_mlockall 155 | .long sys_munlockall 156 | .long sys_sched_setparam 157 | .long sys_sched_getparam /* 155 */ 158 | .long sys_sched_setscheduler 159 | .long sys_sched_getscheduler 160 | .long sys_sched_yield 161 | .long sys_sched_get_priority_max 162 | .long sys_sched_get_priority_min /* 160 */ 163 | .long sys_sched_rr_get_interval 164 | .long sys_nanosleep 165 | .long sys_mremap 166 | .long sys_setresuid16 167 | .long sys_getresuid16 /* 165 */ 168 | .long ptregs_vm86 169 | .long sys_ni_syscall /* Old sys_query_module */ 170 | .long sys_poll 171 | .long sys_ni_syscall /* Old nfsservctl */ 172 | .long sys_setresgid16 /* 170 */ 173 | .long sys_getresgid16 174 | .long sys_prctl 175 | .long ptregs_rt_sigreturn 176 | .long sys_rt_sigaction 177 | .long sys_rt_sigprocmask /* 175 */ 178 | .long sys_rt_sigpending 179 | .long sys_rt_sigtimedwait 180 | .long sys_rt_sigqueueinfo 181 | .long sys_rt_sigsuspend 182 | .long sys_pread64 /* 180 */ 183 | .long sys_pwrite64 184 | .long sys_chown16 185 | .long sys_getcwd 186 | .long sys_capget 187 | .long sys_capset /* 185 */ 188 | .long ptregs_sigaltstack 189 | .long sys_sendfile 190 | .long sys_ni_syscall /* reserved for streams1 */ 191 | .long sys_ni_syscall /* reserved for streams2 */ 192 | .long ptregs_vfork /* 190 */ 193 | .long sys_getrlimit 194 | .long sys_mmap_pgoff 195 | .long sys_truncate64 196 | .long sys_ftruncate64 197 | .long sys_stat64 /* 195 */ 198 | .long sys_lstat64 199 | .long sys_fstat64 200 | .long sys_lchown 201 | .long sys_getuid 202 | .long sys_getgid /* 200 */ 203 | .long sys_geteuid 204 | .long sys_getegid 205 | .long sys_setreuid 206 | .long sys_setregid 207 | .long sys_getgroups /* 205 */ 208 | .long sys_setgroups 209 | .long sys_fchown 210 | .long sys_setresuid 211 | .long sys_getresuid 212 | .long sys_setresgid /* 210 */ 213 | .long sys_getresgid 214 | .long sys_chown 215 | .long sys_setuid 216 | .long sys_setgid 217 | .long sys_setfsuid /* 215 */ 218 | .long sys_setfsgid 219 | .long sys_pivot_root 220 | .long sys_mincore 221 | .long sys_madvise 222 | .long sys_getdents64 /* 220 */ 223 | .long sys_fcntl64 224 | .long sys_ni_syscall /* reserved for TUX */ 225 | .long sys_ni_syscall 226 | .long sys_gettid 227 | .long sys_readahead /* 225 */ 228 | .long sys_setxattr 229 | .long sys_lsetxattr 230 | .long sys_fsetxattr 231 | .long sys_getxattr 232 | .long sys_lgetxattr /* 230 */ 233 | .long sys_fgetxattr 234 | .long sys_listxattr 235 | .long sys_llistxattr 236 | .long sys_flistxattr 237 | .long sys_removexattr /* 235 */ 238 | .long sys_lremovexattr 239 | .long sys_fremovexattr 240 | .long sys_tkill 241 | .long sys_sendfile64 242 | .long sys_futex /* 240 */ 243 | .long sys_sched_setaffinity 244 | .long sys_sched_getaffinity 245 | .long sys_set_thread_area 246 | .long sys_get_thread_area 247 | .long sys_io_setup /* 245 */ 248 | .long sys_io_destroy 249 | .long sys_io_getevents 250 | .long sys_io_submit 251 | .long sys_io_cancel 252 | .long sys_fadvise64 /* 250 */ 253 | .long sys_ni_syscall 254 | .long sys_exit_group 255 | .long sys_lookup_dcookie 256 | .long sys_epoll_create 257 | .long sys_epoll_ctl /* 255 */ 258 | .long sys_epoll_wait 259 | .long sys_remap_file_pages 260 | .long sys_set_tid_address 261 | .long sys_timer_create 262 | .long sys_timer_settime /* 260 */ 263 | .long sys_timer_gettime 264 | .long sys_timer_getoverrun 265 | .long sys_timer_delete 266 | .long sys_clock_settime 267 | .long sys_clock_gettime /* 265 */ 268 | .long sys_clock_getres 269 | .long sys_clock_nanosleep 270 | .long sys_statfs64 271 | .long sys_fstatfs64 272 | .long sys_tgkill /* 270 */ 273 | .long sys_utimes 274 | .long sys_fadvise64_64 275 | .long sys_ni_syscall /* sys_vserver */ 276 | .long sys_mbind 277 | .long sys_get_mempolicy 278 | .long sys_set_mempolicy 279 | .long sys_mq_open 280 | .long sys_mq_unlink 281 | .long sys_mq_timedsend 282 | .long sys_mq_timedreceive /* 280 */ 283 | .long sys_mq_notify 284 | .long sys_mq_getsetattr 285 | .long sys_kexec_load 286 | .long sys_waitid 287 | .long sys_ni_syscall /* 285 */ /* available */ 288 | .long sys_add_key 289 | .long sys_request_key 290 | .long sys_keyctl 291 | .long sys_ioprio_set 292 | .long sys_ioprio_get /* 290 */ 293 | .long sys_inotify_init 294 | .long sys_inotify_add_watch 295 | .long sys_inotify_rm_watch 296 | .long sys_migrate_pages 297 | .long sys_openat /* 295 */ 298 | .long sys_mkdirat 299 | .long sys_mknodat 300 | .long sys_fchownat 301 | .long sys_futimesat 302 | .long sys_fstatat64 /* 300 */ 303 | .long sys_unlinkat 304 | .long sys_renameat 305 | .long sys_linkat 306 | .long sys_symlinkat 307 | .long sys_readlinkat /* 305 */ 308 | .long sys_fchmodat 309 | .long sys_faccessat 310 | .long sys_pselect6 311 | .long sys_ppoll 312 | .long sys_unshare /* 310 */ 313 | .long sys_set_robust_list 314 | .long sys_get_robust_list 315 | .long sys_splice 316 | .long sys_sync_file_range 317 | .long sys_tee /* 315 */ 318 | .long sys_vmsplice 319 | .long sys_move_pages 320 | .long sys_getcpu 321 | .long sys_epoll_pwait 322 | .long sys_utimensat /* 320 */ 323 | .long sys_signalfd 324 | .long sys_timerfd_create 325 | .long sys_eventfd 326 | .long sys_fallocate 327 | .long sys_timerfd_settime /* 325 */ 328 | .long sys_timerfd_gettime 329 | .long sys_signalfd4 330 | .long sys_eventfd2 331 | .long sys_epoll_create1 332 | .long sys_dup3 /* 330 */ 333 | .long sys_pipe2 334 | .long sys_inotify_init1 335 | .long sys_preadv 336 | .long sys_pwritev 337 | .long sys_rt_tgsigqueueinfo /* 335 */ 338 | .long sys_perf_event_open 339 | .long sys_recvmmsg 340 | .long sys_fanotify_init 341 | .long sys_fanotify_mark 342 | .long sys_prlimit64 /* 340 */ 343 | .long sys_name_to_handle_at 344 | .long sys_open_by_handle_at 345 | .long sys_clock_adjtime 346 | .long sys_syncfs 347 | .long sys_sendmmsg /* 345 */ 348 | .long sys_setns 349 | .long sys_process_vm_readv 350 | .long sys_process_vm_writev 351 | .long sys_yfkm2_monitor 352 | .long sys_yfkm2_notifyme /* 350 */ 353 | -------------------------------------------------------------------------------- /yfkm2/source/2.6.42.7-1.fc15/include/asm-generic/unistd.h: -------------------------------------------------------------------------------- 1 | #if !defined(_ASM_GENERIC_UNISTD_H) || defined(__SYSCALL) 2 | #define _ASM_GENERIC_UNISTD_H 3 | 4 | #include 5 | 6 | /* 7 | * This file contains the system call numbers, based on the 8 | * layout of the x86-64 architecture, which embeds the 9 | * pointer to the syscall in the table. 10 | * 11 | * As a basic principle, no duplication of functionality 12 | * should be added, e.g. we don't use lseek when llseek 13 | * is present. New architectures should use this file 14 | * and implement the less feature-full calls in user space. 15 | */ 16 | 17 | #ifndef __SYSCALL 18 | #define __SYSCALL(x, y) 19 | #endif 20 | 21 | #if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT) 22 | #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32) 23 | #else 24 | #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64) 25 | #endif 26 | 27 | #ifdef __SYSCALL_COMPAT 28 | #define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _comp) 29 | #define __SC_COMP_3264(_nr, _32, _64, _comp) __SYSCALL(_nr, _comp) 30 | #else 31 | #define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys) 32 | #define __SC_COMP_3264(_nr, _32, _64, _comp) __SC_3264(_nr, _32, _64) 33 | #endif 34 | 35 | #define __NR_io_setup 0 36 | __SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup) 37 | #define __NR_io_destroy 1 38 | __SYSCALL(__NR_io_destroy, sys_io_destroy) 39 | #define __NR_io_submit 2 40 | __SC_COMP(__NR_io_submit, sys_io_submit, compat_sys_io_submit) 41 | #define __NR_io_cancel 3 42 | __SYSCALL(__NR_io_cancel, sys_io_cancel) 43 | #define __NR_io_getevents 4 44 | __SC_COMP(__NR_io_getevents, sys_io_getevents, compat_sys_io_getevents) 45 | 46 | /* fs/xattr.c */ 47 | #define __NR_setxattr 5 48 | __SYSCALL(__NR_setxattr, sys_setxattr) 49 | #define __NR_lsetxattr 6 50 | __SYSCALL(__NR_lsetxattr, sys_lsetxattr) 51 | #define __NR_fsetxattr 7 52 | __SYSCALL(__NR_fsetxattr, sys_fsetxattr) 53 | #define __NR_getxattr 8 54 | __SYSCALL(__NR_getxattr, sys_getxattr) 55 | #define __NR_lgetxattr 9 56 | __SYSCALL(__NR_lgetxattr, sys_lgetxattr) 57 | #define __NR_fgetxattr 10 58 | __SYSCALL(__NR_fgetxattr, sys_fgetxattr) 59 | #define __NR_listxattr 11 60 | __SYSCALL(__NR_listxattr, sys_listxattr) 61 | #define __NR_llistxattr 12 62 | __SYSCALL(__NR_llistxattr, sys_llistxattr) 63 | #define __NR_flistxattr 13 64 | __SYSCALL(__NR_flistxattr, sys_flistxattr) 65 | #define __NR_removexattr 14 66 | __SYSCALL(__NR_removexattr, sys_removexattr) 67 | #define __NR_lremovexattr 15 68 | __SYSCALL(__NR_lremovexattr, sys_lremovexattr) 69 | #define __NR_fremovexattr 16 70 | __SYSCALL(__NR_fremovexattr, sys_fremovexattr) 71 | 72 | /* fs/dcache.c */ 73 | #define __NR_getcwd 17 74 | __SYSCALL(__NR_getcwd, sys_getcwd) 75 | 76 | /* fs/cookies.c */ 77 | #define __NR_lookup_dcookie 18 78 | __SC_COMP(__NR_lookup_dcookie, sys_lookup_dcookie, compat_sys_lookup_dcookie) 79 | 80 | /* fs/eventfd.c */ 81 | #define __NR_eventfd2 19 82 | __SYSCALL(__NR_eventfd2, sys_eventfd2) 83 | 84 | /* fs/eventpoll.c */ 85 | #define __NR_epoll_create1 20 86 | __SYSCALL(__NR_epoll_create1, sys_epoll_create1) 87 | #define __NR_epoll_ctl 21 88 | __SYSCALL(__NR_epoll_ctl, sys_epoll_ctl) 89 | #define __NR_epoll_pwait 22 90 | __SC_COMP(__NR_epoll_pwait, sys_epoll_pwait, compat_sys_epoll_pwait) 91 | 92 | /* fs/fcntl.c */ 93 | #define __NR_dup 23 94 | __SYSCALL(__NR_dup, sys_dup) 95 | #define __NR_dup3 24 96 | __SYSCALL(__NR_dup3, sys_dup3) 97 | #define __NR3264_fcntl 25 98 | __SC_COMP_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl, compat_sys_fcntl64) 99 | 100 | /* fs/inotify_user.c */ 101 | #define __NR_inotify_init1 26 102 | __SYSCALL(__NR_inotify_init1, sys_inotify_init1) 103 | #define __NR_inotify_add_watch 27 104 | __SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch) 105 | #define __NR_inotify_rm_watch 28 106 | __SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch) 107 | 108 | /* fs/ioctl.c */ 109 | #define __NR_ioctl 29 110 | __SC_COMP(__NR_ioctl, sys_ioctl, compat_sys_ioctl) 111 | 112 | /* fs/ioprio.c */ 113 | #define __NR_ioprio_set 30 114 | __SYSCALL(__NR_ioprio_set, sys_ioprio_set) 115 | #define __NR_ioprio_get 31 116 | __SYSCALL(__NR_ioprio_get, sys_ioprio_get) 117 | 118 | /* fs/locks.c */ 119 | #define __NR_flock 32 120 | __SYSCALL(__NR_flock, sys_flock) 121 | 122 | /* fs/namei.c */ 123 | #define __NR_mknodat 33 124 | __SYSCALL(__NR_mknodat, sys_mknodat) 125 | #define __NR_mkdirat 34 126 | __SYSCALL(__NR_mkdirat, sys_mkdirat) 127 | #define __NR_unlinkat 35 128 | __SYSCALL(__NR_unlinkat, sys_unlinkat) 129 | #define __NR_symlinkat 36 130 | __SYSCALL(__NR_symlinkat, sys_symlinkat) 131 | #define __NR_linkat 37 132 | __SYSCALL(__NR_linkat, sys_linkat) 133 | #define __NR_renameat 38 134 | __SYSCALL(__NR_renameat, sys_renameat) 135 | 136 | /* fs/namespace.c */ 137 | #define __NR_umount2 39 138 | __SYSCALL(__NR_umount2, sys_umount) 139 | #define __NR_mount 40 140 | __SC_COMP(__NR_mount, sys_mount, compat_sys_mount) 141 | #define __NR_pivot_root 41 142 | __SYSCALL(__NR_pivot_root, sys_pivot_root) 143 | 144 | /* fs/nfsctl.c */ 145 | #define __NR_nfsservctl 42 146 | __SYSCALL(__NR_nfsservctl, sys_ni_syscall) 147 | 148 | /* fs/open.c */ 149 | #define __NR3264_statfs 43 150 | __SC_COMP_3264(__NR3264_statfs, sys_statfs64, sys_statfs, \ 151 | compat_sys_statfs64) 152 | #define __NR3264_fstatfs 44 153 | __SC_COMP_3264(__NR3264_fstatfs, sys_fstatfs64, sys_fstatfs, \ 154 | compat_sys_fstatfs64) 155 | #define __NR3264_truncate 45 156 | __SC_COMP_3264(__NR3264_truncate, sys_truncate64, sys_truncate, \ 157 | compat_sys_truncate64) 158 | #define __NR3264_ftruncate 46 159 | __SC_COMP_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate, \ 160 | compat_sys_ftruncate64) 161 | 162 | #define __NR_fallocate 47 163 | __SC_COMP(__NR_fallocate, sys_fallocate, compat_sys_fallocate) 164 | #define __NR_faccessat 48 165 | __SYSCALL(__NR_faccessat, sys_faccessat) 166 | #define __NR_chdir 49 167 | __SYSCALL(__NR_chdir, sys_chdir) 168 | #define __NR_fchdir 50 169 | __SYSCALL(__NR_fchdir, sys_fchdir) 170 | #define __NR_chroot 51 171 | __SYSCALL(__NR_chroot, sys_chroot) 172 | #define __NR_fchmod 52 173 | __SYSCALL(__NR_fchmod, sys_fchmod) 174 | #define __NR_fchmodat 53 175 | __SYSCALL(__NR_fchmodat, sys_fchmodat) 176 | #define __NR_fchownat 54 177 | __SYSCALL(__NR_fchownat, sys_fchownat) 178 | #define __NR_fchown 55 179 | __SYSCALL(__NR_fchown, sys_fchown) 180 | #define __NR_openat 56 181 | __SC_COMP(__NR_openat, sys_openat, compat_sys_openat) 182 | #define __NR_close 57 183 | __SYSCALL(__NR_close, sys_close) 184 | #define __NR_vhangup 58 185 | __SYSCALL(__NR_vhangup, sys_vhangup) 186 | 187 | /* fs/pipe.c */ 188 | #define __NR_pipe2 59 189 | __SYSCALL(__NR_pipe2, sys_pipe2) 190 | 191 | /* fs/quota.c */ 192 | #define __NR_quotactl 60 193 | __SYSCALL(__NR_quotactl, sys_quotactl) 194 | 195 | /* fs/readdir.c */ 196 | #define __NR_getdents64 61 197 | __SC_COMP(__NR_getdents64, sys_getdents64, compat_sys_getdents64) 198 | 199 | /* fs/read_write.c */ 200 | #define __NR3264_lseek 62 201 | __SC_3264(__NR3264_lseek, sys_llseek, sys_lseek) 202 | #define __NR_read 63 203 | __SYSCALL(__NR_read, sys_read) 204 | #define __NR_write 64 205 | __SYSCALL(__NR_write, sys_write) 206 | #define __NR_readv 65 207 | __SC_COMP(__NR_readv, sys_readv, compat_sys_readv) 208 | #define __NR_writev 66 209 | __SC_COMP(__NR_writev, sys_writev, compat_sys_writev) 210 | #define __NR_pread64 67 211 | __SC_COMP(__NR_pread64, sys_pread64, compat_sys_pread64) 212 | #define __NR_pwrite64 68 213 | __SC_COMP(__NR_pwrite64, sys_pwrite64, compat_sys_pwrite64) 214 | #define __NR_preadv 69 215 | __SC_COMP(__NR_preadv, sys_preadv, compat_sys_preadv) 216 | #define __NR_pwritev 70 217 | __SC_COMP(__NR_pwritev, sys_pwritev, compat_sys_pwritev) 218 | 219 | /* fs/sendfile.c */ 220 | #define __NR3264_sendfile 71 221 | __SC_3264(__NR3264_sendfile, sys_sendfile64, sys_sendfile) 222 | 223 | /* fs/select.c */ 224 | #define __NR_pselect6 72 225 | __SC_COMP(__NR_pselect6, sys_pselect6, compat_sys_pselect6) 226 | #define __NR_ppoll 73 227 | __SC_COMP(__NR_ppoll, sys_ppoll, compat_sys_ppoll) 228 | 229 | /* fs/signalfd.c */ 230 | #define __NR_signalfd4 74 231 | __SC_COMP(__NR_signalfd4, sys_signalfd4, compat_sys_signalfd4) 232 | 233 | /* fs/splice.c */ 234 | #define __NR_vmsplice 75 235 | __SC_COMP(__NR_vmsplice, sys_vmsplice, compat_sys_vmsplice) 236 | #define __NR_splice 76 237 | __SYSCALL(__NR_splice, sys_splice) 238 | #define __NR_tee 77 239 | __SYSCALL(__NR_tee, sys_tee) 240 | 241 | /* fs/stat.c */ 242 | #define __NR_readlinkat 78 243 | __SYSCALL(__NR_readlinkat, sys_readlinkat) 244 | #define __NR3264_fstatat 79 245 | __SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat) 246 | #define __NR3264_fstat 80 247 | __SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat) 248 | 249 | /* fs/sync.c */ 250 | #define __NR_sync 81 251 | __SYSCALL(__NR_sync, sys_sync) 252 | #define __NR_fsync 82 253 | __SYSCALL(__NR_fsync, sys_fsync) 254 | #define __NR_fdatasync 83 255 | __SYSCALL(__NR_fdatasync, sys_fdatasync) 256 | #ifdef __ARCH_WANT_SYNC_FILE_RANGE2 257 | #define __NR_sync_file_range2 84 258 | __SC_COMP(__NR_sync_file_range2, sys_sync_file_range2, \ 259 | compat_sys_sync_file_range2) 260 | #else 261 | #define __NR_sync_file_range 84 262 | __SC_COMP(__NR_sync_file_range, sys_sync_file_range, \ 263 | compat_sys_sync_file_range) 264 | #endif 265 | 266 | /* fs/timerfd.c */ 267 | #define __NR_timerfd_create 85 268 | __SYSCALL(__NR_timerfd_create, sys_timerfd_create) 269 | #define __NR_timerfd_settime 86 270 | __SC_COMP(__NR_timerfd_settime, sys_timerfd_settime, \ 271 | compat_sys_timerfd_settime) 272 | #define __NR_timerfd_gettime 87 273 | __SC_COMP(__NR_timerfd_gettime, sys_timerfd_gettime, \ 274 | compat_sys_timerfd_gettime) 275 | 276 | /* fs/utimes.c */ 277 | #define __NR_utimensat 88 278 | __SC_COMP(__NR_utimensat, sys_utimensat, compat_sys_utimensat) 279 | 280 | /* kernel/acct.c */ 281 | #define __NR_acct 89 282 | __SYSCALL(__NR_acct, sys_acct) 283 | 284 | /* kernel/capability.c */ 285 | #define __NR_capget 90 286 | __SYSCALL(__NR_capget, sys_capget) 287 | #define __NR_capset 91 288 | __SYSCALL(__NR_capset, sys_capset) 289 | 290 | /* kernel/exec_domain.c */ 291 | #define __NR_personality 92 292 | __SYSCALL(__NR_personality, sys_personality) 293 | 294 | /* kernel/exit.c */ 295 | #define __NR_exit 93 296 | __SYSCALL(__NR_exit, sys_exit) 297 | #define __NR_exit_group 94 298 | __SYSCALL(__NR_exit_group, sys_exit_group) 299 | #define __NR_waitid 95 300 | __SC_COMP(__NR_waitid, sys_waitid, compat_sys_waitid) 301 | 302 | /* kernel/fork.c */ 303 | #define __NR_set_tid_address 96 304 | __SYSCALL(__NR_set_tid_address, sys_set_tid_address) 305 | #define __NR_unshare 97 306 | __SYSCALL(__NR_unshare, sys_unshare) 307 | 308 | /* kernel/futex.c */ 309 | #define __NR_futex 98 310 | __SC_COMP(__NR_futex, sys_futex, compat_sys_futex) 311 | #define __NR_set_robust_list 99 312 | __SC_COMP(__NR_set_robust_list, sys_set_robust_list, \ 313 | compat_sys_set_robust_list) 314 | #define __NR_get_robust_list 100 315 | __SC_COMP(__NR_get_robust_list, sys_get_robust_list, \ 316 | compat_sys_get_robust_list) 317 | 318 | /* kernel/hrtimer.c */ 319 | #define __NR_nanosleep 101 320 | __SC_COMP(__NR_nanosleep, sys_nanosleep, compat_sys_nanosleep) 321 | 322 | /* kernel/itimer.c */ 323 | #define __NR_getitimer 102 324 | __SC_COMP(__NR_getitimer, sys_getitimer, compat_sys_getitimer) 325 | #define __NR_setitimer 103 326 | __SC_COMP(__NR_setitimer, sys_setitimer, compat_sys_setitimer) 327 | 328 | /* kernel/kexec.c */ 329 | #define __NR_kexec_load 104 330 | __SC_COMP(__NR_kexec_load, sys_kexec_load, compat_sys_kexec_load) 331 | 332 | /* kernel/module.c */ 333 | #define __NR_init_module 105 334 | __SYSCALL(__NR_init_module, sys_init_module) 335 | #define __NR_delete_module 106 336 | __SYSCALL(__NR_delete_module, sys_delete_module) 337 | 338 | /* kernel/posix-timers.c */ 339 | #define __NR_timer_create 107 340 | __SC_COMP(__NR_timer_create, sys_timer_create, compat_sys_timer_create) 341 | #define __NR_timer_gettime 108 342 | __SC_COMP(__NR_timer_gettime, sys_timer_gettime, compat_sys_timer_gettime) 343 | #define __NR_timer_getoverrun 109 344 | __SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun) 345 | #define __NR_timer_settime 110 346 | __SC_COMP(__NR_timer_settime, sys_timer_settime, compat_sys_timer_settime) 347 | #define __NR_timer_delete 111 348 | __SYSCALL(__NR_timer_delete, sys_timer_delete) 349 | #define __NR_clock_settime 112 350 | __SC_COMP(__NR_clock_settime, sys_clock_settime, compat_sys_clock_settime) 351 | #define __NR_clock_gettime 113 352 | __SC_COMP(__NR_clock_gettime, sys_clock_gettime, compat_sys_clock_gettime) 353 | #define __NR_clock_getres 114 354 | __SC_COMP(__NR_clock_getres, sys_clock_getres, compat_sys_clock_getres) 355 | #define __NR_clock_nanosleep 115 356 | __SC_COMP(__NR_clock_nanosleep, sys_clock_nanosleep, \ 357 | compat_sys_clock_nanosleep) 358 | 359 | /* kernel/printk.c */ 360 | #define __NR_syslog 116 361 | __SYSCALL(__NR_syslog, sys_syslog) 362 | 363 | /* kernel/ptrace.c */ 364 | #define __NR_ptrace 117 365 | __SYSCALL(__NR_ptrace, sys_ptrace) 366 | 367 | /* kernel/sched.c */ 368 | #define __NR_sched_setparam 118 369 | __SYSCALL(__NR_sched_setparam, sys_sched_setparam) 370 | #define __NR_sched_setscheduler 119 371 | __SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler) 372 | #define __NR_sched_getscheduler 120 373 | __SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler) 374 | #define __NR_sched_getparam 121 375 | __SYSCALL(__NR_sched_getparam, sys_sched_getparam) 376 | #define __NR_sched_setaffinity 122 377 | __SC_COMP(__NR_sched_setaffinity, sys_sched_setaffinity, \ 378 | compat_sys_sched_setaffinity) 379 | #define __NR_sched_getaffinity 123 380 | __SC_COMP(__NR_sched_getaffinity, sys_sched_getaffinity, \ 381 | compat_sys_sched_getaffinity) 382 | #define __NR_sched_yield 124 383 | __SYSCALL(__NR_sched_yield, sys_sched_yield) 384 | #define __NR_sched_get_priority_max 125 385 | __SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max) 386 | #define __NR_sched_get_priority_min 126 387 | __SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min) 388 | #define __NR_sched_rr_get_interval 127 389 | __SC_COMP(__NR_sched_rr_get_interval, sys_sched_rr_get_interval, \ 390 | compat_sys_sched_rr_get_interval) 391 | 392 | /* kernel/signal.c */ 393 | #define __NR_restart_syscall 128 394 | __SYSCALL(__NR_restart_syscall, sys_restart_syscall) 395 | #define __NR_kill 129 396 | __SYSCALL(__NR_kill, sys_kill) 397 | #define __NR_tkill 130 398 | __SYSCALL(__NR_tkill, sys_tkill) 399 | #define __NR_tgkill 131 400 | __SYSCALL(__NR_tgkill, sys_tgkill) 401 | #define __NR_sigaltstack 132 402 | __SC_COMP(__NR_sigaltstack, sys_sigaltstack, compat_sys_sigaltstack) 403 | #define __NR_rt_sigsuspend 133 404 | __SC_COMP(__NR_rt_sigsuspend, sys_rt_sigsuspend, compat_sys_rt_sigsuspend) 405 | #define __NR_rt_sigaction 134 406 | __SC_COMP(__NR_rt_sigaction, sys_rt_sigaction, compat_sys_rt_sigaction) 407 | #define __NR_rt_sigprocmask 135 408 | __SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask) 409 | #define __NR_rt_sigpending 136 410 | __SYSCALL(__NR_rt_sigpending, sys_rt_sigpending) 411 | #define __NR_rt_sigtimedwait 137 412 | __SC_COMP(__NR_rt_sigtimedwait, sys_rt_sigtimedwait, \ 413 | compat_sys_rt_sigtimedwait) 414 | #define __NR_rt_sigqueueinfo 138 415 | __SC_COMP(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo, \ 416 | compat_sys_rt_sigqueueinfo) 417 | #define __NR_rt_sigreturn 139 418 | __SC_COMP(__NR_rt_sigreturn, sys_rt_sigreturn, compat_sys_rt_sigreturn) 419 | 420 | /* kernel/sys.c */ 421 | #define __NR_setpriority 140 422 | __SYSCALL(__NR_setpriority, sys_setpriority) 423 | #define __NR_getpriority 141 424 | __SYSCALL(__NR_getpriority, sys_getpriority) 425 | #define __NR_reboot 142 426 | __SYSCALL(__NR_reboot, sys_reboot) 427 | #define __NR_setregid 143 428 | __SYSCALL(__NR_setregid, sys_setregid) 429 | #define __NR_setgid 144 430 | __SYSCALL(__NR_setgid, sys_setgid) 431 | #define __NR_setreuid 145 432 | __SYSCALL(__NR_setreuid, sys_setreuid) 433 | #define __NR_setuid 146 434 | __SYSCALL(__NR_setuid, sys_setuid) 435 | #define __NR_setresuid 147 436 | __SYSCALL(__NR_setresuid, sys_setresuid) 437 | #define __NR_getresuid 148 438 | __SYSCALL(__NR_getresuid, sys_getresuid) 439 | #define __NR_setresgid 149 440 | __SYSCALL(__NR_setresgid, sys_setresgid) 441 | #define __NR_getresgid 150 442 | __SYSCALL(__NR_getresgid, sys_getresgid) 443 | #define __NR_setfsuid 151 444 | __SYSCALL(__NR_setfsuid, sys_setfsuid) 445 | #define __NR_setfsgid 152 446 | __SYSCALL(__NR_setfsgid, sys_setfsgid) 447 | #define __NR_times 153 448 | __SC_COMP(__NR_times, sys_times, compat_sys_times) 449 | #define __NR_setpgid 154 450 | __SYSCALL(__NR_setpgid, sys_setpgid) 451 | #define __NR_getpgid 155 452 | __SYSCALL(__NR_getpgid, sys_getpgid) 453 | #define __NR_getsid 156 454 | __SYSCALL(__NR_getsid, sys_getsid) 455 | #define __NR_setsid 157 456 | __SYSCALL(__NR_setsid, sys_setsid) 457 | #define __NR_getgroups 158 458 | __SYSCALL(__NR_getgroups, sys_getgroups) 459 | #define __NR_setgroups 159 460 | __SYSCALL(__NR_setgroups, sys_setgroups) 461 | #define __NR_uname 160 462 | __SYSCALL(__NR_uname, sys_newuname) 463 | #define __NR_sethostname 161 464 | __SYSCALL(__NR_sethostname, sys_sethostname) 465 | #define __NR_setdomainname 162 466 | __SYSCALL(__NR_setdomainname, sys_setdomainname) 467 | #define __NR_getrlimit 163 468 | __SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit) 469 | #define __NR_setrlimit 164 470 | __SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit) 471 | #define __NR_getrusage 165 472 | __SC_COMP(__NR_getrusage, sys_getrusage, compat_sys_getrusage) 473 | #define __NR_umask 166 474 | __SYSCALL(__NR_umask, sys_umask) 475 | #define __NR_prctl 167 476 | __SYSCALL(__NR_prctl, sys_prctl) 477 | #define __NR_getcpu 168 478 | __SYSCALL(__NR_getcpu, sys_getcpu) 479 | 480 | /* kernel/time.c */ 481 | #define __NR_gettimeofday 169 482 | __SC_COMP(__NR_gettimeofday, sys_gettimeofday, compat_sys_gettimeofday) 483 | #define __NR_settimeofday 170 484 | __SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday) 485 | #define __NR_adjtimex 171 486 | __SC_COMP(__NR_adjtimex, sys_adjtimex, compat_sys_adjtimex) 487 | 488 | /* kernel/timer.c */ 489 | #define __NR_getpid 172 490 | __SYSCALL(__NR_getpid, sys_getpid) 491 | #define __NR_getppid 173 492 | __SYSCALL(__NR_getppid, sys_getppid) 493 | #define __NR_getuid 174 494 | __SYSCALL(__NR_getuid, sys_getuid) 495 | #define __NR_geteuid 175 496 | __SYSCALL(__NR_geteuid, sys_geteuid) 497 | #define __NR_getgid 176 498 | __SYSCALL(__NR_getgid, sys_getgid) 499 | #define __NR_getegid 177 500 | __SYSCALL(__NR_getegid, sys_getegid) 501 | #define __NR_gettid 178 502 | __SYSCALL(__NR_gettid, sys_gettid) 503 | #define __NR_sysinfo 179 504 | __SC_COMP(__NR_sysinfo, sys_sysinfo, compat_sys_sysinfo) 505 | 506 | /* ipc/mqueue.c */ 507 | #define __NR_mq_open 180 508 | __SC_COMP(__NR_mq_open, sys_mq_open, compat_sys_mq_open) 509 | #define __NR_mq_unlink 181 510 | __SYSCALL(__NR_mq_unlink, sys_mq_unlink) 511 | #define __NR_mq_timedsend 182 512 | __SC_COMP(__NR_mq_timedsend, sys_mq_timedsend, compat_sys_mq_timedsend) 513 | #define __NR_mq_timedreceive 183 514 | __SC_COMP(__NR_mq_timedreceive, sys_mq_timedreceive, \ 515 | compat_sys_mq_timedreceive) 516 | #define __NR_mq_notify 184 517 | __SC_COMP(__NR_mq_notify, sys_mq_notify, compat_sys_mq_notify) 518 | #define __NR_mq_getsetattr 185 519 | __SC_COMP(__NR_mq_getsetattr, sys_mq_getsetattr, compat_sys_mq_getsetattr) 520 | 521 | /* ipc/msg.c */ 522 | #define __NR_msgget 186 523 | __SYSCALL(__NR_msgget, sys_msgget) 524 | #define __NR_msgctl 187 525 | __SC_COMP(__NR_msgctl, sys_msgctl, compat_sys_msgctl) 526 | #define __NR_msgrcv 188 527 | __SC_COMP(__NR_msgrcv, sys_msgrcv, compat_sys_msgrcv) 528 | #define __NR_msgsnd 189 529 | __SC_COMP(__NR_msgsnd, sys_msgsnd, compat_sys_msgsnd) 530 | 531 | /* ipc/sem.c */ 532 | #define __NR_semget 190 533 | __SYSCALL(__NR_semget, sys_semget) 534 | #define __NR_semctl 191 535 | __SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl) 536 | #define __NR_semtimedop 192 537 | __SC_COMP(__NR_semtimedop, sys_semtimedop, compat_sys_semtimedop) 538 | #define __NR_semop 193 539 | __SYSCALL(__NR_semop, sys_semop) 540 | 541 | /* ipc/shm.c */ 542 | #define __NR_shmget 194 543 | __SYSCALL(__NR_shmget, sys_shmget) 544 | #define __NR_shmctl 195 545 | __SC_COMP(__NR_shmctl, sys_shmctl, compat_sys_shmctl) 546 | #define __NR_shmat 196 547 | __SC_COMP(__NR_shmat, sys_shmat, compat_sys_shmat) 548 | #define __NR_shmdt 197 549 | __SYSCALL(__NR_shmdt, sys_shmdt) 550 | 551 | /* net/socket.c */ 552 | #define __NR_socket 198 553 | __SYSCALL(__NR_socket, sys_socket) 554 | #define __NR_socketpair 199 555 | __SYSCALL(__NR_socketpair, sys_socketpair) 556 | #define __NR_bind 200 557 | __SYSCALL(__NR_bind, sys_bind) 558 | #define __NR_listen 201 559 | __SYSCALL(__NR_listen, sys_listen) 560 | #define __NR_accept 202 561 | __SYSCALL(__NR_accept, sys_accept) 562 | #define __NR_connect 203 563 | __SYSCALL(__NR_connect, sys_connect) 564 | #define __NR_getsockname 204 565 | __SYSCALL(__NR_getsockname, sys_getsockname) 566 | #define __NR_getpeername 205 567 | __SYSCALL(__NR_getpeername, sys_getpeername) 568 | #define __NR_sendto 206 569 | __SYSCALL(__NR_sendto, sys_sendto) 570 | #define __NR_recvfrom 207 571 | __SC_COMP(__NR_recvfrom, sys_recvfrom, compat_sys_recvfrom) 572 | #define __NR_setsockopt 208 573 | __SC_COMP(__NR_setsockopt, sys_setsockopt, compat_sys_setsockopt) 574 | #define __NR_getsockopt 209 575 | __SC_COMP(__NR_getsockopt, sys_getsockopt, compat_sys_getsockopt) 576 | #define __NR_shutdown 210 577 | __SYSCALL(__NR_shutdown, sys_shutdown) 578 | #define __NR_sendmsg 211 579 | __SC_COMP(__NR_sendmsg, sys_sendmsg, compat_sys_sendmsg) 580 | #define __NR_recvmsg 212 581 | __SC_COMP(__NR_recvmsg, sys_recvmsg, compat_sys_recvmsg) 582 | 583 | /* mm/filemap.c */ 584 | #define __NR_readahead 213 585 | __SC_COMP(__NR_readahead, sys_readahead, compat_sys_readahead) 586 | 587 | /* mm/nommu.c, also with MMU */ 588 | #define __NR_brk 214 589 | __SYSCALL(__NR_brk, sys_brk) 590 | #define __NR_munmap 215 591 | __SYSCALL(__NR_munmap, sys_munmap) 592 | #define __NR_mremap 216 593 | __SYSCALL(__NR_mremap, sys_mremap) 594 | 595 | /* security/keys/keyctl.c */ 596 | #define __NR_add_key 217 597 | __SYSCALL(__NR_add_key, sys_add_key) 598 | #define __NR_request_key 218 599 | __SYSCALL(__NR_request_key, sys_request_key) 600 | #define __NR_keyctl 219 601 | __SC_COMP(__NR_keyctl, sys_keyctl, compat_sys_keyctl) 602 | 603 | /* arch/example/kernel/sys_example.c */ 604 | #define __NR_clone 220 605 | __SYSCALL(__NR_clone, sys_clone) 606 | #define __NR_execve 221 607 | __SC_COMP(__NR_execve, sys_execve, compat_sys_execve) 608 | 609 | #define __NR3264_mmap 222 610 | __SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap) 611 | /* mm/fadvise.c */ 612 | #define __NR3264_fadvise64 223 613 | __SC_COMP(__NR3264_fadvise64, sys_fadvise64_64, compat_sys_fadvise64_64) 614 | 615 | /* mm/, CONFIG_MMU only */ 616 | #ifndef __ARCH_NOMMU 617 | #define __NR_swapon 224 618 | __SYSCALL(__NR_swapon, sys_swapon) 619 | #define __NR_swapoff 225 620 | __SYSCALL(__NR_swapoff, sys_swapoff) 621 | #define __NR_mprotect 226 622 | __SYSCALL(__NR_mprotect, sys_mprotect) 623 | #define __NR_msync 227 624 | __SYSCALL(__NR_msync, sys_msync) 625 | #define __NR_mlock 228 626 | __SYSCALL(__NR_mlock, sys_mlock) 627 | #define __NR_munlock 229 628 | __SYSCALL(__NR_munlock, sys_munlock) 629 | #define __NR_mlockall 230 630 | __SYSCALL(__NR_mlockall, sys_mlockall) 631 | #define __NR_munlockall 231 632 | __SYSCALL(__NR_munlockall, sys_munlockall) 633 | #define __NR_mincore 232 634 | __SYSCALL(__NR_mincore, sys_mincore) 635 | #define __NR_madvise 233 636 | __SYSCALL(__NR_madvise, sys_madvise) 637 | #define __NR_remap_file_pages 234 638 | __SYSCALL(__NR_remap_file_pages, sys_remap_file_pages) 639 | #define __NR_mbind 235 640 | __SC_COMP(__NR_mbind, sys_mbind, compat_sys_mbind) 641 | #define __NR_get_mempolicy 236 642 | __SC_COMP(__NR_get_mempolicy, sys_get_mempolicy, compat_sys_get_mempolicy) 643 | #define __NR_set_mempolicy 237 644 | __SC_COMP(__NR_set_mempolicy, sys_set_mempolicy, compat_sys_set_mempolicy) 645 | #define __NR_migrate_pages 238 646 | __SC_COMP(__NR_migrate_pages, sys_migrate_pages, compat_sys_migrate_pages) 647 | #define __NR_move_pages 239 648 | __SC_COMP(__NR_move_pages, sys_move_pages, compat_sys_move_pages) 649 | #endif 650 | 651 | #define __NR_rt_tgsigqueueinfo 240 652 | __SC_COMP(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo, \ 653 | compat_sys_rt_tgsigqueueinfo) 654 | #define __NR_perf_event_open 241 655 | __SYSCALL(__NR_perf_event_open, sys_perf_event_open) 656 | #define __NR_accept4 242 657 | __SYSCALL(__NR_accept4, sys_accept4) 658 | #define __NR_recvmmsg 243 659 | __SC_COMP(__NR_recvmmsg, sys_recvmmsg, compat_sys_recvmmsg) 660 | 661 | /* 662 | * Architectures may provide up to 16 syscalls of their own 663 | * starting with this value. 664 | */ 665 | #define __NR_arch_specific_syscall 244 666 | 667 | #define __NR_wait4 260 668 | __SC_COMP(__NR_wait4, sys_wait4, compat_sys_wait4) 669 | #define __NR_prlimit64 261 670 | __SYSCALL(__NR_prlimit64, sys_prlimit64) 671 | #define __NR_fanotify_init 262 672 | __SYSCALL(__NR_fanotify_init, sys_fanotify_init) 673 | #define __NR_fanotify_mark 263 674 | __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) 675 | #define __NR_name_to_handle_at 264 676 | __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) 677 | #define __NR_open_by_handle_at 265 678 | __SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \ 679 | compat_sys_open_by_handle_at) 680 | #define __NR_clock_adjtime 266 681 | __SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime) 682 | #define __NR_syncfs 267 683 | __SYSCALL(__NR_syncfs, sys_syncfs) 684 | #define __NR_setns 268 685 | __SYSCALL(__NR_setns, sys_setns) 686 | #define __NR_sendmmsg 269 687 | __SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg) 688 | #define __NR_process_vm_readv 270 689 | __SC_COMP(__NR_process_vm_readv, sys_process_vm_readv, \ 690 | compat_sys_process_vm_readv) 691 | #define __NR_process_vm_writev 271 692 | __SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \ 693 | compat_sys_process_vm_writev) 694 | 695 | #define __NR_yfkm2_monitor 272 696 | __SC_COMP(__NR_yfkm2_monitor, sys_yfkm2_monitor) 697 | #define __NR_yfkm2_notifyme 273 698 | __SC_COMP(__NR_yfkm2_notifyme, sys_yfkm2_notifyme) 699 | 700 | 701 | #undef __NR_syscalls 702 | #define __NR_syscalls 274 703 | 704 | /* 705 | * All syscalls below here should go away really, 706 | * these are provided for both review and as a porting 707 | * help for the C library version. 708 | * 709 | * Last chance: are any of these important enough to 710 | * enable by default? 711 | */ 712 | #ifdef __ARCH_WANT_SYSCALL_NO_AT 713 | #define __NR_open 1024 714 | __SYSCALL(__NR_open, sys_open) 715 | #define __NR_link 1025 716 | __SYSCALL(__NR_link, sys_link) 717 | #define __NR_unlink 1026 718 | __SYSCALL(__NR_unlink, sys_unlink) 719 | #define __NR_mknod 1027 720 | __SYSCALL(__NR_mknod, sys_mknod) 721 | #define __NR_chmod 1028 722 | __SYSCALL(__NR_chmod, sys_chmod) 723 | #define __NR_chown 1029 724 | __SYSCALL(__NR_chown, sys_chown) 725 | #define __NR_mkdir 1030 726 | __SYSCALL(__NR_mkdir, sys_mkdir) 727 | #define __NR_rmdir 1031 728 | __SYSCALL(__NR_rmdir, sys_rmdir) 729 | #define __NR_lchown 1032 730 | __SYSCALL(__NR_lchown, sys_lchown) 731 | #define __NR_access 1033 732 | __SYSCALL(__NR_access, sys_access) 733 | #define __NR_rename 1034 734 | __SYSCALL(__NR_rename, sys_rename) 735 | #define __NR_readlink 1035 736 | __SYSCALL(__NR_readlink, sys_readlink) 737 | #define __NR_symlink 1036 738 | __SYSCALL(__NR_symlink, sys_symlink) 739 | #define __NR_utimes 1037 740 | __SYSCALL(__NR_utimes, sys_utimes) 741 | #define __NR3264_stat 1038 742 | __SC_3264(__NR3264_stat, sys_stat64, sys_newstat) 743 | #define __NR3264_lstat 1039 744 | __SC_3264(__NR3264_lstat, sys_lstat64, sys_newlstat) 745 | 746 | #undef __NR_syscalls 747 | #define __NR_syscalls (__NR3264_lstat+1) 748 | #endif /* __ARCH_WANT_SYSCALL_NO_AT */ 749 | 750 | #ifdef __ARCH_WANT_SYSCALL_NO_FLAGS 751 | #define __NR_pipe 1040 752 | __SYSCALL(__NR_pipe, sys_pipe) 753 | #define __NR_dup2 1041 754 | __SYSCALL(__NR_dup2, sys_dup2) 755 | #define __NR_epoll_create 1042 756 | __SYSCALL(__NR_epoll_create, sys_epoll_create) 757 | #define __NR_inotify_init 1043 758 | __SYSCALL(__NR_inotify_init, sys_inotify_init) 759 | #define __NR_eventfd 1044 760 | __SYSCALL(__NR_eventfd, sys_eventfd) 761 | #define __NR_signalfd 1045 762 | __SYSCALL(__NR_signalfd, sys_signalfd) 763 | 764 | #undef __NR_syscalls 765 | #define __NR_syscalls (__NR_signalfd+1) 766 | #endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */ 767 | 768 | #if (__BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)) && \ 769 | defined(__ARCH_WANT_SYSCALL_OFF_T) 770 | #define __NR_sendfile 1046 771 | __SYSCALL(__NR_sendfile, sys_sendfile) 772 | #define __NR_ftruncate 1047 773 | __SYSCALL(__NR_ftruncate, sys_ftruncate) 774 | #define __NR_truncate 1048 775 | __SYSCALL(__NR_truncate, sys_truncate) 776 | #define __NR_stat 1049 777 | __SYSCALL(__NR_stat, sys_newstat) 778 | #define __NR_lstat 1050 779 | __SYSCALL(__NR_lstat, sys_newlstat) 780 | #define __NR_fstat 1051 781 | __SYSCALL(__NR_fstat, sys_newfstat) 782 | #define __NR_fcntl 1052 783 | __SYSCALL(__NR_fcntl, sys_fcntl) 784 | #define __NR_fadvise64 1053 785 | #define __ARCH_WANT_SYS_FADVISE64 786 | __SYSCALL(__NR_fadvise64, sys_fadvise64) 787 | #define __NR_newfstatat 1054 788 | #define __ARCH_WANT_SYS_NEWFSTATAT 789 | __SYSCALL(__NR_newfstatat, sys_newfstatat) 790 | #define __NR_fstatfs 1055 791 | __SYSCALL(__NR_fstatfs, sys_fstatfs) 792 | #define __NR_statfs 1056 793 | __SYSCALL(__NR_statfs, sys_statfs) 794 | #define __NR_lseek 1057 795 | __SYSCALL(__NR_lseek, sys_lseek) 796 | #define __NR_mmap 1058 797 | __SYSCALL(__NR_mmap, sys_mmap) 798 | 799 | #undef __NR_syscalls 800 | #define __NR_syscalls (__NR_mmap+1) 801 | #endif /* 32 bit off_t syscalls */ 802 | 803 | #ifdef __ARCH_WANT_SYSCALL_DEPRECATED 804 | #define __NR_alarm 1059 805 | #define __ARCH_WANT_SYS_ALARM 806 | __SYSCALL(__NR_alarm, sys_alarm) 807 | #define __NR_getpgrp 1060 808 | #define __ARCH_WANT_SYS_GETPGRP 809 | __SYSCALL(__NR_getpgrp, sys_getpgrp) 810 | #define __NR_pause 1061 811 | #define __ARCH_WANT_SYS_PAUSE 812 | __SYSCALL(__NR_pause, sys_pause) 813 | #define __NR_time 1062 814 | #define __ARCH_WANT_SYS_TIME 815 | #define __ARCH_WANT_COMPAT_SYS_TIME 816 | __SYSCALL(__NR_time, sys_time) 817 | #define __NR_utime 1063 818 | #define __ARCH_WANT_SYS_UTIME 819 | __SYSCALL(__NR_utime, sys_utime) 820 | 821 | #define __NR_creat 1064 822 | __SYSCALL(__NR_creat, sys_creat) 823 | #define __NR_getdents 1065 824 | #define __ARCH_WANT_SYS_GETDENTS 825 | __SYSCALL(__NR_getdents, sys_getdents) 826 | #define __NR_futimesat 1066 827 | __SYSCALL(__NR_futimesat, sys_futimesat) 828 | #define __NR_select 1067 829 | #define __ARCH_WANT_SYS_SELECT 830 | __SYSCALL(__NR_select, sys_select) 831 | #define __NR_poll 1068 832 | __SYSCALL(__NR_poll, sys_poll) 833 | #define __NR_epoll_wait 1069 834 | __SYSCALL(__NR_epoll_wait, sys_epoll_wait) 835 | #define __NR_ustat 1070 836 | __SYSCALL(__NR_ustat, sys_ustat) 837 | #define __NR_vfork 1071 838 | __SYSCALL(__NR_vfork, sys_vfork) 839 | #define __NR_oldwait4 1072 840 | __SYSCALL(__NR_oldwait4, sys_wait4) 841 | #define __NR_recv 1073 842 | __SYSCALL(__NR_recv, sys_recv) 843 | #define __NR_send 1074 844 | __SYSCALL(__NR_send, sys_send) 845 | #define __NR_bdflush 1075 846 | __SYSCALL(__NR_bdflush, sys_bdflush) 847 | #define __NR_umount 1076 848 | __SYSCALL(__NR_umount, sys_oldumount) 849 | #define __ARCH_WANT_SYS_OLDUMOUNT 850 | #define __NR_uselib 1077 851 | __SYSCALL(__NR_uselib, sys_uselib) 852 | #define __NR__sysctl 1078 853 | __SYSCALL(__NR__sysctl, sys_sysctl) 854 | 855 | #define __NR_fork 1079 856 | #ifdef CONFIG_MMU 857 | __SYSCALL(__NR_fork, sys_fork) 858 | #else 859 | __SYSCALL(__NR_fork, sys_ni_syscall) 860 | #endif /* CONFIG_MMU */ 861 | 862 | #undef __NR_syscalls 863 | #define __NR_syscalls (__NR_fork+1) 864 | 865 | #endif /* __ARCH_WANT_SYSCALL_DEPRECATED */ 866 | 867 | /* 868 | * 32 bit systems traditionally used different 869 | * syscalls for off_t and loff_t arguments, while 870 | * 64 bit systems only need the off_t version. 871 | * For new 32 bit platforms, there is no need to 872 | * implement the old 32 bit off_t syscalls, so 873 | * they take different names. 874 | * Here we map the numbers so that both versions 875 | * use the same syscall table layout. 876 | */ 877 | #if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT) 878 | #define __NR_fcntl __NR3264_fcntl 879 | #define __NR_statfs __NR3264_statfs 880 | #define __NR_fstatfs __NR3264_fstatfs 881 | #define __NR_truncate __NR3264_truncate 882 | #define __NR_ftruncate __NR3264_ftruncate 883 | #define __NR_lseek __NR3264_lseek 884 | #define __NR_sendfile __NR3264_sendfile 885 | #define __NR_newfstatat __NR3264_fstatat 886 | #define __NR_fstat __NR3264_fstat 887 | #define __NR_mmap __NR3264_mmap 888 | #define __NR_fadvise64 __NR3264_fadvise64 889 | #ifdef __NR3264_stat 890 | #define __NR_stat __NR3264_stat 891 | #define __NR_lstat __NR3264_lstat 892 | #endif 893 | #else 894 | #define __NR_fcntl64 __NR3264_fcntl 895 | #define __NR_statfs64 __NR3264_statfs 896 | #define __NR_fstatfs64 __NR3264_fstatfs 897 | #define __NR_truncate64 __NR3264_truncate 898 | #define __NR_ftruncate64 __NR3264_ftruncate 899 | #define __NR_llseek __NR3264_lseek 900 | #define __NR_sendfile64 __NR3264_sendfile 901 | #define __NR_fstatat64 __NR3264_fstatat 902 | #define __NR_fstat64 __NR3264_fstat 903 | #define __NR_mmap2 __NR3264_mmap 904 | #define __NR_fadvise64_64 __NR3264_fadvise64 905 | #ifdef __NR3264_stat 906 | #define __NR_stat64 __NR3264_stat 907 | #define __NR_lstat64 __NR3264_lstat 908 | #endif 909 | #endif 910 | 911 | #ifdef __KERNEL__ 912 | 913 | /* 914 | * These are required system calls, we should 915 | * invert the logic eventually and let them 916 | * be selected by default. 917 | */ 918 | #if __BITS_PER_LONG == 32 919 | #define __ARCH_WANT_STAT64 920 | #define __ARCH_WANT_SYS_LLSEEK 921 | #endif 922 | #define __ARCH_WANT_SYS_RT_SIGACTION 923 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND 924 | #define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 925 | 926 | /* 927 | * "Conditional" syscalls 928 | * 929 | * What we want is __attribute__((weak,alias("sys_ni_syscall"))), 930 | * but it doesn't work on all toolchains, so we just do it by hand 931 | */ 932 | #ifndef cond_syscall 933 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 934 | #endif 935 | 936 | #endif /* __KERNEL__ */ 937 | #endif /* _ASM_GENERIC_UNISTD_H */ 938 | -------------------------------------------------------------------------------- /yfkm2/source/2.6.42.7-1.fc15/samples/yfkm2/Makefile: -------------------------------------------------------------------------------- 1 | obj-y := yfkm2.o 2 | -------------------------------------------------------------------------------- /yfkm2/source/2.6.42.7-1.fc15/samples/yfkm2/userspace/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | gcc monitor.c -o monitor 3 | gcc notifyme.c -o notifyme 4 | 5 | clean: 6 | rm monitor 7 | rm notifyme 8 | -------------------------------------------------------------------------------- /yfkm2/source/2.6.42.7-1.fc15/samples/yfkm2/userspace/monitor.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define SYS_yfkm2_monitor __NR_yfkm2_monitor 6 | #define SYS_yfkm2_notifyme __NR_yfkm2_notifyme 7 | 8 | int main (int argc, char *argv[]) 9 | { 10 | 11 | if (argc < 2) { 12 | printf("Error. Use %s \n", argv[0]); 13 | return 1; 14 | } 15 | pid_t pid = atoi(argv[1]); 16 | long ret; 17 | 18 | 19 | ret = syscall(SYS_yfkm2_monitor, pid); 20 | 21 | if (ret == 0){ 22 | printf("Sucess on adding %d!\n", pid); 23 | return 0; 24 | } else { 25 | printf("Failure! Is %s a valid PID?\n", argv[1]); 26 | return 1; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /yfkm2/source/2.6.42.7-1.fc15/samples/yfkm2/userspace/notifyme.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define SYS_yfkm2_monitor __NR_yfkm2_monitor 6 | #define SYS_yfkm2_notifyme __NR_yfkm2_notifyme 7 | 8 | int main (int argc, char *argv[]) 9 | { 10 | 11 | if (argc < 2) { 12 | printf("Error. Use %s \n", argv[0]); 13 | return 1; 14 | } 15 | 16 | pid_t monitor, notifyme; 17 | long ret; 18 | 19 | monitor = atoi(argv[1]); 20 | notifyme = getpid(); 21 | 22 | ret = syscall(SYS_yfkm2_notifyme, monitor, notifyme); 23 | 24 | if (ret == 0){ 25 | printf("Sucess on adding %d!\n", monitor); 26 | printf("Finish %d to see what happens to me.\n", monitor); 27 | while (1) 28 | sleep (10); 29 | } else { 30 | printf("Failure! Is %s a valid PID?\n", argv[1]); 31 | return 1; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /yfkm2/source/2.6.42.7-1.fc15/samples/yfkm2/yfkm2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * yfkm2 - Your first Kernel Modification v2 3 | * Peter Senna Tschudin 4 | * 5 | */ 6 | 7 | /* 8 | * KNOWN BUGS: 9 | * Does not work when trying to notify more than one process for same monitored 10 | * PID. 11 | * 12 | */ 13 | 14 | /* 15 | * TODO: 16 | * 17 | * Split .c in .c + .h 18 | * 19 | * Check if Kernel thread started correctly and treat possible errors 20 | * 21 | * Check if yfkm2_list->notify != 0 before seting new value 22 | * 23 | */ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #define YFKM2_KT_TIMEOUT (1*HZ) /* 1 second */ 32 | 33 | struct yfkm2 { 34 | pid_t monitor; /* PID to monitor */ 35 | pid_t notifyme; /* PID to notify */ 36 | struct list_head list; /* Linked List struct */ 37 | }; 38 | 39 | /* How many Kernel Threads are running? */ 40 | atomic_t yfkm2_kthread_run_count = ATOMIC_INIT(0); 41 | 42 | /* Define and initialize yfkm2_(linked)list */ 43 | LIST_HEAD(yfkm2_list); 44 | 45 | /* Define and initialize yfkm2_(read&write)lock */ 46 | DEFINE_RWLOCK(yfkm2_lock); 47 | 48 | /* 49 | * yfkm2_is_pid_running(pid_t pid) 50 | * 51 | * Check if pid is running 52 | * 53 | * return 0 if pid is running 54 | * return 1 if pid is not running 55 | */ 56 | int yfkm2_is_pid_running(pid_t pid) 57 | { 58 | struct task_struct *q; 59 | 60 | rcu_read_lock(); 61 | q = find_task_by_vpid(pid); 62 | rcu_read_unlock(); 63 | 64 | if (q != NULL && q->pid == pid) 65 | return 0; 66 | else 67 | return 1; 68 | } 69 | 70 | /* 71 | * yfkm2_kill(pid_t pid) 72 | * 73 | * Kills pid 74 | * 75 | * return 0 if pid was running and send SIGKILL to pid 76 | * return 1 if pid is not running 77 | */ 78 | int yfkm2_kill(pid_t pid) 79 | { 80 | struct task_struct *q; 81 | int ret; 82 | 83 | rcu_read_lock(); 84 | q = find_task_by_vpid(pid); 85 | rcu_read_unlock(); 86 | 87 | if (q != NULL) { 88 | force_sig(SIGKILL, q); 89 | return 0; 90 | } 91 | 92 | return 1; 93 | } 94 | 95 | /* 96 | * int yfkm2_kthread(void *data) 97 | * 98 | * The Kernel Thread 99 | * 100 | * Traverse the yfkm2_list looking for yfkm2->notifyme that are not 0. 101 | * If any found, check if correspondent yfkm2->monitor is still running. If not 102 | * kill yfkm2->notifyme. After traversing the list, check if the list is empty. 103 | * If so return 0. If not sleep one second and start again. 104 | * 105 | * return 0 if yfkm2_list is empty 106 | * should never return 1 107 | */ 108 | int yfkm2_kthread(void *data) /* data is NEVER used */ 109 | { 110 | struct yfkm2 *yfkm2_tmp, *yfkm2_tmp2; 111 | bool empty; 112 | 113 | while (true) { 114 | /* Needs write protection due possible item removal from list */ 115 | write_lock(&yfkm2_lock); /* Write lock */ 116 | list_for_each_entry_safe(yfkm2_tmp, yfkm2_tmp2, 117 | &yfkm2_list, list) { 118 | if (yfkm2_tmp->notifyme != 0) { 119 | if (yfkm2_is_pid_running(yfkm2_tmp->monitor) != 0) { 120 | yfkm2_kill(yfkm2_tmp->notifyme); 121 | list_del(&yfkm2_tmp->list); 122 | kfree(yfkm2_tmp); 123 | } 124 | } 125 | } 126 | write_unlock(&yfkm2_lock); /* Write unlock */ 127 | 128 | read_lock(&yfkm2_lock); /* Read lock */ 129 | empty = list_empty(&yfkm2_list); 130 | read_unlock(&yfkm2_lock); /* Read unlock */ 131 | 132 | if (empty) { 133 | /* The counter is increased at sys_yfkm2_notifyme() 134 | * Before exit, decrease atomic run counter */ 135 | atomic_dec(&yfkm2_kthread_run_count); 136 | return 0; 137 | } 138 | 139 | set_current_state(TASK_INTERRUPTIBLE); 140 | schedule_timeout(YFKM2_KT_TIMEOUT); 141 | } 142 | /* Before exit, decrease atomic run counter */ 143 | atomic_dec(&yfkm2_kthread_run_count); 144 | return 1; 145 | } 146 | 147 | /* 148 | * asmlinkage long sys_yfkm2_monitor(pid_t monitor) 149 | * 150 | * The system call that check if monitor correspond to a running pid and stores 151 | * monitor at yfkm2_list->monitor 152 | * 153 | * return 0 if pid is running 154 | * return 1 if pid is not running 155 | */ 156 | asmlinkage long sys_yfkm2_monitor(pid_t monitor) 157 | { 158 | struct yfkm2 *yfkm2_tmp; 159 | 160 | if (yfkm2_is_pid_running(monitor) == 0) { 161 | 162 | yfkm2_tmp = kmalloc(sizeof(*yfkm2_tmp), GFP_KERNEL); 163 | yfkm2_tmp->monitor = monitor; 164 | yfkm2_tmp->notifyme = 0; 165 | 166 | write_lock(&yfkm2_lock); 167 | list_add(&yfkm2_tmp->list, &yfkm2_list); 168 | write_unlock(&yfkm2_lock); 169 | 170 | return 0; 171 | } 172 | 173 | 174 | return 1; 175 | } 176 | 177 | /* 178 | * asmlinkage long sys_yfkm2_notifyme(pid_t monitor, pid_t notifyme) 179 | * 180 | * The system call that looks for monitor at yfkm2_list->monitor. If found 181 | * store notifyme at yfkm2_list->notifyme. It also starts the kernel thread 182 | * if it is not running. 183 | * 184 | * return 0 if pid is running 185 | * return 1 if pid is not running 186 | */ 187 | asmlinkage long sys_yfkm2_notifyme(pid_t monitor, pid_t notifyme) 188 | { 189 | struct yfkm2 *yfkm2_tmp; 190 | bool found_monitored_pid = false; 191 | 192 | write_lock(&yfkm2_lock); /* Write lock */ 193 | list_for_each_entry(yfkm2_tmp, &yfkm2_list, list) { 194 | if (yfkm2_tmp->monitor == monitor) { 195 | yfkm2_tmp->notifyme = notifyme; 196 | 197 | found_monitored_pid = true; 198 | 199 | break; 200 | } 201 | } 202 | write_unlock(&yfkm2_lock); /* Write unlock */ 203 | 204 | if (found_monitored_pid) { 205 | if (atomic_read(&yfkm2_kthread_run_count) < 1) { 206 | /* The counter is decreased at yfkm2_kthread() 207 | * Before start, increase atomic run counter */ 208 | atomic_inc(&yfkm2_kthread_run_count); 209 | kthread_run(&yfkm2_kthread, NULL, "yfkm2_kthread"); 210 | } 211 | 212 | return 0; 213 | } else 214 | return 1; 215 | } 216 | -------------------------------------------------------------------------------- /yfkm2/source/2.6.42.7-1.fc15/samples/yfkm2/yfkm2.c.orig: -------------------------------------------------------------------------------- 1 | /* 2 | * yfkm2 - Your first Kernel Modification v2 3 | * Peter Senna Tschudin 4 | * 5 | */ 6 | 7 | /* 8 | * KNOWN BUGS: 9 | * Does not work when trying to notify more than one process for same monitored 10 | * PID. 11 | * 12 | */ 13 | 14 | /* 15 | * TODO: 16 | * 17 | * Split .c in .c + .h 18 | * 19 | * Check if Kernel thread started correctly and treat possible errors 20 | * 21 | * Check if yfkm2_list->notify != 0 before seting new value 22 | * 23 | */ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #define YFKM2_KT_TIMEOUT (1*HZ) /* 1 second */ 32 | 33 | struct yfkm2 { 34 | pid_t monitor; /* PID to monitor */ 35 | pid_t notifyme; /* PID to notify */ 36 | struct list_head list; /* Linked List struct */ 37 | }; 38 | 39 | /* How many Kernel Threads are running? */ 40 | atomic_t yfkm2_kthread_run_count = ATOMIC_INIT(0); 41 | 42 | /* Define and initialize yfkm2_(linked)list */ 43 | LIST_HEAD(yfkm2_list); 44 | 45 | /* Define and initialize yfkm2_(read&write)lock */ 46 | DEFINE_RWLOCK(yfkm2_lock); 47 | 48 | /* 49 | * yfkm2_is_pid_running(pid_t pid) 50 | * 51 | * Check if pid is running 52 | * 53 | * return 0 if pid is running 54 | * return 1 if pid is not running 55 | */ 56 | int yfkm2_is_pid_running(pid_t pid) 57 | { 58 | struct task_struct *q; 59 | 60 | rcu_read_lock(); 61 | q = find_task_by_vpid(pid); 62 | rcu_read_unlock(); 63 | 64 | if (q != NULL && q->pid == pid) 65 | return 0; 66 | else 67 | return 1; 68 | } 69 | 70 | /* 71 | * yfkm2_kill(pid_t pid) 72 | * 73 | * Kills pid 74 | * 75 | * return 0 if pid was running and send SIGKILL to pid 76 | * return 1 if pid is not running 77 | */ 78 | int yfkm2_kill(pid_t pid) 79 | { 80 | struct task_struct *q; 81 | int ret; 82 | 83 | rcu_read_lock(); 84 | q = find_task_by_vpid(pid); 85 | rcu_read_unlock(); 86 | 87 | if (q != NULL) { 88 | force_sig(SIGKILL, q); 89 | return 0; 90 | } 91 | 92 | return 1; 93 | } 94 | 95 | /* 96 | * int yfkm2_kthread(void *data) 97 | * 98 | * The Kernel Thread 99 | * 100 | * Traverse the yfkm2_list looking for yfkm2->notifyme that are not 0. 101 | * If any found, check if correspondent yfkm2->monitor is still running. If not 102 | * kill yfkm2->notifyme. After traversing the list, check if the list is empty. 103 | * If so return 0. If not sleep one second and start again. 104 | * 105 | * return 0 if yfkm2_list is empty 106 | * should never return 1 107 | */ 108 | int yfkm2_kthread(void *data) /* data is NEVER used */ 109 | { 110 | struct yfkm2 *yfkm2_tmp, *yfkm2_tmp2; 111 | bool empty; 112 | 113 | while (true) { 114 | /* Needs write protection due possible item removal from list */ 115 | write_lock(&yfkm2_lock); /* Write lock */ 116 | list_for_each_entry_safe(yfkm2_tmp, yfkm2_tmp2, 117 | &yfkm2_list, list) { 118 | if (yfkm2_tmp->notifyme != 0) { 119 | if (yfkm2_is_pid_running(yfkm2_tmp->monitor) != 0) { 120 | yfkm2_kill(yfkm2_tmp->notifyme); 121 | list_del(&yfkm2_tmp->list); 122 | kfree(yfkm2_tmp); 123 | } 124 | } 125 | } 126 | write_unlock(&yfkm2_lock); /* Write unlock */ 127 | 128 | read_lock(&yfkm2_lock); /* Read lock */ 129 | empty = list_empty(&yfkm2_list); 130 | read_unlock(&yfkm2_lock); /* Read unlock */ 131 | 132 | if (empty) { 133 | /* The counter is increased at sys_yfkm2_notifyme() 134 | * Before exit, decrease atomic run counter */ 135 | atomic_dec(&yfkm2_kthread_run_count); 136 | return 0; 137 | } 138 | 139 | set_current_state(TASK_INTERRUPTIBLE); 140 | schedule_timeout(YFKM2_KT_TIMEOUT); 141 | } 142 | /* Before exit, decrease atomic run counter */ 143 | atomic_dec(&yfkm2_kthread_run_count); 144 | return 1; 145 | } 146 | 147 | /* 148 | * asmlinkage long sys_yfkm2_monitor(pid_t monitor) 149 | * 150 | * The system call that check if monitor correspond to a running pid and stores 151 | * monitor at yfkm2_list->monitor 152 | * 153 | * return 0 if pid is running 154 | * return 1 if pid is not running 155 | */ 156 | asmlinkage long sys_yfkm2_monitor(pid_t monitor) 157 | { 158 | struct yfkm2 *yfkm2_tmp; 159 | 160 | if (yfkm2_is_pid_running(monitor) == 0) { 161 | 162 | yfkm2_tmp = kmalloc(sizeof(*yfkm2_tmp), GFP_KERNEL); 163 | yfkm2_tmp->monitor = monitor; 164 | yfkm2_tmp->notifyme = 0; 165 | 166 | write_lock(&yfkm2_lock); 167 | list_add(&yfkm2_tmp->list, &yfkm2_list); 168 | write_unlock(&yfkm2_lock); 169 | 170 | return 0; 171 | } 172 | 173 | 174 | return 1; 175 | } 176 | 177 | /* 178 | * asmlinkage long sys_yfkm2_notifyme(pid_t monitor, pid_t notifyme) 179 | * 180 | * The system call that looks for monitor at yfkm2_list->monitor. If found 181 | * store notifyme at yfkm2_list->notifyme. It also starts the kernel thread 182 | * if it is not running. 183 | * 184 | * return 0 if pid is running 185 | * return 1 if pid is not running 186 | */ 187 | asmlinkage long sys_yfkm2_notifyme(pid_t monitor, pid_t notifyme) 188 | { 189 | struct yfkm2 *yfkm2_tmp; 190 | bool found_monitored_pid = false; 191 | 192 | write_lock(&yfkm2_lock); /* Write lock */ 193 | list_for_each_entry(yfkm2_tmp, &yfkm2_list, list) { 194 | if (yfkm2_tmp->monitor == monitor) { 195 | yfkm2_tmp->notifyme = notifyme; 196 | 197 | found_monitored_pid = true; 198 | 199 | break; 200 | } 201 | } 202 | write_unlock(&yfkm2_lock); /* Write unlock */ 203 | 204 | if (found_monitored_pid) { 205 | if (atomic_read(&yfkm2_kthread_run_count) < 1) { 206 | /* The counter is decreased at yfkm2_kthread() 207 | * Before start, increase atomic run counter */ 208 | atomic_inc(&yfkm2_kthread_run_count); 209 | kthread_run(&yfkm2_kthread, NULL, "yfkm2_kthread"); 210 | } 211 | 212 | return 0; 213 | } else 214 | return 1; 215 | } 216 | -------------------------------------------------------------------------------- /yfkm2/source/3.3.0-0.rc5.git3.1.fc17/arch/x86/syscalls/syscall_32.tbl: -------------------------------------------------------------------------------- 1 | # 2 | # 32-bit system call numbers and entry vectors 3 | # 4 | # The format is: 5 | # 6 | # 7 | # The abi is always "i386" for this file. 8 | # 9 | 0 i386 restart_syscall sys_restart_syscall 10 | 1 i386 exit sys_exit 11 | 2 i386 fork ptregs_fork stub32_fork 12 | 3 i386 read sys_read 13 | 4 i386 write sys_write 14 | 5 i386 open sys_open compat_sys_open 15 | 6 i386 close sys_close 16 | 7 i386 waitpid sys_waitpid sys32_waitpid 17 | 8 i386 creat sys_creat 18 | 9 i386 link sys_link 19 | 10 i386 unlink sys_unlink 20 | 11 i386 execve ptregs_execve stub32_execve 21 | 12 i386 chdir sys_chdir 22 | 13 i386 time sys_time compat_sys_time 23 | 14 i386 mknod sys_mknod 24 | 15 i386 chmod sys_chmod 25 | 16 i386 lchown sys_lchown16 26 | 17 i386 break 27 | 18 i386 oldstat sys_stat 28 | 19 i386 lseek sys_lseek sys32_lseek 29 | 20 i386 getpid sys_getpid 30 | 21 i386 mount sys_mount compat_sys_mount 31 | 22 i386 umount sys_oldumount 32 | 23 i386 setuid sys_setuid16 33 | 24 i386 getuid sys_getuid16 34 | 25 i386 stime sys_stime compat_sys_stime 35 | 26 i386 ptrace sys_ptrace compat_sys_ptrace 36 | 27 i386 alarm sys_alarm 37 | 28 i386 oldfstat sys_fstat 38 | 29 i386 pause sys_pause 39 | 30 i386 utime sys_utime compat_sys_utime 40 | 31 i386 stty 41 | 32 i386 gtty 42 | 33 i386 access sys_access 43 | 34 i386 nice sys_nice 44 | 35 i386 ftime 45 | 36 i386 sync sys_sync 46 | 37 i386 kill sys_kill sys32_kill 47 | 38 i386 rename sys_rename 48 | 39 i386 mkdir sys_mkdir 49 | 40 i386 rmdir sys_rmdir 50 | 41 i386 dup sys_dup 51 | 42 i386 pipe sys_pipe 52 | 43 i386 times sys_times compat_sys_times 53 | 44 i386 prof 54 | 45 i386 brk sys_brk 55 | 46 i386 setgid sys_setgid16 56 | 47 i386 getgid sys_getgid16 57 | 48 i386 signal sys_signal 58 | 49 i386 geteuid sys_geteuid16 59 | 50 i386 getegid sys_getegid16 60 | 51 i386 acct sys_acct 61 | 52 i386 umount2 sys_umount 62 | 53 i386 lock 63 | 54 i386 ioctl sys_ioctl compat_sys_ioctl 64 | 55 i386 fcntl sys_fcntl compat_sys_fcntl64 65 | 56 i386 mpx 66 | 57 i386 setpgid sys_setpgid 67 | 58 i386 ulimit 68 | 59 i386 oldolduname sys_olduname 69 | 60 i386 umask sys_umask 70 | 61 i386 chroot sys_chroot 71 | 62 i386 ustat sys_ustat compat_sys_ustat 72 | 63 i386 dup2 sys_dup2 73 | 64 i386 getppid sys_getppid 74 | 65 i386 getpgrp sys_getpgrp 75 | 66 i386 setsid sys_setsid 76 | 67 i386 sigaction sys_sigaction sys32_sigaction 77 | 68 i386 sgetmask sys_sgetmask 78 | 69 i386 ssetmask sys_ssetmask 79 | 70 i386 setreuid sys_setreuid16 80 | 71 i386 setregid sys_setregid16 81 | 72 i386 sigsuspend sys_sigsuspend sys32_sigsuspend 82 | 73 i386 sigpending sys_sigpending compat_sys_sigpending 83 | 74 i386 sethostname sys_sethostname 84 | 75 i386 setrlimit sys_setrlimit compat_sys_setrlimit 85 | 76 i386 getrlimit sys_old_getrlimit compat_sys_old_getrlimit 86 | 77 i386 getrusage sys_getrusage compat_sys_getrusage 87 | 78 i386 gettimeofday sys_gettimeofday compat_sys_gettimeofday 88 | 79 i386 settimeofday sys_settimeofday compat_sys_settimeofday 89 | 80 i386 getgroups sys_getgroups16 90 | 81 i386 setgroups sys_setgroups16 91 | 82 i386 select sys_old_select compat_sys_old_select 92 | 83 i386 symlink sys_symlink 93 | 84 i386 oldlstat sys_lstat 94 | 85 i386 readlink sys_readlink 95 | 86 i386 uselib sys_uselib 96 | 87 i386 swapon sys_swapon 97 | 88 i386 reboot sys_reboot 98 | 89 i386 readdir sys_old_readdir compat_sys_old_readdir 99 | 90 i386 mmap sys_old_mmap sys32_mmap 100 | 91 i386 munmap sys_munmap 101 | 92 i386 truncate sys_truncate 102 | 93 i386 ftruncate sys_ftruncate 103 | 94 i386 fchmod sys_fchmod 104 | 95 i386 fchown sys_fchown16 105 | 96 i386 getpriority sys_getpriority 106 | 97 i386 setpriority sys_setpriority 107 | 98 i386 profil 108 | 99 i386 statfs sys_statfs compat_sys_statfs 109 | 100 i386 fstatfs sys_fstatfs compat_sys_fstatfs 110 | 101 i386 ioperm sys_ioperm 111 | 102 i386 socketcall sys_socketcall compat_sys_socketcall 112 | 103 i386 syslog sys_syslog 113 | 104 i386 setitimer sys_setitimer compat_sys_setitimer 114 | 105 i386 getitimer sys_getitimer compat_sys_getitimer 115 | 106 i386 stat sys_newstat compat_sys_newstat 116 | 107 i386 lstat sys_newlstat compat_sys_newlstat 117 | 108 i386 fstat sys_newfstat compat_sys_newfstat 118 | 109 i386 olduname sys_uname 119 | 110 i386 iopl ptregs_iopl stub32_iopl 120 | 111 i386 vhangup sys_vhangup 121 | 112 i386 idle 122 | 113 i386 vm86old ptregs_vm86old sys32_vm86_warning 123 | 114 i386 wait4 sys_wait4 compat_sys_wait4 124 | 115 i386 swapoff sys_swapoff 125 | 116 i386 sysinfo sys_sysinfo compat_sys_sysinfo 126 | 117 i386 ipc sys_ipc sys32_ipc 127 | 118 i386 fsync sys_fsync 128 | 119 i386 sigreturn ptregs_sigreturn stub32_sigreturn 129 | 120 i386 clone ptregs_clone stub32_clone 130 | 121 i386 setdomainname sys_setdomainname 131 | 122 i386 uname sys_newuname 132 | 123 i386 modify_ldt sys_modify_ldt 133 | 124 i386 adjtimex sys_adjtimex compat_sys_adjtimex 134 | 125 i386 mprotect sys_mprotect sys32_mprotect 135 | 126 i386 sigprocmask sys_sigprocmask compat_sys_sigprocmask 136 | 127 i386 create_module 137 | 128 i386 init_module sys_init_module 138 | 129 i386 delete_module sys_delete_module 139 | 130 i386 get_kernel_syms 140 | 131 i386 quotactl sys_quotactl sys32_quotactl 141 | 132 i386 getpgid sys_getpgid 142 | 133 i386 fchdir sys_fchdir 143 | 134 i386 bdflush sys_bdflush 144 | 135 i386 sysfs sys_sysfs 145 | 136 i386 personality sys_personality 146 | 137 i386 afs_syscall 147 | 138 i386 setfsuid sys_setfsuid16 148 | 139 i386 setfsgid sys_setfsgid16 149 | 140 i386 _llseek sys_llseek 150 | 141 i386 getdents sys_getdents compat_sys_getdents 151 | 142 i386 _newselect sys_select compat_sys_select 152 | 143 i386 flock sys_flock 153 | 144 i386 msync sys_msync 154 | 145 i386 readv sys_readv compat_sys_readv 155 | 146 i386 writev sys_writev compat_sys_writev 156 | 147 i386 getsid sys_getsid 157 | 148 i386 fdatasync sys_fdatasync 158 | 149 i386 _sysctl sys_sysctl compat_sys_sysctl 159 | 150 i386 mlock sys_mlock 160 | 151 i386 munlock sys_munlock 161 | 152 i386 mlockall sys_mlockall 162 | 153 i386 munlockall sys_munlockall 163 | 154 i386 sched_setparam sys_sched_setparam 164 | 155 i386 sched_getparam sys_sched_getparam 165 | 156 i386 sched_setscheduler sys_sched_setscheduler 166 | 157 i386 sched_getscheduler sys_sched_getscheduler 167 | 158 i386 sched_yield sys_sched_yield 168 | 159 i386 sched_get_priority_max sys_sched_get_priority_max 169 | 160 i386 sched_get_priority_min sys_sched_get_priority_min 170 | 161 i386 sched_rr_get_interval sys_sched_rr_get_interval sys32_sched_rr_get_interval 171 | 162 i386 nanosleep sys_nanosleep compat_sys_nanosleep 172 | 163 i386 mremap sys_mremap 173 | 164 i386 setresuid sys_setresuid16 174 | 165 i386 getresuid sys_getresuid16 175 | 166 i386 vm86 ptregs_vm86 sys32_vm86_warning 176 | 167 i386 query_module 177 | 168 i386 poll sys_poll 178 | 169 i386 nfsservctl 179 | 170 i386 setresgid sys_setresgid16 180 | 171 i386 getresgid sys_getresgid16 181 | 172 i386 prctl sys_prctl 182 | 173 i386 rt_sigreturn ptregs_rt_sigreturn stub32_rt_sigreturn 183 | 174 i386 rt_sigaction sys_rt_sigaction sys32_rt_sigaction 184 | 175 i386 rt_sigprocmask sys_rt_sigprocmask sys32_rt_sigprocmask 185 | 176 i386 rt_sigpending sys_rt_sigpending sys32_rt_sigpending 186 | 177 i386 rt_sigtimedwait sys_rt_sigtimedwait compat_sys_rt_sigtimedwait 187 | 178 i386 rt_sigqueueinfo sys_rt_sigqueueinfo sys32_rt_sigqueueinfo 188 | 179 i386 rt_sigsuspend sys_rt_sigsuspend 189 | 180 i386 pread64 sys_pread64 sys32_pread 190 | 181 i386 pwrite64 sys_pwrite64 sys32_pwrite 191 | 182 i386 chown sys_chown16 192 | 183 i386 getcwd sys_getcwd 193 | 184 i386 capget sys_capget 194 | 185 i386 capset sys_capset 195 | 186 i386 sigaltstack ptregs_sigaltstack stub32_sigaltstack 196 | 187 i386 sendfile sys_sendfile sys32_sendfile 197 | 188 i386 getpmsg 198 | 189 i386 putpmsg 199 | 190 i386 vfork ptregs_vfork stub32_vfork 200 | 191 i386 ugetrlimit sys_getrlimit compat_sys_getrlimit 201 | 192 i386 mmap2 sys_mmap_pgoff 202 | 193 i386 truncate64 sys_truncate64 sys32_truncate64 203 | 194 i386 ftruncate64 sys_ftruncate64 sys32_ftruncate64 204 | 195 i386 stat64 sys_stat64 sys32_stat64 205 | 196 i386 lstat64 sys_lstat64 sys32_lstat64 206 | 197 i386 fstat64 sys_fstat64 sys32_fstat64 207 | 198 i386 lchown32 sys_lchown 208 | 199 i386 getuid32 sys_getuid 209 | 200 i386 getgid32 sys_getgid 210 | 201 i386 geteuid32 sys_geteuid 211 | 202 i386 getegid32 sys_getegid 212 | 203 i386 setreuid32 sys_setreuid 213 | 204 i386 setregid32 sys_setregid 214 | 205 i386 getgroups32 sys_getgroups 215 | 206 i386 setgroups32 sys_setgroups 216 | 207 i386 fchown32 sys_fchown 217 | 208 i386 setresuid32 sys_setresuid 218 | 209 i386 getresuid32 sys_getresuid 219 | 210 i386 setresgid32 sys_setresgid 220 | 211 i386 getresgid32 sys_getresgid 221 | 212 i386 chown32 sys_chown 222 | 213 i386 setuid32 sys_setuid 223 | 214 i386 setgid32 sys_setgid 224 | 215 i386 setfsuid32 sys_setfsuid 225 | 216 i386 setfsgid32 sys_setfsgid 226 | 217 i386 pivot_root sys_pivot_root 227 | 218 i386 mincore sys_mincore 228 | 219 i386 madvise sys_madvise 229 | 220 i386 getdents64 sys_getdents64 compat_sys_getdents64 230 | 221 i386 fcntl64 sys_fcntl64 compat_sys_fcntl64 231 | # 222 is unused 232 | # 223 is unused 233 | 224 i386 gettid sys_gettid 234 | 225 i386 readahead sys_readahead sys32_readahead 235 | 226 i386 setxattr sys_setxattr 236 | 227 i386 lsetxattr sys_lsetxattr 237 | 228 i386 fsetxattr sys_fsetxattr 238 | 229 i386 getxattr sys_getxattr 239 | 230 i386 lgetxattr sys_lgetxattr 240 | 231 i386 fgetxattr sys_fgetxattr 241 | 232 i386 listxattr sys_listxattr 242 | 233 i386 llistxattr sys_llistxattr 243 | 234 i386 flistxattr sys_flistxattr 244 | 235 i386 removexattr sys_removexattr 245 | 236 i386 lremovexattr sys_lremovexattr 246 | 237 i386 fremovexattr sys_fremovexattr 247 | 238 i386 tkill sys_tkill 248 | 239 i386 sendfile64 sys_sendfile64 249 | 240 i386 futex sys_futex compat_sys_futex 250 | 241 i386 sched_setaffinity sys_sched_setaffinity compat_sys_sched_setaffinity 251 | 242 i386 sched_getaffinity sys_sched_getaffinity compat_sys_sched_getaffinity 252 | 243 i386 set_thread_area sys_set_thread_area 253 | 244 i386 get_thread_area sys_get_thread_area 254 | 245 i386 io_setup sys_io_setup compat_sys_io_setup 255 | 246 i386 io_destroy sys_io_destroy 256 | 247 i386 io_getevents sys_io_getevents compat_sys_io_getevents 257 | 248 i386 io_submit sys_io_submit compat_sys_io_submit 258 | 249 i386 io_cancel sys_io_cancel 259 | 250 i386 fadvise64 sys_fadvise64 sys32_fadvise64 260 | # 251 is available for reuse (was briefly sys_set_zone_reclaim) 261 | 252 i386 exit_group sys_exit_group 262 | 253 i386 lookup_dcookie sys_lookup_dcookie sys32_lookup_dcookie 263 | 254 i386 epoll_create sys_epoll_create 264 | 255 i386 epoll_ctl sys_epoll_ctl 265 | 256 i386 epoll_wait sys_epoll_wait 266 | 257 i386 remap_file_pages sys_remap_file_pages 267 | 258 i386 set_tid_address sys_set_tid_address 268 | 259 i386 timer_create sys_timer_create compat_sys_timer_create 269 | 260 i386 timer_settime sys_timer_settime compat_sys_timer_settime 270 | 261 i386 timer_gettime sys_timer_gettime compat_sys_timer_gettime 271 | 262 i386 timer_getoverrun sys_timer_getoverrun 272 | 263 i386 timer_delete sys_timer_delete 273 | 264 i386 clock_settime sys_clock_settime compat_sys_clock_settime 274 | 265 i386 clock_gettime sys_clock_gettime compat_sys_clock_gettime 275 | 266 i386 clock_getres sys_clock_getres compat_sys_clock_getres 276 | 267 i386 clock_nanosleep sys_clock_nanosleep compat_sys_clock_nanosleep 277 | 268 i386 statfs64 sys_statfs64 compat_sys_statfs64 278 | 269 i386 fstatfs64 sys_fstatfs64 compat_sys_fstatfs64 279 | 270 i386 tgkill sys_tgkill 280 | 271 i386 utimes sys_utimes compat_sys_utimes 281 | 272 i386 fadvise64_64 sys_fadvise64_64 sys32_fadvise64_64 282 | 273 i386 vserver 283 | 274 i386 mbind sys_mbind 284 | 275 i386 get_mempolicy sys_get_mempolicy compat_sys_get_mempolicy 285 | 276 i386 set_mempolicy sys_set_mempolicy 286 | 277 i386 mq_open sys_mq_open compat_sys_mq_open 287 | 278 i386 mq_unlink sys_mq_unlink 288 | 279 i386 mq_timedsend sys_mq_timedsend compat_sys_mq_timedsend 289 | 280 i386 mq_timedreceive sys_mq_timedreceive compat_sys_mq_timedreceive 290 | 281 i386 mq_notify sys_mq_notify compat_sys_mq_notify 291 | 282 i386 mq_getsetaddr sys_mq_getsetattr compat_sys_mq_getsetattr 292 | 283 i386 kexec_load sys_kexec_load compat_sys_kexec_load 293 | 284 i386 waitid sys_waitid compat_sys_waitid 294 | # 285 sys_setaltroot 295 | 286 i386 add_key sys_add_key 296 | 287 i386 request_key sys_request_key 297 | 288 i386 keyctl sys_keyctl 298 | 289 i386 ioprio_set sys_ioprio_set 299 | 290 i386 ioprio_get sys_ioprio_get 300 | 291 i386 inotify_init sys_inotify_init 301 | 292 i386 inotify_add_watch sys_inotify_add_watch 302 | 293 i386 inotify_rm_watch sys_inotify_rm_watch 303 | 294 i386 migrate_pages sys_migrate_pages 304 | 295 i386 openat sys_openat compat_sys_openat 305 | 296 i386 mkdirat sys_mkdirat 306 | 297 i386 mknodat sys_mknodat 307 | 298 i386 fchownat sys_fchownat 308 | 299 i386 futimesat sys_futimesat compat_sys_futimesat 309 | 300 i386 fstatat64 sys_fstatat64 sys32_fstatat 310 | 301 i386 unlinkat sys_unlinkat 311 | 302 i386 renameat sys_renameat 312 | 303 i386 linkat sys_linkat 313 | 304 i386 symlinkat sys_symlinkat 314 | 305 i386 readlinkat sys_readlinkat 315 | 306 i386 fchmodat sys_fchmodat 316 | 307 i386 faccessat sys_faccessat 317 | 308 i386 pselect6 sys_pselect6 compat_sys_pselect6 318 | 309 i386 ppoll sys_ppoll compat_sys_ppoll 319 | 310 i386 unshare sys_unshare 320 | 311 i386 set_robust_list sys_set_robust_list compat_sys_set_robust_list 321 | 312 i386 get_robust_list sys_get_robust_list compat_sys_get_robust_list 322 | 313 i386 splice sys_splice 323 | 314 i386 sync_file_range sys_sync_file_range sys32_sync_file_range 324 | 315 i386 tee sys_tee 325 | 316 i386 vmsplice sys_vmsplice compat_sys_vmsplice 326 | 317 i386 move_pages sys_move_pages compat_sys_move_pages 327 | 318 i386 getcpu sys_getcpu 328 | 319 i386 epoll_pwait sys_epoll_pwait 329 | 320 i386 utimensat sys_utimensat compat_sys_utimensat 330 | 321 i386 signalfd sys_signalfd compat_sys_signalfd 331 | 322 i386 timerfd_create sys_timerfd_create 332 | 323 i386 eventfd sys_eventfd 333 | 324 i386 fallocate sys_fallocate sys32_fallocate 334 | 325 i386 timerfd_settime sys_timerfd_settime compat_sys_timerfd_settime 335 | 326 i386 timerfd_gettime sys_timerfd_gettime compat_sys_timerfd_gettime 336 | 327 i386 signalfd4 sys_signalfd4 compat_sys_signalfd4 337 | 328 i386 eventfd2 sys_eventfd2 338 | 329 i386 epoll_create1 sys_epoll_create1 339 | 330 i386 dup3 sys_dup3 340 | 331 i386 pipe2 sys_pipe2 341 | 332 i386 inotify_init1 sys_inotify_init1 342 | 333 i386 preadv sys_preadv compat_sys_preadv 343 | 334 i386 pwritev sys_pwritev compat_sys_pwritev 344 | 335 i386 rt_tgsigqueueinfo sys_rt_tgsigqueueinfo compat_sys_rt_tgsigqueueinfo 345 | 336 i386 perf_event_open sys_perf_event_open 346 | 337 i386 recvmmsg sys_recvmmsg compat_sys_recvmmsg 347 | 338 i386 fanotify_init sys_fanotify_init 348 | 339 i386 fanotify_mark sys_fanotify_mark sys32_fanotify_mark 349 | 340 i386 prlimit64 sys_prlimit64 350 | 341 i386 name_to_handle_at sys_name_to_handle_at 351 | 342 i386 open_by_handle_at sys_open_by_handle_at compat_sys_open_by_handle_at 352 | 343 i386 clock_adjtime sys_clock_adjtime compat_sys_clock_adjtime 353 | 344 i386 syncfs sys_syncfs 354 | 345 i386 sendmmsg sys_sendmmsg compat_sys_sendmmsg 355 | 346 i386 setns sys_setns 356 | 347 i386 process_vm_readv sys_process_vm_readv compat_sys_process_vm_readv 357 | 348 i386 process_vm_writev sys_process_vm_writev compat_sys_process_vm_writev 358 | 349 i386 yfkm2_monitor sys_yfkm2_monitor 359 | 350 i386 yfkm2_notifyme sys_yfkm2_notifyme 360 | -------------------------------------------------------------------------------- /yfkm2/source/3.3.0-0.rc5.git3.1.fc17/arch/x86/syscalls/syscall_64.tbl: -------------------------------------------------------------------------------- 1 | # 2 | # 64-bit system call numbers and entry vectors 3 | # 4 | # The format is: 5 | # 6 | # 7 | # The abi is always "64" for this file (for now.) 8 | # 9 | 0 64 read sys_read 10 | 1 64 write sys_write 11 | 2 64 open sys_open 12 | 3 64 close sys_close 13 | 4 64 stat sys_newstat 14 | 5 64 fstat sys_newfstat 15 | 6 64 lstat sys_newlstat 16 | 7 64 poll sys_poll 17 | 8 64 lseek sys_lseek 18 | 9 64 mmap sys_mmap 19 | 10 64 mprotect sys_mprotect 20 | 11 64 munmap sys_munmap 21 | 12 64 brk sys_brk 22 | 13 64 rt_sigaction sys_rt_sigaction 23 | 14 64 rt_sigprocmask sys_rt_sigprocmask 24 | 15 64 rt_sigreturn stub_rt_sigreturn 25 | 16 64 ioctl sys_ioctl 26 | 17 64 pread64 sys_pread64 27 | 18 64 pwrite64 sys_pwrite64 28 | 19 64 readv sys_readv 29 | 20 64 writev sys_writev 30 | 21 64 access sys_access 31 | 22 64 pipe sys_pipe 32 | 23 64 select sys_select 33 | 24 64 sched_yield sys_sched_yield 34 | 25 64 mremap sys_mremap 35 | 26 64 msync sys_msync 36 | 27 64 mincore sys_mincore 37 | 28 64 madvise sys_madvise 38 | 29 64 shmget sys_shmget 39 | 30 64 shmat sys_shmat 40 | 31 64 shmctl sys_shmctl 41 | 32 64 dup sys_dup 42 | 33 64 dup2 sys_dup2 43 | 34 64 pause sys_pause 44 | 35 64 nanosleep sys_nanosleep 45 | 36 64 getitimer sys_getitimer 46 | 37 64 alarm sys_alarm 47 | 38 64 setitimer sys_setitimer 48 | 39 64 getpid sys_getpid 49 | 40 64 sendfile sys_sendfile64 50 | 41 64 socket sys_socket 51 | 42 64 connect sys_connect 52 | 43 64 accept sys_accept 53 | 44 64 sendto sys_sendto 54 | 45 64 recvfrom sys_recvfrom 55 | 46 64 sendmsg sys_sendmsg 56 | 47 64 recvmsg sys_recvmsg 57 | 48 64 shutdown sys_shutdown 58 | 49 64 bind sys_bind 59 | 50 64 listen sys_listen 60 | 51 64 getsockname sys_getsockname 61 | 52 64 getpeername sys_getpeername 62 | 53 64 socketpair sys_socketpair 63 | 54 64 setsockopt sys_setsockopt 64 | 55 64 getsockopt sys_getsockopt 65 | 56 64 clone stub_clone 66 | 57 64 fork stub_fork 67 | 58 64 vfork stub_vfork 68 | 59 64 execve stub_execve 69 | 60 64 exit sys_exit 70 | 61 64 wait4 sys_wait4 71 | 62 64 kill sys_kill 72 | 63 64 uname sys_newuname 73 | 64 64 semget sys_semget 74 | 65 64 semop sys_semop 75 | 66 64 semctl sys_semctl 76 | 67 64 shmdt sys_shmdt 77 | 68 64 msgget sys_msgget 78 | 69 64 msgsnd sys_msgsnd 79 | 70 64 msgrcv sys_msgrcv 80 | 71 64 msgctl sys_msgctl 81 | 72 64 fcntl sys_fcntl 82 | 73 64 flock sys_flock 83 | 74 64 fsync sys_fsync 84 | 75 64 fdatasync sys_fdatasync 85 | 76 64 truncate sys_truncate 86 | 77 64 ftruncate sys_ftruncate 87 | 78 64 getdents sys_getdents 88 | 79 64 getcwd sys_getcwd 89 | 80 64 chdir sys_chdir 90 | 81 64 fchdir sys_fchdir 91 | 82 64 rename sys_rename 92 | 83 64 mkdir sys_mkdir 93 | 84 64 rmdir sys_rmdir 94 | 85 64 creat sys_creat 95 | 86 64 link sys_link 96 | 87 64 unlink sys_unlink 97 | 88 64 symlink sys_symlink 98 | 89 64 readlink sys_readlink 99 | 90 64 chmod sys_chmod 100 | 91 64 fchmod sys_fchmod 101 | 92 64 chown sys_chown 102 | 93 64 fchown sys_fchown 103 | 94 64 lchown sys_lchown 104 | 95 64 umask sys_umask 105 | 96 64 gettimeofday sys_gettimeofday 106 | 97 64 getrlimit sys_getrlimit 107 | 98 64 getrusage sys_getrusage 108 | 99 64 sysinfo sys_sysinfo 109 | 100 64 times sys_times 110 | 101 64 ptrace sys_ptrace 111 | 102 64 getuid sys_getuid 112 | 103 64 syslog sys_syslog 113 | 104 64 getgid sys_getgid 114 | 105 64 setuid sys_setuid 115 | 106 64 setgid sys_setgid 116 | 107 64 geteuid sys_geteuid 117 | 108 64 getegid sys_getegid 118 | 109 64 setpgid sys_setpgid 119 | 110 64 getppid sys_getppid 120 | 111 64 getpgrp sys_getpgrp 121 | 112 64 setsid sys_setsid 122 | 113 64 setreuid sys_setreuid 123 | 114 64 setregid sys_setregid 124 | 115 64 getgroups sys_getgroups 125 | 116 64 setgroups sys_setgroups 126 | 117 64 setresuid sys_setresuid 127 | 118 64 getresuid sys_getresuid 128 | 119 64 setresgid sys_setresgid 129 | 120 64 getresgid sys_getresgid 130 | 121 64 getpgid sys_getpgid 131 | 122 64 setfsuid sys_setfsuid 132 | 123 64 setfsgid sys_setfsgid 133 | 124 64 getsid sys_getsid 134 | 125 64 capget sys_capget 135 | 126 64 capset sys_capset 136 | 127 64 rt_sigpending sys_rt_sigpending 137 | 128 64 rt_sigtimedwait sys_rt_sigtimedwait 138 | 129 64 rt_sigqueueinfo sys_rt_sigqueueinfo 139 | 130 64 rt_sigsuspend sys_rt_sigsuspend 140 | 131 64 sigaltstack stub_sigaltstack 141 | 132 64 utime sys_utime 142 | 133 64 mknod sys_mknod 143 | 134 64 uselib 144 | 135 64 personality sys_personality 145 | 136 64 ustat sys_ustat 146 | 137 64 statfs sys_statfs 147 | 138 64 fstatfs sys_fstatfs 148 | 139 64 sysfs sys_sysfs 149 | 140 64 getpriority sys_getpriority 150 | 141 64 setpriority sys_setpriority 151 | 142 64 sched_setparam sys_sched_setparam 152 | 143 64 sched_getparam sys_sched_getparam 153 | 144 64 sched_setscheduler sys_sched_setscheduler 154 | 145 64 sched_getscheduler sys_sched_getscheduler 155 | 146 64 sched_get_priority_max sys_sched_get_priority_max 156 | 147 64 sched_get_priority_min sys_sched_get_priority_min 157 | 148 64 sched_rr_get_interval sys_sched_rr_get_interval 158 | 149 64 mlock sys_mlock 159 | 150 64 munlock sys_munlock 160 | 151 64 mlockall sys_mlockall 161 | 152 64 munlockall sys_munlockall 162 | 153 64 vhangup sys_vhangup 163 | 154 64 modify_ldt sys_modify_ldt 164 | 155 64 pivot_root sys_pivot_root 165 | 156 64 _sysctl sys_sysctl 166 | 157 64 prctl sys_prctl 167 | 158 64 arch_prctl sys_arch_prctl 168 | 159 64 adjtimex sys_adjtimex 169 | 160 64 setrlimit sys_setrlimit 170 | 161 64 chroot sys_chroot 171 | 162 64 sync sys_sync 172 | 163 64 acct sys_acct 173 | 164 64 settimeofday sys_settimeofday 174 | 165 64 mount sys_mount 175 | 166 64 umount2 sys_umount 176 | 167 64 swapon sys_swapon 177 | 168 64 swapoff sys_swapoff 178 | 169 64 reboot sys_reboot 179 | 170 64 sethostname sys_sethostname 180 | 171 64 setdomainname sys_setdomainname 181 | 172 64 iopl stub_iopl 182 | 173 64 ioperm sys_ioperm 183 | 174 64 create_module 184 | 175 64 init_module sys_init_module 185 | 176 64 delete_module sys_delete_module 186 | 177 64 get_kernel_syms 187 | 178 64 query_module 188 | 179 64 quotactl sys_quotactl 189 | 180 64 nfsservctl 190 | 181 64 getpmsg 191 | 182 64 putpmsg 192 | 183 64 afs_syscall 193 | 184 64 tuxcall 194 | 185 64 security 195 | 186 64 gettid sys_gettid 196 | 187 64 readahead sys_readahead 197 | 188 64 setxattr sys_setxattr 198 | 189 64 lsetxattr sys_lsetxattr 199 | 190 64 fsetxattr sys_fsetxattr 200 | 191 64 getxattr sys_getxattr 201 | 192 64 lgetxattr sys_lgetxattr 202 | 193 64 fgetxattr sys_fgetxattr 203 | 194 64 listxattr sys_listxattr 204 | 195 64 llistxattr sys_llistxattr 205 | 196 64 flistxattr sys_flistxattr 206 | 197 64 removexattr sys_removexattr 207 | 198 64 lremovexattr sys_lremovexattr 208 | 199 64 fremovexattr sys_fremovexattr 209 | 200 64 tkill sys_tkill 210 | 201 64 time sys_time 211 | 202 64 futex sys_futex 212 | 203 64 sched_setaffinity sys_sched_setaffinity 213 | 204 64 sched_getaffinity sys_sched_getaffinity 214 | 205 64 set_thread_area 215 | 206 64 io_setup sys_io_setup 216 | 207 64 io_destroy sys_io_destroy 217 | 208 64 io_getevents sys_io_getevents 218 | 209 64 io_submit sys_io_submit 219 | 210 64 io_cancel sys_io_cancel 220 | 211 64 get_thread_area 221 | 212 64 lookup_dcookie sys_lookup_dcookie 222 | 213 64 epoll_create sys_epoll_create 223 | 214 64 epoll_ctl_old 224 | 215 64 epoll_wait_old 225 | 216 64 remap_file_pages sys_remap_file_pages 226 | 217 64 getdents64 sys_getdents64 227 | 218 64 set_tid_address sys_set_tid_address 228 | 219 64 restart_syscall sys_restart_syscall 229 | 220 64 semtimedop sys_semtimedop 230 | 221 64 fadvise64 sys_fadvise64 231 | 222 64 timer_create sys_timer_create 232 | 223 64 timer_settime sys_timer_settime 233 | 224 64 timer_gettime sys_timer_gettime 234 | 225 64 timer_getoverrun sys_timer_getoverrun 235 | 226 64 timer_delete sys_timer_delete 236 | 227 64 clock_settime sys_clock_settime 237 | 228 64 clock_gettime sys_clock_gettime 238 | 229 64 clock_getres sys_clock_getres 239 | 230 64 clock_nanosleep sys_clock_nanosleep 240 | 231 64 exit_group sys_exit_group 241 | 232 64 epoll_wait sys_epoll_wait 242 | 233 64 epoll_ctl sys_epoll_ctl 243 | 234 64 tgkill sys_tgkill 244 | 235 64 utimes sys_utimes 245 | 236 64 vserver 246 | 237 64 mbind sys_mbind 247 | 238 64 set_mempolicy sys_set_mempolicy 248 | 239 64 get_mempolicy sys_get_mempolicy 249 | 240 64 mq_open sys_mq_open 250 | 241 64 mq_unlink sys_mq_unlink 251 | 242 64 mq_timedsend sys_mq_timedsend 252 | 243 64 mq_timedreceive sys_mq_timedreceive 253 | 244 64 mq_notify sys_mq_notify 254 | 245 64 mq_getsetattr sys_mq_getsetattr 255 | 246 64 kexec_load sys_kexec_load 256 | 247 64 waitid sys_waitid 257 | 248 64 add_key sys_add_key 258 | 249 64 request_key sys_request_key 259 | 250 64 keyctl sys_keyctl 260 | 251 64 ioprio_set sys_ioprio_set 261 | 252 64 ioprio_get sys_ioprio_get 262 | 253 64 inotify_init sys_inotify_init 263 | 254 64 inotify_add_watch sys_inotify_add_watch 264 | 255 64 inotify_rm_watch sys_inotify_rm_watch 265 | 256 64 migrate_pages sys_migrate_pages 266 | 257 64 openat sys_openat 267 | 258 64 mkdirat sys_mkdirat 268 | 259 64 mknodat sys_mknodat 269 | 260 64 fchownat sys_fchownat 270 | 261 64 futimesat sys_futimesat 271 | 262 64 newfstatat sys_newfstatat 272 | 263 64 unlinkat sys_unlinkat 273 | 264 64 renameat sys_renameat 274 | 265 64 linkat sys_linkat 275 | 266 64 symlinkat sys_symlinkat 276 | 267 64 readlinkat sys_readlinkat 277 | 268 64 fchmodat sys_fchmodat 278 | 269 64 faccessat sys_faccessat 279 | 270 64 pselect6 sys_pselect6 280 | 271 64 ppoll sys_ppoll 281 | 272 64 unshare sys_unshare 282 | 273 64 set_robust_list sys_set_robust_list 283 | 274 64 get_robust_list sys_get_robust_list 284 | 275 64 splice sys_splice 285 | 276 64 tee sys_tee 286 | 277 64 sync_file_range sys_sync_file_range 287 | 278 64 vmsplice sys_vmsplice 288 | 279 64 move_pages sys_move_pages 289 | 280 64 utimensat sys_utimensat 290 | 281 64 epoll_pwait sys_epoll_pwait 291 | 282 64 signalfd sys_signalfd 292 | 283 64 timerfd_create sys_timerfd_create 293 | 284 64 eventfd sys_eventfd 294 | 285 64 fallocate sys_fallocate 295 | 286 64 timerfd_settime sys_timerfd_settime 296 | 287 64 timerfd_gettime sys_timerfd_gettime 297 | 288 64 accept4 sys_accept4 298 | 289 64 signalfd4 sys_signalfd4 299 | 290 64 eventfd2 sys_eventfd2 300 | 291 64 epoll_create1 sys_epoll_create1 301 | 292 64 dup3 sys_dup3 302 | 293 64 pipe2 sys_pipe2 303 | 294 64 inotify_init1 sys_inotify_init1 304 | 295 64 preadv sys_preadv 305 | 296 64 pwritev sys_pwritev 306 | 297 64 rt_tgsigqueueinfo sys_rt_tgsigqueueinfo 307 | 298 64 perf_event_open sys_perf_event_open 308 | 299 64 recvmmsg sys_recvmmsg 309 | 300 64 fanotify_init sys_fanotify_init 310 | 301 64 fanotify_mark sys_fanotify_mark 311 | 302 64 prlimit64 sys_prlimit64 312 | 303 64 name_to_handle_at sys_name_to_handle_at 313 | 304 64 open_by_handle_at sys_open_by_handle_at 314 | 305 64 clock_adjtime sys_clock_adjtime 315 | 306 64 syncfs sys_syncfs 316 | 307 64 sendmmsg sys_sendmmsg 317 | 308 64 setns sys_setns 318 | 309 64 getcpu sys_getcpu 319 | 310 64 process_vm_readv sys_process_vm_readv 320 | 311 64 process_vm_writev sys_process_vm_writev 321 | 312 64 yfkm2_monitor sys_yfkm2_monitor 322 | 313 64 yfkm2_notifyme sys_yfkm2_notifyme 323 | -------------------------------------------------------------------------------- /yfkm2/source/3.3.0-0.rc5.git3.1.fc17/samples/yfkm2/Makefile: -------------------------------------------------------------------------------- 1 | obj-y := yfkm2.o 2 | -------------------------------------------------------------------------------- /yfkm2/source/3.3.0-0.rc5.git3.1.fc17/samples/yfkm2/userspace/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | gcc monitor.c -o monitor 3 | gcc notifyme.c -o notifyme 4 | 5 | clean: 6 | rm monitor 7 | rm notifyme 8 | -------------------------------------------------------------------------------- /yfkm2/source/3.3.0-0.rc5.git3.1.fc17/samples/yfkm2/userspace/monitor.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define SYS_yfkm2_monitor __NR_yfkm2_monitor 6 | #define SYS_yfkm2_notifyme __NR_yfkm2_notifyme 7 | 8 | int main (int argc, char *argv[]) 9 | { 10 | 11 | if (argc < 2) { 12 | printf("Error. Use %s \n", argv[0]); 13 | return 1; 14 | } 15 | pid_t pid = atoi(argv[1]); 16 | long ret; 17 | 18 | 19 | ret = syscall(SYS_yfkm2_monitor, pid); 20 | 21 | if (ret == 0){ 22 | printf("Sucess on adding %d!\n", pid); 23 | return 0; 24 | } else { 25 | printf("Failure! Is %s a valid PID?\n", argv[1]); 26 | return 1; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /yfkm2/source/3.3.0-0.rc5.git3.1.fc17/samples/yfkm2/userspace/notifyme.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define SYS_yfkm2_monitor __NR_yfkm2_monitor 6 | #define SYS_yfkm2_notifyme __NR_yfkm2_notifyme 7 | 8 | int main (int argc, char *argv[]) 9 | { 10 | 11 | if (argc < 2) { 12 | printf("Error. Use %s \n", argv[0]); 13 | return 1; 14 | } 15 | 16 | pid_t monitor, notifyme; 17 | long ret; 18 | 19 | monitor = atoi(argv[1]); 20 | notifyme = getpid(); 21 | 22 | ret = syscall(SYS_yfkm2_notifyme, monitor, notifyme); 23 | 24 | if (ret == 0){ 25 | printf("Sucess on adding %d!\n", monitor); 26 | printf("Finish %d to see what happens to me.\n", monitor); 27 | while (1) 28 | sleep (10); 29 | } else { 30 | printf("Failure! Is %s a valid PID?\n", argv[1]); 31 | return 1; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /yfkm2/source/3.3.0-0.rc5.git3.1.fc17/samples/yfkm2/yfkm2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * yfkm2 - Your first Kernel Modification v2 3 | * Peter Senna Tschudin 4 | * 5 | */ 6 | 7 | /* 8 | * KNOWN BUGS: 9 | * Does not work when trying to notify more than one process for same monitored 10 | * PID. 11 | * 12 | */ 13 | 14 | /* 15 | * TODO: 16 | * 17 | * Split .c in .c + .h 18 | * 19 | * Check if Kernel thread started correctly and treat possible errors 20 | * 21 | * Check if yfkm2_list->notify != 0 before seting new value 22 | * 23 | */ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #define YFKM2_KT_TIMEOUT (1*HZ) /* 1 second */ 32 | 33 | struct yfkm2 { 34 | pid_t monitor; /* PID to monitor */ 35 | pid_t notifyme; /* PID to notify */ 36 | struct list_head list; /* Linked List struct */ 37 | }; 38 | 39 | /* How many Kernel Threads are running? */ 40 | atomic_t yfkm2_kthread_run_count = ATOMIC_INIT(0); 41 | 42 | /* Define and initialize yfkm2_(linked)list */ 43 | LIST_HEAD(yfkm2_list); 44 | 45 | /* Define and initialize yfkm2_(read&write)lock */ 46 | DEFINE_RWLOCK(yfkm2_lock); 47 | 48 | /* 49 | * yfkm2_is_pid_running(pid_t pid) 50 | * 51 | * Check if pid is running 52 | * 53 | * return 0 if pid is running 54 | * return 1 if pid is not running 55 | */ 56 | int yfkm2_is_pid_running(pid_t pid) 57 | { 58 | struct task_struct *q; 59 | 60 | rcu_read_lock(); 61 | q = find_task_by_vpid(pid); 62 | rcu_read_unlock(); 63 | 64 | if (q != NULL && q->pid == pid) 65 | return 0; 66 | else 67 | return 1; 68 | } 69 | 70 | /* 71 | * yfkm2_kill(pid_t pid) 72 | * 73 | * Kills pid 74 | * 75 | * return 0 if pid was running and send SIGKILL to pid 76 | * return 1 if pid is not running 77 | */ 78 | int yfkm2_kill(pid_t pid) 79 | { 80 | struct task_struct *q; 81 | int ret; 82 | 83 | rcu_read_lock(); 84 | q = find_task_by_vpid(pid); 85 | rcu_read_unlock(); 86 | 87 | if (q != NULL) { 88 | force_sig(SIGKILL, q); 89 | return 0; 90 | } 91 | 92 | return 1; 93 | } 94 | 95 | /* 96 | * int yfkm2_kthread(void *data) 97 | * 98 | * The Kernel Thread 99 | * 100 | * Traverse the yfkm2_list looking for yfkm2->notifyme that are not 0. 101 | * If any found, check if correspondent yfkm2->monitor is still running. If not 102 | * kill yfkm2->notifyme. After traversing the list, check if the list is empty. 103 | * If so return 0. If not sleep one second and start again. 104 | * 105 | * return 0 if yfkm2_list is empty 106 | * should never return 1 107 | */ 108 | int yfkm2_kthread(void *data) /* data is NEVER used */ 109 | { 110 | struct yfkm2 *yfkm2_tmp, *yfkm2_tmp2; 111 | bool empty; 112 | 113 | while (true) { 114 | /* Needs write protection due possible item removal from list */ 115 | write_lock(&yfkm2_lock); /* Write lock */ 116 | list_for_each_entry_safe(yfkm2_tmp, yfkm2_tmp2, 117 | &yfkm2_list, list) { 118 | if (yfkm2_tmp->notifyme != 0) { 119 | if (yfkm2_is_pid_running(yfkm2_tmp->monitor) != 0) { 120 | yfkm2_kill(yfkm2_tmp->notifyme); 121 | list_del(&yfkm2_tmp->list); 122 | kfree(yfkm2_tmp); 123 | } 124 | } 125 | } 126 | write_unlock(&yfkm2_lock); /* Write unlock */ 127 | 128 | read_lock(&yfkm2_lock); /* Read lock */ 129 | empty = list_empty(&yfkm2_list); 130 | read_unlock(&yfkm2_lock); /* Read unlock */ 131 | 132 | if (empty) { 133 | /* The counter is increased at sys_yfkm2_notifyme() 134 | * Before exit, decrease atomic run counter */ 135 | atomic_dec(&yfkm2_kthread_run_count); 136 | return 0; 137 | } 138 | 139 | set_current_state(TASK_INTERRUPTIBLE); 140 | schedule_timeout(YFKM2_KT_TIMEOUT); 141 | } 142 | /* Before exit, decrease atomic run counter */ 143 | atomic_dec(&yfkm2_kthread_run_count); 144 | return 1; 145 | } 146 | 147 | /* 148 | * asmlinkage long sys_yfkm2_monitor(pid_t monitor) 149 | * 150 | * The system call that check if monitor correspond to a running pid and stores 151 | * monitor at yfkm2_list->monitor 152 | * 153 | * return 0 if pid is running 154 | * return 1 if pid is not running 155 | */ 156 | asmlinkage long sys_yfkm2_monitor(pid_t monitor) 157 | { 158 | struct yfkm2 *yfkm2_tmp; 159 | 160 | if (yfkm2_is_pid_running(monitor) == 0) { 161 | 162 | yfkm2_tmp = kmalloc(sizeof(*yfkm2_tmp), GFP_KERNEL); 163 | yfkm2_tmp->monitor = monitor; 164 | yfkm2_tmp->notifyme = 0; 165 | 166 | write_lock(&yfkm2_lock); 167 | list_add(&yfkm2_tmp->list, &yfkm2_list); 168 | write_unlock(&yfkm2_lock); 169 | 170 | return 0; 171 | } 172 | 173 | 174 | return 1; 175 | } 176 | 177 | /* 178 | * asmlinkage long sys_yfkm2_notifyme(pid_t monitor, pid_t notifyme) 179 | * 180 | * The system call that looks for monitor at yfkm2_list->monitor. If found 181 | * store notifyme at yfkm2_list->notifyme. It also starts the kernel thread 182 | * if it is not running. 183 | * 184 | * return 0 if pid is running 185 | * return 1 if pid is not running 186 | */ 187 | asmlinkage long sys_yfkm2_notifyme(pid_t monitor, pid_t notifyme) 188 | { 189 | struct yfkm2 *yfkm2_tmp; 190 | bool found_monitored_pid = false; 191 | 192 | write_lock(&yfkm2_lock); /* Write lock */ 193 | list_for_each_entry(yfkm2_tmp, &yfkm2_list, list) { 194 | if (yfkm2_tmp->monitor == monitor) { 195 | yfkm2_tmp->notifyme = notifyme; 196 | 197 | found_monitored_pid = true; 198 | 199 | break; 200 | } 201 | } 202 | write_unlock(&yfkm2_lock); /* Write unlock */ 203 | 204 | if (found_monitored_pid) { 205 | if (atomic_read(&yfkm2_kthread_run_count) < 1) { 206 | /* The counter is decreased at yfkm2_kthread() 207 | * Before start, increase atomic run counter */ 208 | atomic_inc(&yfkm2_kthread_run_count); 209 | kthread_run(&yfkm2_kthread, NULL, "yfkm2_kthread"); 210 | } 211 | 212 | return 0; 213 | } else 214 | return 1; 215 | } 216 | --------------------------------------------------------------------------------