Subject: fcntl changes once again.
To: None <>
From: Bill Studenmund <>
List: tech-kern
Date: 07/12/1999 12:33:53
This message is a summary of things discussed in the past mentioned just
to pull everything together.

I'd like to make two changes to fcntl(). One is to the flags
fcntl(F_[GS]ETFL) and open() support, and the other is to permit a class
of fcntl operations to get passed down to the filesystem.

For the flag changes, I'd add O_ALT_IO and O_OTHER (other is droppable if
objectionalbe). These flags can be set at open or via F_SETFL. They would
correspond to FALTIO and FOTHER for kernel-internal flags. Add
IO_ALTSEMANTICS and IO_OTHER flags to i/o flags passed to
VOP_READ & VOP_WRITE. vn_read() and vn_write() would set these flags
(respectivly) if the F flags were set for the file.

VOP_{READ,WRITE} would then behave differenly if so desired.

As for the extra ops:

If bit (int)0x80000000 (F_FORFS) is set, we process the fcntl in an
ioctl-ish fashon. F_C_VOID, F_C_OUT, and F_C_IN (0x40000000, 0x20000000, &
0x10000000 respectivly) specify if the call passes in no structure (void),
passes out a struct, and/or passes in a struct. Exactly as for an ioctl.

Bits 0x0fff0000 define the size of the struct passed in/out.

Bits 0x0000ffff are the operation desired. Bit 0x00008000 indicates if the
operation is fs-specific. So op 0->0x7fff form a NetBSD-reserved
namespace, and 0x8000->0xffff are fs-specific.

We then add VOP_FCNTL which parallels VOP_IOCTL. So it's VOP_FCNTL( struct
vnode *, int command, caddr_t data, int fflag, struct ucred *, struct proc

As the default behavior routine for all filesystems is to return an error,
no fs's really need to change for it. They'll spit errors. :-)


Take care,