Subject: Unix domain sockets
To: None <>
From: Martin Husemann <>
List: current-users
Date: 05/05/1999 20:37:14
I feel a little stupid to ask this here, but I must be missing 
something realy obvious...

I have a daemon that opens a local socket to talk to a control programm
and the control program. The daemon works fine (and when I first implemented
it some time ago the communication worked fine too), it runs and does
its job. Netstat lists its socket:

Active UNIX domain sockets
Address  Type   Recv-Q Send-Q    Inode     Conn     Refs  Nextref Addr
f03c0000 stream      0      0 f2eeeccc        0        0        0 /var/run/isdn-monitor

but ls doesn't show it:

ls -l /var/run/log /var/run/isdn-monitor says:
srw-rw-rw-  1 root  wheel  0 May  5 19:49 /var/run/log
/var/run/isdn-monitor: No such file or directory

And the client program can't open the socket - same error.

What is wrong here? This is all on -current from yesterdays sources.


P.S.: just in case it matters: here is the code used to create the 
socket by the daemon. As you see the daemon would exit if it couldn't
create the socket, and netstat see it, and the daemon works...

	/* const char * name */
	int s;
	struct sockaddr_un sa;

	/* create and setup socket */
	s = socket(AF_LOCAL, SOCK_STREAM, 0);
	if (s == -1) {
		log(LL_ERR, "could not create local monitor socket, errno = %d", errno);
	memset(&sa, 0, sizeof sa);
	sa.sun_len = sizeof sa;
	sa.sun_family = AF_LOCAL;
	strcpy(sa.sun_path, name);
	if (bind(s, (struct sockaddr *)&sa, sizeof sa)) {
		log(LL_ERR, "could not bind local monitor socket [%s], errno = %d", name, errno);
	if (listen(s, 0)) {
		log(LL_ERR, "could not listen on local monitor socket, errno = %d", errno);