tech-kern archive

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

Re: rfc: fcntl() error reporting



"Andy Shevchenko" wrote:

> The standard [1] describes only several errno values for fcntl().
> However, NetBSD's implementation could produce some strange error
> codes.
> There is simple test code.
> 
>   [ .. deleted .. ]
>
> I understand the NetBSD has some extension to the fcntl() which
> possible by standard. But the errno for incorrect command values
> should be equal to EINVAL, as far as I understood standard.
> 
> [1] http://www.opengroup.org/onlinepubs/009695399/basedefs/fcntl.h.html
> 
> P.S. Investigation shows the copyin(), copyout() and other non-related
> functions could produce error codes for sys_fcntl().

Does section B.2.3 of
http://www.opengroup.org/onlinepubs/009695399/xrat/xsh_chap02.html give
us freedom here to report those extra errno values?  At the stage of
fcntl_forfs() parsing the command arg, it's still entirely possible that
the command could be valid.  Determining if a given fcntl command is
valid would involve having to call file system specific fcntl handlers
just to verify if the command exists even if it shouldn't be called
because the checks in fcntl_forfs() have already failed.

At first glance, adding an extra flag arg to all filesystem fcntl
handlers (a "just check if the command is valid, don't do anything else"
flag) and the extra code at the top of these doesn't seem worth the
effort.

Simon.


Home | Main Index | Thread Index | Old Index