Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - bind() with abtract unix socket: (4 Items)
   
bind() with abtract unix socket  
Hi,

Is it a known "feature" that using abstract unix domain sockets (zero byte at the start of pathname) bind() doesn't 
return EADDRINUSE even when it should. Non-abstract path works fine.

We ran into a code that was ported from Linux, which was relying on this to detect "server already running" situation.

BR,
Lauri
Re: bind() with abtract unix socket  
Hi Lauri,

The "abstract socket namespace" is a non-portable Linux extension.   It's not supported on any other operating system, 
including QNX.   You'll need to find another approach to prevent multiple execution; I believe the common standard is to
 use a lockfile of some form.

Ref: http://man7.org/linux/man-pages/man7/unix.7.html

Hope this helps some,
-Will
Re: bind() with abtract unix socket  
Hi Will,

I think you've mistaken, as it reads in the QNX manual: http://www.qnx.com/developers/docs/7.0.0/index.html#com.qnx.doc.
neutrino.lib_ref/topic/u/unix_proto.html it support abstract sockets.

But yes, there are many alternatives for detecting a running damon, so the original problem is not really bothering 
anymore.

I'd still like to have clarity, is this a bug or feature?

BR,
Lauri
Re: bind() with abtract unix socket  
I was working on some other part of io-pkt, and did a quick check on it.

It seems like a bug. For abstract socket, it goes straight to node creation without having existence check.

So you'd end up with having the same abstract name being registered multiple times. When this happens, the new one will 
overlay the others.

I don't know if there's reasons for that, I'd double check with io-pkt team.