今天正好想起来,其实可以返汇编看看用户模式下的Kyth和FreeBSD下的libpthread有什么不同。后来发现这个libpthread-kyth.so是没有strip过的(不像麒麟新发布的2.1-01的内核竟然经过了strip,并且还修改了引导部分,不知道这么做是在躲避什么,呵呵),这样我可以看看够成这个可执行文件都有哪些源文件。
愿意重现的可以按照以下方式重现,非常简单。
麒麟操作系统下执行:
strings /lib/libpthread-kyth.so | grep kyth | sort
FreeBSD的下执行:
strings /usr/lib/libpthread.so | grep src | sort
结果对比如下:
/lib/libpthread-kyth.so
/usr/lib/libpthread.so.1
/root/kyth1.6/sys/lock.c
/root/kyth1.6/thread/thr_cancel.c
/root/kyth1.6/thread/thr_concurrency.c
/root/kyth1.6/thread/thr_cond.c
/root/kyth1.6/thread/thr_create.c
/root/kyth1.6/thread/thr_detach.c
/root/kyth1.6/thread/thr_exit.c
/root/kyth1.6/thread/thr_find_thread.c
/root/kyth1.6/thread/thr_getschedparam.c
/root/kyth1.6/thread/thr_init.c
/root/kyth1.6/thread/thr_join.c
/root/kyth1.6/thread/thr_kern.c
/root/kyth1.6/thread/thr_mutex.c
/root/kyth1.6/thread/thr_nanosleep.c
/root/kyth1.6/thread/thr_priority_queue.c
/root/kyth1.6/thread/thr_resume_np.c
/root/kyth1.6/thread/thr_rwlock.c
/root/kyth1.6/thread/thr_setschedparam.c
/root/kyth1.6/thread/thr_sigaction.c
/root/kyth1.6/thread/thr_sig.c
/root/kyth1.6/thread/thr_sigmask.c
/root/kyth1.6/thread/thr_sigpending.c
/root/kyth1.6/thread/thr_sigsuspend.c
/root/kyth1.6/thread/thr_sigwait.c
/root/kyth1.6/thread/thr_spec.c
/root/kyth1.6/thread/thr_spinlock.c
/root/kyth1.6/thread/thr_stack.c
/root/kyth1.6/thread/thr_suspend_np.c
$FreeBSD: src/lib/csu/i386-elf/crti.S,v 1.6 2002/05/15 04:19:49 obrien Exp $
$FreeBSD: src/lib/csu/i386-elf/crtn.S,v 1.5 2002/05/15 04:19:49 obrien Exp $
/usr/src/lib/libpthread/sys/lock.c
/usr/src/lib/libpthread/thread/thr_cancel.c
/usr/src/lib/libpthread/thread/thr_concurrency.c
/usr/src/lib/libpthread/thread/thr_cond.c
/usr/src/lib/libpthread/thread/thr_create.c
/usr/src/lib/libpthread/thread/thr_detach.c
/usr/src/lib/libpthread/thread/thr_exit.c
/usr/src/lib/libpthread/thread/thr_find_thread.c
/usr/src/lib/libpthread/thread/thr_getschedparam.c
/usr/src/lib/libpthread/thread/thr_init.c
/usr/src/lib/libpthread/thread/thr_join.c
/usr/src/lib/libpthread/thread/thr_kern.c
/usr/src/lib/libpthread/thread/thr_mutex.c
/usr/src/lib/libpthread/thread/thr_nanosleep.c
/usr/src/lib/libpthread/thread/thr_priority_queue.c
/usr/src/lib/libpthread/thread/thr_resume_np.c
/usr/src/lib/libpthread/thread/thr_rtld.c
/usr/src/lib/libpthread/thread/thr_rwlock.c
/usr/src/lib/libpthread/thread/thr_setschedparam.c
/usr/src/lib/libpthread/thread/thr_sig.c
/usr/src/lib/libpthread/thread/thr_sigaction.c
/usr/src/lib/libpthread/thread/thr_sigmask.c
/usr/src/lib/libpthread/thread/thr_sigpending.c
/usr/src/lib/libpthread/thread/thr_sigsuspend.c
/usr/src/lib/libpthread/thread/thr_sigwait.c
/usr/src/lib/libpthread/thread/thr_spec.c
/usr/src/lib/libpthread/thread/thr_spinlock.c
/usr/src/lib/libpthread/thread/thr_stack.c
/usr/src/lib/libpthread/thread/thr_suspend_np.c
不知道kyth1.6和FreeBSD里面出现的那个v 1.6有什么关系。变换grep的字串,还可以取得不同的结果。比如换成kse的话,就会发现二者有很多相似的kse函数调用。不过懒得分析了。有兴趣的可以进一步去分析:)