2012-02-18 12 views
2

カーネルの "getpid"機能を検索していますが、実際の機能が見つかりませんでした。システムコール関数 "sys_getpid"は、Linuxカーネルにありますか?

それはこのようなものでなければなりません:

asmlinkage long sys_getpid(void) 
{ 
return current-> tgetid; 
} 

私は見つけることができるすべては、システムコールテーブルではなく、このシステムコールの実際の実装。

カーネルのバージョンは次のとおりです。事前に3.0.20

感謝。

答えて

5

実際の定義はkernel/timer.cである:

/** 
* sys_getpid - return the thread group id of the current process 
* 
* Note, despite the name, this returns the tgid not the pid. The tgid and 
* the pid are identical unless CLONE_THREAD was specified on clone() in 
* which case the tgid is the same in all threads of the same group. 
* 
* This is SMP safe as current->tgid does not change. 
*/ 
SYSCALL_DEFINE0(getpid) 
{ 
    return task_tgid_vnr(current); 
} 

task_tgid_vnrinclude/linux/sched.hにおける静的インラインです。

+0

申し訳ありませんが、このファイルを見つけるのにまだ問題があります。異なるディレクトリ(アーチ)にはたくさんのtimer.cがあります。どちらを見る必要がありますか? –

+0

'kernel_source_dir/kernel/timer.c'と同じです。 – Mat

+0

カーネル3.0.20のkernel_source_dirのルートディレクトリにそのようなディレクトリはありません。私も2.6.32.56持っていると私はあなたが言ったディレクトリでこのtimer.cファイルを見ることができますが、私は3.0.20のルートにカーネルという名前のディレクトリを見つけることができませんでした。 –

関連する問題