[lug] socket programming/kernel question

Zan Lynx zlynx at acm.org
Tue Mar 4 17:56:19 MST 2003


I don't think you can with a datagram socket.  Try using a stream Unix
socket and see what happens.

Also, I believe that Linux uses a positive increment on pids and wraps
around when it runs out.  So there will be some time before pid reuse
unless your machine is spawning furiously.

On Tue, 2003-03-04 at 17:45, Bear Giles wrote:
> Any networking or kernel experts around?
> 
> If I have a stream connection and the other side disconnects, my 
> process gets an EPIPE signal.  That's simple to catch and use to 
> release resources.
> 
> But what about a datagram Unix socket?  There's no connection, per 
> se, but I can use the SCM_CREDENTIALS to get the PID of the 
> caller.  The kernel will know when that process dies.  Is there 
> any way for my process to get a signal then an arbitrary process dies?
> 
> (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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20030304/05fd3921/attachment.pgp>


More information about the LUG mailing list