hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 85f25df58716735cd9da678128e310a33c6a010f
parent 613b5ec3fe64a7ac8d7739d621d35b262b166e63
Author: Vincent Dagonneau <v@vda.io>
Date:   Mon, 25 Apr 2022 14:22:55 -0400

rt/linux: add {get,set}sid syscalls and a couple of tty related constants.

Diffstat:
Mrt/+linux/syscalls.ha | 11++++++++++-
Mrt/+linux/types.ha | 3+++
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/rt/+linux/syscalls.ha b/rt/+linux/syscalls.ha @@ -4,6 +4,7 @@ // (c) 2021 Eyal Sawady <ecs@d2evs.net> // (c) 2021 Mykyta Holubakha <hilobakho@gmail.com> // (c) 2021 Thomas Bracht Laumann Jespersen <t@laumann.xyz> +// (c) 2022 Vincent Dagonneau <v@vda.io> fn syscall0(_: u64) u64; fn syscall1(_: u64, _: u64) u64; @@ -290,7 +291,7 @@ export fn mmap( && addr == null && (flags & MAP_ANON) > 0 && (flags & MAP_FIXED) == 0) { - // Fix up incorrect EPERM from kernel: + // Fix up incorrect EPERM from kernel: yield wrap_errno(ENOMEM); } else err; case let n: u64 => @@ -760,3 +761,11 @@ export fn keyctl( return wrap_return(syscall5(SYS_keyctl, operation: u64, arg2, arg3, arg4, arg5))?: int; }; + +export fn getsid(pid: int) (int | errno) = { + return wrap_return(syscall1(SYS_getsid, pid: u64))?: int; +}; + +export fn setsid() (void | errno) = { + return wrap_return(syscall0(SYS_setsid))?: void; +}; diff --git a/rt/+linux/types.ha b/rt/+linux/types.ha @@ -6,6 +6,7 @@ // (c) 2021 Kiƫd Llaentenn <kiedtl@tilde.team> // (c) 2021 Mykyta Holubakha <hilobakho@gmail.com> // (c) 2022 Sebastian <sebastian@sebsite.pw> +// (c) 2022 Vincent Dagonneau <v@vda.io> export type off_t = u64; export type dev_t = u64; @@ -713,6 +714,8 @@ export type tcflag = enum uint { export def TIOCGWINSZ: u64 = 0x5413; +export def TIOCSCTTY: u64 = 0x540e; +export def TIOCNOTTY: u64 = 0x5422; export def TCGETS: u64 = 0x5401; export def TCSETS: u64 = 0x5402;