~sircmpwn/hare

ref: bc6041a4fbc18f4cc66670109732941c948be1db hare/unix/+linux/umask.ha -rw-r--r-- 373 bytes
bc6041a4Umar Getagazov unix: add umask wrapper for Linux 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
use errors;
use fs;
use rt;

// Sets the file mode creation mask for the current process and return the
// previous value of the mask. Only the file permission bits are used.
export fn umask(mode: fs::mode) (fs::mode | errors::error) = {
	mode &= 0o777;
	return match (rt::umask(mode)) {
		mode: rt::mode_t => mode: fs::mode,
		err: rt::errno => errors::errno(err),
	};
};