[lkml]   [2001]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
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);

Adam 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
More majordomo info at
Please read the FAQ at

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