lkml.org 
[lkml]   [2001]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[ot] named sockets

I kind of carelessly deleted /tmp/.X11-unix/X0. Now the thing is that
some programs which had not opened the socket before, can't connect to X.

The simplest solution would be just restart X, but that's too much effort
to me.

So I'm wondering, is there a way, kind of like "relink" system call which
coule take existing file descriptor (they are still so the fd is there,
just unlinked) and link it back to file name?

doing mksock X0 [*], does not do the trick as the fd is different.

[*]
/* mksock - make a Unix domain socket */
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
int main(int argc, char **argv) {
int sd; struct sockaddr_un sin;
if ((sd = socket(AF_UNIX, SOCK_STREAM, 0))
== -1) exit(1);
strcpy(sin.sun_path, argv[1]);
sin.sun_family = AF_UNIX;
if ((bind(sd, &sin, sizeof(sin)) == -1)) exit(1);
exit(0);
}

--
Adam
http://www.eax.com The Supreme Headquarters of the 32 bit registers


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:52    [W:0.060 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site