[[PageOutline]] = 11/02 = == informative system calls == * kernel/sys.c * sethostname, gethostname * about copy_to_user/copy_from_user * kernel/hrtimer.c * nanosleep * about timespec * kernel/posix-timers.c * clock_gettime * about timespec * kernel/module.c * delete_module * about strncpy_from_user * kernel/printk.c * about !__LOG_BUF_LEN/access_ok == testing new_debug syscall == * windell57:i386 s0711489$ make -j2 {{{ Kernel: arch/x86/boot/bzImage is ready (#3) }}} * s0711489@ubuntu-lucid:~$ sudo /mnt/hgfs/tools/install.sh * s0711489@ubuntu-lucid:~$ sudo reboot * s0711489@ubuntu-lucid:~$ cat > new_debug-sys.c * s0711489@ubuntu-lucid:~$ gcc -I /lib/modules/2.6.35.14/build/arch/x86/include/ new_debug-sys.c * s0711489@ubuntu-lucid:~$ ./a.out {{{ new_debug() }}} * s0711489@ubuntu-lucid:~$ dmesg | tail -n 2 {{{ [ 6.833440] dhclient3 used greatest stack depth: 5560 bytes left [ 579.378377] new_debug() }}} * s0711489@ubuntu-lucid:~$ ./a.out hoge fuga piyo {{{ [-570566464.-1216585740] hoge [0.000000000] fuga [0.000000000] piyo }}} * s0711489@ubuntu-lucid:~$ dmesg | tail -n 5 {{{ [ 6.833440] dhclient3 used greatest stack depth: 5560 bytes left [ 579.378377] new_debug() [ 596.785236] hoge [ 596.785274] fuga [ 596.785282] piyo }}} == maybe useful == * http://hira-consulting.com/wiki/index.php?linux2.6%2Farch%2Fi386%2Flib%2Fusercopy.c * http://hira-consulting.com/wiki/?linux2.6%2Finclude%2Flinux%2Ferr.h * IS_ERR_OR_NULL * !__LOG_BUF_LEN * https://www.codeblog.org/blog/gniibe/20060323.html * [https://www.codeblog.org/blog/gniibe/20060327.html#p02 get_user/put_user, set_fs のまとめ] * http://www.ibm.com/developerworks/jp/linux/library/l-system-calls/ の「copy_to_user」の定義が変 {{{ unsigned long copy_from_user( void *to, const void __user *from, unsigned long n ); unsigned long copy_to_user( void *to, const void __user *from, unsigned long n ); }}} * 以下が正しい {{{ unsigned long copy_from_user( void *to, const void __user *from, unsigned long n ); unsigned long copy_to_user( void __user *to, const void *from, unsigned long n ); }}} = 11/04 = * define as '''static''' char !__log_buf[!__LOG_BUF_LEN] in printk.c * sys_clock_gettime uses copy_to_user in its code