Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: fstat(2) fails on AF_LINK socket descriptor



In article <20161118144721.GA25738%issan.sis.pasteur.fr@localhost>,
Nicolas Joly  <njoly%pasteur.fr@localhost> wrote:
>-=-=-=-=-=-
>
>
>Hi,
>
>I have some code that tries to detect file type given a descriptor by
>using fstat(2) ... and do some specific stuff accordingly, and
>specifically for socket descriptors.
>
>It mostly works, except for AF_LINK socket descriptor where fstat(2)
>fails with EOPNOTSUPP. Like with the attached sample code.
>
>Looking at the code in src/sys/net/link_proto.c confirms that
>behavior :
>
>static int
>link_stat(struct socket *so, struct stat *ub)
>{
>        KASSERT(solocked(so));
>
>        return EOPNOTSUPP;
>}
>
>But this is an exception as all other stat functions returns 0 instead
>of EOPNOTSUPP.
>
>Any specific reason for this one ?

Nope, please fix it.

christos



Home | Main Index | Thread Index | Old Index