sys/kern: Add fdatasync(2) Based on the following FreeBSD commits in 2016. 295af703a0d7987c6cf4987e7b7f5f07b3ca1221 1c1cc89580f0fbfabaf6f6c7f0f6440eef0c128e Add the syscall and also add it to pthread's cancellation point. The default behavior is same as fsync(2), which is fine but inefficient.
Implement the fexecve(2) system call The fexecve(2) function is equivalent to execve(2), except that the file to be executed is determined by the file descriptor fd instead of a pathname. The purpose of fexecve(2) is to enable executing a file which has been verified to be the intended file. It is possible to actively check the file by reading from the file descriptor and be sure that the file is not exchanged for another between the reading and the execution. See https://pubs.opengroup.org/onlinepubs/9699919799/functions/fexecve.html This work is partially based on swildner's patch and FreeBSD's implementation (revisions 177787, 182191, 238220). XXX: We're missing O_EXEC support in open(2). Reviewed-by: dillon
libc: Change getlogin_r()'s second argument to size_t, as POSIX likes it. https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html Also adjust the getconf syscall, aka _getconf() in userland, which is called by getconf(3) and getconf_r(3). Approved-by: dillon Tested-by: zrj
<unistd.h>: Move setpgrp() to __BSD_VISIBLE. POSIX' setpgrp() has a different prototype than the BSD version. While the former takes no arguments, the latter takes two pid_t's. Both versions are also obsolete. So just move our BSD specific one to __BSD_VISIBLE and keep it for backward compatibility.
kernel: Make chflags syscalls argument types consistent with userland. There was an inconsistency between userland and syscalls argument types that was inherited after initial fork. Adjust prototypes to use u_long and add missing const char* too. Rerun sysent. Change tmpfs/dirfs to use u_int for flags since mask for superuser changeable flags is SF_SETTABLE 0xffff0000 (most fs use uint32_t), adjust mksubr script. Remove no longer needed (u_long) casts I could find elsewhere. While there, adjust unistd.h prototypes to use generic types too.
<unistd.h>: Fix profil(2) prototype. First off the vm_offset_t is somewhat bogus in this context, same could be said about size_t variant in sys/sysproto.h. Just use plain u_long type like it is already used in "struct uprof" and fix forth argument to take u_int. In public headers prefer to use generic types.
<unistd.h>: FWIW, set _XOPEN_ENH_I18N, per the standard. We support all functions that it originally required, when it was still optional. It won't have any impact on anything, as far as I can see, so this commit is more cosmetic than anything else. While here, improve some comments.