socket descriptor returned from socket()

Vlad GALU dudu at dudu.ro
Tue Feb 6 20:50:02 UTC 2007


On 2/6/07, Andrew N. Below <defan at zenon.net> wrote:
> Hello.
>
> Could 0 (zero) be a valid socket descriptor?

    Yes, if your program is a daemon and closes fds 0, 1, 2 which
corespond to stdin, stdout and stderr.

> man 2 socket:
>
> RETURN VALUES
>       A -1 is returned if an error occurs, otherwise the return value is a
>       descriptor referencing the socket.
>
> I have some troubles with xinetd (2.3.14) - first service
> in config file with proto=tcp, socket_type=stream and wait=yes
> fail to start (fcntl returns "Bad file descriptor" error).
>
> --
> Andrew N. Below
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
>


-- 
If it's there, and you can see it, it's real.
If it's not there, and you can see it, it's virtual.
If it's there, and you can't see it, it's transparent.
If it's not there, and you can't see it, you erased it.


More information about the freebsd-hackers mailing list