Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Does anyone know why open() on a UNIX socket returns ENXIO? Is it defined in POSIX that UNIX sockets cannot be open()ed, or is this a bug in the linux ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578

    open() and sockets; strange POSIX definitions or linux bugs?


    Does anyone know why open() on a UNIX socket returns ENXIO? Is it defined in POSIX that UNIX sockets cannot be open()ed, or is this a bug in the linux kernel. I haven't tried any other unices, but I know that the OpenBSD open(2) man page specifies that open() returns EOPNOTSUPP on an attempt to open a UNIX socket, as it is "currently not supported". This makes me feel that it's supposed to be supported, right?
    Likewise, why can't you hard link directories? My first thought was that it would the .. link, but this is apparently no problem for symlinks? Is there any substitute for hard linking directories, so that the entire path specified by a symlink would not have to be traversed. It would help greatly in certain situations, where a certain directory should be able to be accessed, even though it's normally buried in a directory structured protected by nonexec'able directories, such as in a user's home dir?
    Does POSIX really specify all this or is it just non-conformance by linux? I tried looking for it in the POSIX specs, but I could hardly find anything at all on UNIX sockets.

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Sorry for all the typos... I hope you understand anyway.

  3. #3
    Linux User
    Join Date
    Nov 2002
    Posts
    420

    Sockets

    I can hardly believe that you can't open a Unix socket on a Linux machine. That seems awfully strange. Though I've never tried that before at all. What's wrong with using TCP/IP sockets instead?

  4. #4
    Linux User
    Join Date
    Nov 2002
    Posts
    420
    Well, UNIX sockets still do have advantages, such as that they can be hidden in the FS, they don't block TCP ports, they are completely reliable, faster, more secure, and processes can also exchange file descriptors over them using ancillary messages.
    However, I could hardly believe it either the first time I tried. The ability to pseudo-connect to them via open() seemed like the greatest advantage with UNIX sockets. I have found no notes on it in the kernel source, though, which seems almost stranger.

  5. #5
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    OK, that's it! I do NOT like this new system where you don't have to log in! When was this implemented in linuxforums.org?! Would someone at least mind implementing a warning saying that I'm not logged in?

  6. #6
    Linux User
    Join Date
    Jul 2002
    Location
    Daytona Beach, FL
    Posts
    487
    (there are these things called cookies )
    majorwoo

    Quiet brain, or I\'ll stab you with a Q-tip.

  7. #7
    Linux Enthusiast
    Join Date
    Jun 2002
    Location
    San Antonio
    Posts
    621
    yeah, I have been able to stay logged in over days of inactivity (busy at work and all, haven't had time for dorkiness).
    I respectfully decline the invitation to join your delusion.

  8. #8
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Seriously guys, does anyone whether POSIX defines this socket behaviour?

  9. #9
    Linux Enthusiast
    Join Date
    Jun 2002
    Location
    San Antonio
    Posts
    621
    sorry, I haven't done much socket programming Dolda. And yeah, I know, we get off-topic very quickly.
    I respectfully decline the invitation to join your delusion.

  10. #10
    Linux Enthusiast
    Join Date
    Jun 2002
    Location
    San Antonio
    Posts
    621
    In the man page, I see: ENXIO O_NONBLOCK | O_WRONLY is set, the named file is a FIFO and no
    process has the file open for reading. Or, the file is a device
    special file and no corresponding device exists.

    Wanna post a simple example, see if I can spot it offhand? Also, in ln's man page I see: -d, -F, --directory
    hard link directories (super-user only)
    Try ln -d /directory /other-directory maybe?
    I respectfully decline the invitation to join your delusion.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •