| | 1 | [[PageOutline]] |
| | 2 | |
| | 3 | = 11/02 = |
| | 4 | == informative system calls == |
| | 5 | * kernel/sys.c |
| | 6 | * sethostname, gethostname |
| | 7 | * about copy_to_user/copy_from_user |
| | 8 | * kernel/hrtimer.c |
| | 9 | * nanosleep |
| | 10 | * about timespec |
| | 11 | * kernel/posix-timers.c |
| | 12 | * clock_gettime |
| | 13 | * about timespec |
| | 14 | * kernel/module.c |
| | 15 | * delete_module |
| | 16 | * about strncpy_from_user |
| | 17 | * kernel/printk.c |
| | 18 | * about !__LOG_BUF_LEN/access_ok |
| | 19 | |
| | 20 | == testing new_debug syscall == |
| | 21 | * windell57:i386 s0711489$ make -j2 |
| | 22 | {{{ |
| | 23 | Kernel: arch/x86/boot/bzImage is ready (#3) |
| | 24 | }}} |
| | 25 | |
| | 26 | * s0711489@ubuntu-lucid:~$ sudo /mnt/hgfs/tools/install.sh |
| | 27 | * s0711489@ubuntu-lucid:~$ sudo reboot |
| | 28 | |
| | 29 | * s0711489@ubuntu-lucid:~$ cat > new_debug-sys.c |
| | 30 | * s0711489@ubuntu-lucid:~$ gcc -I /lib/modules/2.6.35.14/build/arch/x86/include/ new_debug-sys.c |
| | 31 | |
| | 32 | * s0711489@ubuntu-lucid:~$ ./a.out |
| | 33 | {{{ |
| | 34 | new_debug() |
| | 35 | }}} |
| | 36 | * s0711489@ubuntu-lucid:~$ dmesg | tail -n 2 |
| | 37 | {{{ |
| | 38 | [ 6.833440] dhclient3 used greatest stack depth: 5560 bytes left |
| | 39 | [ 579.378377] new_debug() |
| | 40 | }}} |
| | 41 | * s0711489@ubuntu-lucid:~$ ./a.out hoge fuga piyo |
| | 42 | {{{ |
| | 43 | [-570566464.-1216585740] hoge |
| | 44 | [0.000000000] fuga |
| | 45 | [0.000000000] piyo |
| | 46 | }}} |
| | 47 | * s0711489@ubuntu-lucid:~$ dmesg | tail -n 5 |
| | 48 | {{{ |
| | 49 | [ 6.833440] dhclient3 used greatest stack depth: 5560 bytes left |
| | 50 | [ 579.378377] new_debug() |
| | 51 | [ 596.785236] hoge |
| | 52 | [ 596.785274] fuga |
| | 53 | [ 596.785282] piyo |
| | 54 | }}} |
| | 55 | |
| | 56 | == maybe useful == |
| | 57 | * http://hira-consulting.com/wiki/index.php?linux2.6%2Farch%2Fi386%2Flib%2Fusercopy.c |
| | 58 | * http://hira-consulting.com/wiki/?linux2.6%2Finclude%2Flinux%2Ferr.h |
| | 59 | * IS_ERR_OR_NULL |
| | 60 | * !__LOG_BUF_LEN |
| | 61 | |
| | 62 | * https://www.codeblog.org/blog/gniibe/20060323.html |
| | 63 | * [https://www.codeblog.org/blog/gniibe/20060327.html#p02 get_user/put_user, set_fs のまとめ] |
| | 64 | * http://www.ibm.com/developerworks/jp/linux/library/l-system-calls/ の「copy_to_user」の定義が変 |
| | 65 | {{{ |
| | 66 | unsigned long copy_from_user( void *to, const void __user *from, unsigned long n ); |
| | 67 | unsigned long copy_to_user( void *to, const void __user *from, unsigned long n ); |
| | 68 | }}} |
| | 69 | * 以下が正しい |
| | 70 | {{{ |
| | 71 | unsigned long copy_from_user( void *to, const void __user *from, unsigned long n ); |
| | 72 | unsigned long copy_to_user( void __user *to, const void *from, unsigned long n ); |
| | 73 | }}} |