kernel - Add fcntl(F_GETPATH) * Implement fcntl(F_GETPATH). For now limit to fp's representing vnodes only. Use cache_fullpath(). * This fcntl() allows a program to retrieve the file path related to an open descriptor. Author: 1338-1 <1338minus1@protonmail.com> also known as dan_ Tested-by: dillon
libc: Add posix_fadvise(), for now empty except for some error checking. This should help some dports. From POSIX' point of view this is sufficient because it is not required that the implementation does anything with the passed information. The manual page was taken from FreeBSD.
<fcntl.h>: Add some missing defines (required by POSIX). SEEK_SET S_ISUID S_IRWXU S_IRWXG S_IRWXO SEEK_CUR S_ISGID S_IRUSR S_IRGRP S_IROTH SEEK_END S_IWUSR S_IWGRP S_IWOTH S_IXUSR S_IXGRP S_IXOTH Adjust <stat.h>, <stdio.h> and <unistd.h> accordingly. See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fcntl.h.html
kernel - Attempt to fix cluster pbuf deadlock on recursive filesystems * Change global pbuf count limits (used primarily for clustered I/O) to per-mount and per-device limits. The per-mount / per-device limit is set to nswbuf_kva / 10, allowing 10 different entities to obtain pbufs concurrently without interference. * This change goes a long way towards fixing deadlocks that could occur with the old global system (a global limit of nswbuf_kva / 2) when the I/O system recurses through a virtual block device or filesystem. Two examples of virtual block devices are the 'vn' device and the crypto layer. * We also note that even normal filesystem read and write I/O strategy calls will recurse at least once to dive the underlying block device. DFly also had issues with pbuf hogging by one mount causing unnecessary stalls in other mounts. This fix also prevents pbuf hogging. * Remove unused internal O_MAPONREAD flag. Reported-by: htse, multiple Testing-by: htse, dillon
kernel: Add three new commands to fctnl This commit adds the following new commands to fcntl(): F_DUP2FD - non-portable functional equivalent of dup2(fd, arg) F_DUPFD_CLOEXEC - A version of F_DUPFD that sets the close-on-exec on the new file descriptor F_DUP2FD_CLOEXEC - A version of F_DUP2FD that sets the close-on-exec on the new file descriptor. It is non-portable It also adds a missing break in a case statement for F_GETOWN in sys_fnctl(), spotted by dillon. reviewed-by: dillon
kernel: Implement O_CLOEXEC * Using fcntl(2) just after open(2) is not enough to avoid race conditions in programs doing fork+exec sequences. Child processes may be created before fcntl() is run and inherit the parent's file descriptors. * In some circonstances this behavior may even create security issues. * O_CLOEXEC can be used to atomically set the close-on-exec flag for new file descriptors, avoiding the whole mess in the first place. * Fixes issue #2356 Inspired-from: NetBSD