Compare commits

...
6 Commits
Author SHA1 Message Date
Konstantin Belousov c1bc473410 pdfork.2: improve markup
(cherry picked from commit cf63e3f3cd)
2026-10-26 05:38:19 +02:00
Konstantin Belousov 7787316e19 sys: centralize SV_* flags definitions for ELF Linux ABIs
(cherry picked from commit 8dfa23d81f)
2026-10-26 05:38:19 +02:00
Konstantin Belousov e29de8c40b sys: centralize SV_* flags definitions for several FreeBSD ABIs
(cherry picked from commit f69d974bf6)
2026-10-26 05:38:18 +02:00
Konstantin Belousov 15f2dc698a sys/sysent.h: align SV_* flags values, provide full 32bit
(cherry picked from commit dca0b0ad8b)
2026-10-26 05:38:18 +02:00
Vladimir Grebenshchikov 9dcc20504c devfs: make persistent controlling terminal an ABI property
(cherry picked from commit e8923c7346)
2026-10-26 05:38:18 +02:00
Vladimir Grebenshchikov fb97b4f1e3 termios.4: clarify the behavior on the last close of controlling terminal
(cherry picked from commit 44961edac8)
2026-10-26 05:38:17 +02:00
16 changed files with 47 additions and 52 deletions

No files matched your search

+1 -1
View File
@@ -231,7 +231,7 @@ in the process specified by the
.Fa fd
process descriptor.
The returned file descriptor has the
.Va O_CLOEXEC
.Dv O_CLOEXEC
flag set.
The
.Fa flags
+6 -5
View File
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd January 14, 2026
.Dd October 16, 2026
.Dt TERMIOS 4
.Os
.Sh NAME
@@ -160,10 +160,11 @@ creates a new session with the
function; other processes
remaining in the old session that had this terminal as their controlling
terminal continue to have it.
A process does not relinquish its
controlling terminal simply by closing all of its file descriptors
associated with the controlling terminal if other processes continue to
have it open.
Closing all file descriptors associated with the controlling terminal in
one process does not disassociate the terminal from the session while
another process continues to have it open.
When the last file descriptor associated with the controlling terminal is
closed, the terminal is disassociated from the session.
.Pp
When a controlling process terminates, the controlling terminal is
disassociated from the current session, allowing it to be acquired by a
+2 -6
View File
@@ -78,9 +78,7 @@ struct sysentvec elf64_freebsd_sysvec_la48 = {
.sv_setregs = exec_setregs,
.sv_fixlimit = NULL,
.sv_maxssiz = NULL,
.sv_flags = SV_ABI_FREEBSD | SV_ASLR | SV_LP64 | SV_SHP |
SV_TIMEKEEP | SV_RNG_SEED_VER | SV_DSO_SIG |
SV_SIGSYS,
.sv_flags = SV_ABI_FREEBSD_FLAGS | SV_DSO_SIG | SV_LP64,
.sv_set_syscall_retval = cpu_set_syscall_retval,
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_syscallnames = syscallnames,
@@ -121,9 +119,7 @@ struct sysentvec elf64_freebsd_sysvec_la57 = {
.sv_setregs = exec_setregs,
.sv_fixlimit = NULL,
.sv_maxssiz = NULL,
.sv_flags = SV_ABI_FREEBSD | SV_ASLR | SV_LP64 | SV_SHP |
SV_TIMEKEEP | SV_RNG_SEED_VER | SV_DSO_SIG |
SV_SIGSYS,
.sv_flags = SV_ABI_FREEBSD_FLAGS | SV_DSO_SIG | SV_LP64,
.sv_set_syscall_retval = cpu_set_syscall_retval,
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_syscallnames = syscallnames,
+1 -2
View File
@@ -700,8 +700,7 @@ struct sysentvec elf_linux_sysvec = {
.sv_setregs = linux_exec_setregs,
.sv_fixlimit = NULL,
.sv_maxssiz = NULL,
.sv_flags = SV_ABI_LINUX | SV_LP64 | SV_SHP | SV_SIG_DISCIGN |
SV_SIG_WAITNDQ | SV_TIMEKEEP,
.sv_flags = SV_ABI_LINUX_FLAGS | SV_LP64,
.sv_set_syscall_retval = linux_set_syscall_retval,
.sv_fetch_syscall_args = linux_fetch_syscall_args,
.sv_syscallnames = linux_syscallnames,
+1 -2
View File
@@ -800,8 +800,7 @@ struct sysentvec elf_linux_sysvec = {
.sv_setregs = linux_exec_setregs,
.sv_fixlimit = linux32_fixlimit,
.sv_maxssiz = &linux32_maxssiz,
.sv_flags = SV_ABI_LINUX | SV_ILP32 | SV_SHP |
SV_SIG_DISCIGN | SV_SIG_WAITNDQ | SV_TIMEKEEP,
.sv_flags = SV_ABI_LINUX_FLAGS | SV_ILP32,
.sv_set_syscall_retval = linux32_set_syscall_retval,
.sv_fetch_syscall_args = linux32_fetch_syscall_args,
.sv_syscallnames = linux32_syscallnames,
+1 -3
View File
@@ -84,9 +84,7 @@ struct sysentvec elf32_freebsd_sysvec = {
.sv_setregs = exec_setregs,
.sv_fixlimit = NULL,
.sv_maxssiz = NULL,
.sv_flags =
SV_ASLR | SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER |
SV_ABI_FREEBSD | SV_ILP32 | SV_SIGSYS,
.sv_flags = SV_ABI_FREEBSD_FLAGS | SV_ILP32,
.sv_set_syscall_retval = cpu_set_syscall_retval,
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_syscallnames = syscallnames,
+1 -2
View File
@@ -99,8 +99,7 @@ static struct sysentvec elf64_freebsd_sysvec = {
.sv_setregs = exec_setregs,
.sv_fixlimit = NULL,
.sv_maxssiz = NULL,
.sv_flags = SV_SHP | SV_TIMEKEEP | SV_ABI_FREEBSD | SV_LP64 |
SV_ASLR | SV_RNG_SEED_VER | SV_SIGSYS,
.sv_flags = SV_ABI_FREEBSD_FLAGS | SV_LP64,
.sv_set_syscall_retval = cpu_set_syscall_retval,
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_syscallnames = syscallnames,
+1 -2
View File
@@ -448,8 +448,7 @@ struct sysentvec elf_linux_sysvec = {
.sv_setregs = linux_exec_setregs,
.sv_fixlimit = NULL,
.sv_maxssiz = NULL,
.sv_flags = SV_ABI_LINUX | SV_LP64 | SV_SHP | SV_SIG_DISCIGN |
SV_SIG_WAITNDQ | SV_TIMEKEEP,
.sv_flags = SV_ABI_LINUX_FLAGS | SV_LP64,
.sv_set_syscall_retval = linux_set_syscall_retval,
.sv_fetch_syscall_args = linux_fetch_syscall_args,
.sv_syscallnames = linux_syscallnames,
+1 -3
View File
@@ -126,9 +126,7 @@ struct sysentvec ia32_freebsd_sysvec = {
.sv_setregs = ia32_setregs,
.sv_fixlimit = ia32_fixlimit,
.sv_maxssiz = &ia32_maxssiz,
.sv_flags = SV_ABI_FREEBSD | SV_ASLR | SV_ILP32 |
SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER |
SV_DSO_SIG | SV_SIGSYS,
.sv_flags = SV_ABI_FREEBSD_FLAGS | SV_DSO_SIG | SV_ILP32,
.sv_set_syscall_retval = ia32_set_syscall_retval,
.sv_fetch_syscall_args = ia32_fetch_syscall_args,
.sv_syscallnames = freebsd32_syscallnames,
+7 -1
View File
@@ -59,6 +59,7 @@
#include <sys/stat.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/sysent.h>
#include <sys/time.h>
#include <sys/ttycom.h>
#include <sys/unistd.h>
@@ -716,8 +717,13 @@ devfs_close(struct vop_close_args *ap)
* process' controlling terminal. In that case,
* if the reference count is 2 (this last descriptor
* plus the session), release the reference from the session.
*
* Some ABIs keep the controlling terminal after the last
* slave descriptor is closed. A closer with SV_PERSISTENT_CTTY
* leaves the session reference in place.
*/
if (de->de_usecount == 2 && td != NULL) {
if (!SV_PROC_FLAG(curproc, SV_PERSISTENT_CTTY) &&
de->de_usecount == 2 && td != NULL) {
p = td->td_proc;
PROC_LOCK(p);
if (vp == p->p_session->s_ttyvp) {
+1 -2
View File
@@ -74,8 +74,7 @@ struct sysentvec elf32_freebsd_sysvec = {
.sv_setregs = exec_setregs,
.sv_fixlimit = NULL,
.sv_maxssiz = NULL,
.sv_flags = SV_ABI_FREEBSD | SV_ASLR | SV_ILP32 |
SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER | SV_SIGSYS,
.sv_flags = SV_ABI_FREEBSD_FLAGS | SV_ILP32,
.sv_set_syscall_retval = cpu_set_syscall_retval,
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_syscallnames = syscallnames,
+2 -3
View File
@@ -597,7 +597,7 @@ struct sysentvec linux_sysvec = {
.sv_fixlimit = NULL,
.sv_maxssiz = NULL,
.sv_flags = SV_ABI_LINUX | SV_AOUT | SV_ILP32 |
SV_SIG_DISCIGN | SV_SIG_WAITNDQ,
SV_SIG_DISCIGN | SV_SIG_WAITNDQ | SV_PERSISTENT_CTTY,
.sv_set_syscall_retval = linux_set_syscall_retval,
.sv_fetch_syscall_args = linux_fetch_syscall_args,
.sv_syscallnames = linux_syscallnames,
@@ -640,8 +640,7 @@ struct sysentvec elf_linux_sysvec = {
.sv_setregs = linux_exec_setregs,
.sv_fixlimit = NULL,
.sv_maxssiz = NULL,
.sv_flags = SV_ABI_LINUX | SV_ILP32 | SV_SHP |
SV_SIG_DISCIGN | SV_SIG_WAITNDQ | SV_TIMEKEEP,
.sv_flags = SV_ABI_LINUX_FLAGS | SV_ILP32,
.sv_set_syscall_retval = linux_set_syscall_retval,
.sv_fetch_syscall_args = linux_fetch_syscall_args,
.sv_syscallnames = NULL,
+1 -2
View File
@@ -123,8 +123,7 @@ struct sysentvec elf32_freebsd_sysvec = {
.sv_fixlimit = NULL,
#endif
.sv_maxssiz = NULL,
.sv_flags = SV_ABI_FREEBSD | SV_ILP32 | SV_SHP | SV_ASLR |
SV_TIMEKEEP | SV_RNG_SEED_VER | SV_SIGSYS,
.sv_flags = SV_ABI_FREEBSD_FLAGS | SV_ILP32,
.sv_set_syscall_retval = cpu_set_syscall_retval,
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_shared_page_base = FREEBSD32_SHAREDPAGE,
+2 -4
View File
@@ -85,8 +85,7 @@ struct sysentvec elf64_freebsd_sysvec_v1 = {
.sv_setregs = exec_setregs_funcdesc,
.sv_fixlimit = NULL,
.sv_maxssiz = NULL,
.sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_ASLR |
SV_TIMEKEEP | SV_RNG_SEED_VER | SV_SIGSYS,
.sv_flags = SV_ABI_FREEBSD_FLAGS | SV_LP64,
.sv_set_syscall_retval = cpu_set_syscall_retval,
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_syscallnames = syscallnames,
@@ -129,8 +128,7 @@ struct sysentvec elf64_freebsd_sysvec_v2 = {
.sv_setregs = exec_setregs,
.sv_fixlimit = NULL,
.sv_maxssiz = NULL,
.sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_ASLR |
SV_TIMEKEEP | SV_RNG_SEED_VER | SV_SIGSYS,
.sv_flags = SV_ABI_FREEBSD_FLAGS | SV_LP64,
.sv_set_syscall_retval = cpu_set_syscall_retval,
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_syscallnames = syscallnames,
+1 -2
View File
@@ -82,8 +82,7 @@ static struct sysentvec elf64_freebsd_sysvec = {
.sv_setregs = exec_setregs,
.sv_fixlimit = NULL,
.sv_maxssiz = NULL,
.sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_TIMEKEEP |
SV_ASLR | SV_RNG_SEED_VER | SV_SIGSYS,
.sv_flags = SV_ABI_FREEBSD_FLAGS | SV_LP64,
.sv_set_syscall_retval = cpu_set_syscall_retval,
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_syscallnames = syscallnames,
+18 -12
View File
@@ -163,18 +163,19 @@ struct sysentvec {
struct regset **sv_regset_end;
};
#define SV_ILP32 0x000100 /* 32-bit executable. */
#define SV_LP64 0x000200 /* 64-bit executable. */
#define SV_RESERVED0 0x004000 /* Formerly SV_IA32 */
#define SV_AOUT 0x008000 /* a.out executable. */
#define SV_SHP 0x010000 /* Shared page. */
#define SV_SIGSYS 0x020000 /* SIGSYS for non-existing syscall */
#define SV_TIMEKEEP 0x040000 /* Shared page timehands. */
#define SV_ASLR 0x080000 /* ASLR allowed. */
#define SV_RNG_SEED_VER 0x100000 /* random(4) reseed generation. */
#define SV_SIG_DISCIGN 0x200000 /* Do not discard ignored signals */
#define SV_SIG_WAITNDQ 0x400000 /* Wait does not dequeue SIGCHLD */
#define SV_DSO_SIG 0x800000 /* Signal trampoline packed in dso */
#define SV_ILP32 0x00000100 /* 32-bit executable. */
#define SV_LP64 0x00000200 /* 64-bit executable. */
#define SV_RESERVED0 0x00004000 /* Formerly SV_IA32 */
#define SV_AOUT 0x00008000 /* a.out executable. */
#define SV_SHP 0x00010000 /* Shared page. */
#define SV_SIGSYS 0x00020000 /* SIGSYS for non-existing syscall */
#define SV_TIMEKEEP 0x00040000 /* Shared page timehands. */
#define SV_ASLR 0x00080000 /* ASLR allowed. */
#define SV_RNG_SEED_VER 0x00100000 /* random(4) reseed generation. */
#define SV_SIG_DISCIGN 0x00200000 /* Do not discard ignored signals */
#define SV_SIG_WAITNDQ 0x00400000 /* Wait does not dequeue SIGCHLD */
#define SV_DSO_SIG 0x00800000 /* Signal trampoline packed in dso */
#define SV_PERSISTENT_CTTY 0x01000000 /* Keep ctty after the last close */
#define SV_ABI_MASK 0xff
#define SV_PROC_FLAG(p, x) ((p)->p_sysent->sv_flags & (x))
@@ -186,6 +187,11 @@ struct sysentvec {
#define SV_ABI_FREEBSD 9
#define SV_ABI_UNDEF 255
#define SV_ABI_FREEBSD_FLAGS (SV_ABI_FREEBSD | SV_ASLR | SV_SHP | \
SV_TIMEKEEP | SV_RNG_SEED_VER | SV_SIGSYS)
#define SV_ABI_LINUX_FLAGS (SV_ABI_LINUX | SV_SHP | SV_SIG_DISCIGN | \
SV_SIG_WAITNDQ | SV_TIMEKEEP | SV_PERSISTENT_CTTY)
/* sv_coredump flags */
#define SVC_PT_COREDUMP 0x00000001 /* dump requested by ptrace(2) */
#define SVC_NOCOMPRESS 0x00000002 /* disable compression. */