From man tgkill
:
tgkill() sends the signal sig to the thread with the thread ID tid in the thread group tgid. (By contrast, kill(2) can only be used to send a signal to a process (i.e., thread group) as a whole, and the signal will be delivered to an arbitrary thread within that process.)
Which just leaves us the question of what signal 0 represents. The answer is, none at all:
If you have a process ID but aren't sure whether it's valid, you can use the most unlikely of candidates to test it: the kill command. If you don't see any reference to this on the kill(1) man page, check the info pages. The man/info page states that signal 0 is special and that the exit code from kill tells whether a signal could be sent to the specified process (or processes).
The tgkill
calls, then, are testing for the existence of various threads within whatever process you're monitoring via strace
. The return value of 0 indicates that the threads so tested do exist; the question to answer now is, why is the process looping over the test? (I assume that's what it's doing, at any rate; presumably if it ever did anything else that you saw, you'd have mentioned it in your question.)