~sircmpwn/hare

ref: 5b6e7a1ad54a68b09afb68e1be099a46052ef5a7 hare/unix/+linux/umask.ha -rw-r--r-- 373 bytes
5b6e7a1aDrew DeVault unix: declare fs dependency 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),
	};
};