process 0 ("swapper")

Kevin Wilson wkevils at gmail.com
Sat Feb 16 11:48:52 EST 2013


Hi,

> we see this code in proc_pid_lookup:
>
>         tgid = name_to_int(dentry);
>         if (tgid == ~0U)
>                 goto out;
>
> In other words, if you ask for pid 0, it bails and doesn't return anything.

Are you sure that this is what it cjecks?

 ~0U is not 0 but -1;

for example, try:
	printf("%d\n",~0U );
	printf("%x\n",~0U );	
	printf("%x\n",-1 );
and you get:
-1
ffffffff
ffffffff
rgs
Kevin



More information about the Kernelnewbies mailing list