Commit Graph

21 Commits (270933b1e997c91a9c2d28b6896d625c0ae1b163)

Author SHA1 Message Date
Marcio 5f26d1dddb freebsd: fix wrong call to clock_getres (#1871)
Reported-by: daurnimator
2019-01-05 13:34:47 -05:00
Marcio Giaxa 5c2a1055a0 freebsd: add sockaddr structs 2019-01-04 16:31:57 -05:00
Marcio Giaxa 4d9547ff2e freebsd: implement clock related functions
- clock_gettime
 - clock_getres
2019-01-04 16:31:57 -05:00
Marcio Giaxa 1e781a30f6 freebsd: add clock const definitions 2019-01-04 16:31:57 -05:00
Marcio Giaxa 52be7d7404 freebsd: fix flags for opening files
Prior to this fix, the compare-outputs test suite was showing a strange
behavior, the tests always stopped between tests 6-8 and had a stack track
similar to each other.

```
Test 8/68 compare-output multiple files with private function (ReleaseSmall)...OK
/usr/home/mgxm/dev/zig/zig-cache/source.zig:7:2: error: invalid token: '&'
}&(getStdOut() catch unreachable).outStream().stream;
 ^
The following command exited with error code 1:

```

With the wrong O_* flags, the source code was being written in append mode which
resulted in an invalid file

```zig
use @import("foo.zig");
use @import("bar.zig");

pub fn main() void {
	foo_function();
	bar_function();
}&(getStdOut() catch unreachable).outStream().stream;
	stdout.print("OK 2\n") catch unreachable;
}

fn privateFunction() void {
	printText();
}
```
2018-12-24 11:45:55 -02:00
Marcio Giaxa 682815f6e9
freebsd: remove syscall and use libc
Use libc interface for:
 - getdents
 - kill
 - openat
 - setgid
 - setuid
2018-12-23 23:30:31 -02:00
Marcio Giaxa a6f33e3dc5
freebsd: add realpath to freebsd/index.zig 2018-12-20 21:05:31 -02:00
Greg V 76efc462e7 Add preadv/pwritev on FreeBSD 2018-12-20 23:55:44 +03:00
Marcio Giaxa 9900f94afe freebsd: use sysctl to get the current executable path
FreeBSD doesn't mount procfs as default on the base system, so we can't
depend on it to get the current path, In this case, we use sysctl(3) to
retrieves the system information and get the same information.

 - CTL_KERN: High kernel limits

 - KERN_PROC: Return selected information about specific running
   processes.

 - KERN_PROC_PATHNAME: The path of the process

 - Process ID: a process ID of -1 implies the current process.
2018-12-19 18:42:00 -02:00
Marcio Giaxa 1811e7e6c9 freebsd: remove getrandom dependency from libc
The system call getrandom(2) just landed on FreeBSD 12, so if we want to
support some earlier version or at least FreeBSD 11, we can't depend on
the system call.
2018-12-19 18:42:00 -02:00
Marcio Giaxa 11ced4f99d freebsd: use libc interface instead system calls
Remove all syscalls references

 * dup2()
 * chdir()
 * execve()
 * fork()
 * getcwd()
 * isatty()
 * readlink()
 * mkdir()
 * mmap()
 * munmap()
 * read()
 * rmdir()
 * symlink()
 * pread()
 * write()
 * pwrite()
 * rename()
 * open()
 * close()
 * lseek()
 * exit()
 * unlink()
 * waitpid()
 * nanosleep()
 * setreuid()
 * setregid()
 * raise()
 * fstat()
 * pipe()
 * added pipe2() extern c fn
2018-12-19 18:42:00 -02:00
Marcio Giaxa 0273fbf710 freebsd: add access 2018-12-19 18:42:00 -02:00
Marcio Giaxa 5ea37f6e8c freebsd: add getdirentries 2018-12-19 18:41:59 -02:00
Marcio Giaxa 666b153144 freebsd: remove syscall files 2018-12-19 18:41:40 -02:00
Andrew Kelley 7417f2e4b3
freebsd: fix issues with syscalls 2018-12-13 00:33:13 -05:00
Andrew Kelley d770333827
freebsd: fix os_self_exe_path function and update std lib 2018-12-12 22:28:15 -05:00
Andrew Kelley 4dafdc00d5
zig fmt 2018-11-19 17:28:18 -05:00
Greg V e5627f8e63 Support more of std on FreeBSD 2018-10-20 15:21:35 +03:00
Greg V d6cab0d4b6 Various fcntl flags are also machine-independent on FreeBSD 2018-10-20 15:15:01 +03:00
Greg V afe26bbcbd System call numbers on FreeBSD are machine-independent
But e.g. sbrk is only removed in new architectures (aarch64, riscv),
so keep it in x86_64
2018-10-20 15:15:01 +03:00
Greg V 1829c09303 Fix os/freebsd files 2018-10-20 15:15:01 +03:00