shithub: mc

ref: 01d9c59aa0f27db7bd3b9b8c1978c9a65c5e60a0
dir: /lib/std/syswrap-ss+linux.myr/

View raw version
use sys
use "types"
use "errno"

pkg std =
	const nanosleep	: (nsecs : uint64 -> errno)
	$noret const exit	: (status:int -> void)

	pkglocal const bgetcwd	: (buf : byte[:] -> errno)
;;

const nanosleep	= {nsecs
	var req, rem
	var s, ns

	s = nsecs / 1_000_000_000
	ns = nsecs % 1_000_000_000
	req = [.sec = s, .nsec = ns]

	-> (sys.nanosleep(&req, &rem) : errno)
}

const exit = {status;
	sys.exit_group(status)
}

const bgetcwd = {buf;
	var err
	err = (sys.getcwd(buf) : errno)
	/*
	if we got a length back, it includes
	the nul byte. chop that off.
	*/
	if err > 0
		-> err - 1
	else
		-> err
	;;
}