Re: anon unions are cool

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Albert Cahalan <[email protected]> writes:

> This case is rather interesting. At more than one place I've worked,
> I found people assuming that the kernel's "pid" was a pid, when in
> fact it is a tid. (a "task ID" or "thread ID") The confusion probably
> leads to kernel bugs. I've seen many bugs related to this, though I
> can't be 100% sure that they don't all involve code that existed prior
> to the tgid concept.

Actually this is a really weird area.  A lot of it depends on your
perspective.  current->pid is more than just a thread group ID.

You can always use kill to send a signal to the ``pid'' of any
task.  However if that task is part of a thread group the signal
might go to one of that threads siblings.

If you were to follow the normal rules and send to a signal
to a thread group.  All threads would get it.  Although I
don't think the kernel has code for that.

So from a signal perspective current->pid is the pid.

However get_pid has been modified to return the thread group id.
Instead of the PID.  And a lot of times when you are exporting
information to user space you want the thread group id.

But in practice neither thread ID nor process ID map directly
to the kernels concept.

Then there is the other weird side where only the leaders of
thread groups are placed in sessions and process groups.

Eric


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux