[lug] socket programming/kernel question

rm at fabula.de rm at fabula.de
Wed Mar 5 08:56:40 MST 2003


On Wed, Mar 05, 2003 at 08:42:55AM -0700, Buzbee, James wrote:
> 
> If you know the pid, you can tell if the pid is valid (i.e. there is a 
> process running with that pid) by doing a "kill( pid, 0 );".  A signal 
> of 0 sends no signal, it only does error checking. One of the possible 
> return values is :  ESRCH  The pid or process group does not exist. 
> Once you get the error, you know your former client is gone.

I'nm shure Bear knows this ;-)
But the problem here is: is the process with pid n the same process 
as the one that had pid n the last time i looked.

> Of course this pre-supposes a number of things : You're only dealing 
> with local clients, you have the privilege to do the "kill", polling 
> your clients for pid status is acceptable, and you are not worried about 
> pid re-use in your polling period.

Hmm, i you found a way to use Unix sockets from a remote machine i'd be
really interested .... 

 Ralf Mattes

> Jim
> 
> 
> 
> >
> >(Why do I need this?  I'm working on an ephemeral server where each 
> >process sees the same values every time it calls the server, but 
> >different processes see different values.  SCM_CREDENTIALS get me most 
> >of the way there, but Linux reuses pids.)
> >
> >Bear
> >
> >_______________________________________________
> >Web Page:  http://lug.boulder.co.us
> >Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> >Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
> >
> 
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug



More information about the LUG mailing list