Commit Graph

71 Commits

Author SHA1 Message Date
Andrew Kelley
7432fb04d6
Merge pull request #2354 from LemonBoy/iterate_phdr_impl
dl_iterate_phdr implementation
2019-05-06 15:48:37 -04:00
LemonBoy
07dfccf967 Review 2019-05-05 13:00:20 +02:00
LemonBoy
074ddf1ac6 Implementation of dl_phdr_info 2019-04-24 20:53:46 +02:00
daurnimator
217b95da31
std: add msghdr_const
As `iovec_const` is to `iovec`, `msghdr_const` is to `msghdr`
2019-04-21 21:53:24 +10:00
daurnimator
9babcac7a6
std: improve msghdr definition 2019-04-21 21:50:48 +10:00
Andrew Kelley
e402455704
rename std lib files to new convention 2019-03-02 16:46:04 -05:00
Andrew Kelley
28bf768883 export _mh_execute_header with weak linkage
* also fix extern variables with initialiaztion values to generate runtime code
 * remove the workaround in example/shared_library/mathtest.zig
 * introduce the ability for global variables to have Weak and LinkOnce
   linkage
 * fix `@export` to work for non-functions. this code needs to be
   audited though.
 * fix comptime ptrcast not keeping bigger alignment
 * fix linker warnings when targeting darwin

closes #1903
2019-02-18 16:47:30 -05:00
Maya Rashish
bc10382ec1 Add NetBSD support
Mostly picking the same paths as FreeBSD.
We need a little special handling for crt files, as netbsd uses its
own (and not GCC's) for those, with slightly different names.
2019-02-17 09:17:34 +02:00
Andrew Kelley
7a4ed10981 darwin: fix incorrect timeval struct type
closes #1648

I also added some more extern functions for darwin time functions,
although nothing depends on them currently.
2019-01-31 18:57:53 -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
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
c26f543970
freebsd: fix Stat mode type 2018-12-21 15:04:55 -02:00
Greg V
76efc462e7 Add preadv/pwritev on FreeBSD 2018-12-20 23:55:44 +03:00
Greg V
054c7ab18a Fix stat/timespec definitions for FreeBSD 2018-12-20 23:54:09 +03: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
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
4dafdc00d5
zig fmt 2018-11-19 17:28:18 -05:00
Andrew Kelley
9493738e54
Merge branch 'freebsd-up' of https://github.com/myfreeweb/zig into freebsd2 2018-11-19 17:24:41 -05:00
Jimmi Holst Christensen
8139c5a516
New Zig formal grammar (#1685)
Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected
2018-11-13 05:08:37 -08:00
Greg V
e5627f8e63 Support more of std on FreeBSD 2018-10-20 15:21:35 +03:00
Jimmi Holst Christensen
378d3e4403
Solve the return type ambiguity (#1628)
Changed container and initializer syntax
* <container> { ... } -> <container> . { ... }
* <exrp> { ... } -> <expr> . { ...}
2018-10-15 09:51:15 -04:00
Andrew Kelley
7c5e3e1f8e
fixups 2018-09-21 14:15:58 -04:00
Andrew Kelley
ac36f98e72 fix stack traces on linux 2018-08-25 03:07:37 -04:00
Andrew Kelley
5c1ec20c9a MacOS stack traces use the already mmapped executable
...rather than trying to find the executable on the file system.

Also use a more robust PIE offset calculation based on the
available metadata.

And for the last function, use the data that tells the end
rather than assuming 4K.

Also they print in a consistent way with Linux stack traces.
2018-08-23 16:23:33 -04:00
Andrew Kelley
c4b9466da7
Merge pull request #1294 from ziglang/async-fs
introduce std.event.fs for async file system functions
2018-08-10 15:51:17 -04:00
Andrew Kelley
fd50a6896b std.event.fs support for macos
The file I/O stuff is working, but the fs watching
stuff is not yet.
2018-08-07 00:49:09 -04:00
Andrew Kelley
2c9ed664dd merge @kristate's std lib changes to darwin 2018-08-06 19:36:31 -04:00
Matthew D. Steele
86d1cc8e2f Add thread ID support to std.os.Thread (fixes #1316) 2018-08-03 21:36:04 -04:00
Andrew Kelley
20f286f22a re-organize std lib darwin files 2018-07-22 00:04:24 -04:00
Andrew Kelley
3f30897fdc add compile error for disallowed types in extern structs
closes #1218
2018-07-11 14:08:56 -04:00
Andrew Kelley
a0c564d762 zig fmt 2018-07-09 01:23:47 -04:00
Andrew Kelley
04d3da4bd1 std.os.cpuCount implementation for macos 2018-07-09 01:08:33 -04:00
Andrew Kelley
50d70d5f49 tests passing with kqueue on macos 2018-07-08 02:46:10 -04:00
Andrew Kelley
652f4bdf62 disallow unknown-length pointer to opaque
This also means that translate-c has to detect when a pointer to
opaque is happening, and use `*` instead of `[*]`.

See #1059
2018-06-05 18:03:21 -04:00
Andrew Kelley
96164ce613 disallow single-item pointer indexing
add pointer arithmetic for unknown length pointer
2018-06-04 01:39:57 -04:00
Andrew Kelley
fcbb7426fa use * for pointer type instead of &
See #770

To help automatically translate code, see the
zig-fmt-pointer-reform-2 branch.

This will convert all & into *. Due to the syntax
ambiguity (which is why we are making this change),
even address-of & will turn into *, so you'll have
to manually fix thes instances. You will be guaranteed
to get compile errors for them - expected 'type', found 'foo'
2018-05-31 17:28:07 -04:00
Andrew Kelley
ea58f4a5a9 run zig fmt on the codebase 2018-05-30 16:09:11 -04:00
Andrew Kelley
b184ae5ca5 run zig fmt on some of the codebase
See #1003
2018-05-26 23:00:29 -04:00
Andrew Kelley
bf8e419d2b linux uses pthreads when linking against libc 2018-04-29 00:40:04 -04:00
Andrew Kelley
a344cb03bc *WIP* use pthreads when linking libc 2018-04-28 23:30:13 -04:00
Andrew Kelley
0dcadc61b4 Merge branch 'std.os.time' of https://github.com/tgschultz/zig into tgschultz-std.os.time 2018-04-22 13:24:25 -04:00
tgschultz
bf9cf28322 Fixed compiler errors around darwin code. 2018-04-18 15:46:50 -05:00
tgschultz
8b66dd8c7d Added unstaged changes. 2018-04-18 13:55:42 -05:00
Marc Tiehuis
03bec631bd Replace File.exists with File.access 2018-04-13 21:27:09 +12:00
Andrew Kelley
e85a10e9f5 async tcp server proof of concept 2018-04-09 00:52:45 -04:00
Andrew Kelley
f5b43ada46 std/os: getting dir entries works on OS X 2018-03-28 12:06:48 +02:00
Andrew Kelley
445b03384a introduce std.heap.ArenaAllocator and std.heap.DirectAllocator
* DirectAllocator does the underlying syscall for every allocation.
 * ArenaAllocator takes another allocator as an argument and
   allocates bytes up front, falling back to DirectAllocator with
   increasingly large allocation sizes, to avoid calling it too often.
   Then the entire arena can be freed at once.

The self hosted parser is updated to take advantage of ArenaAllocator
for the AST that it returns. This significantly reduces the complexity
of cleanup code.

docgen and build runner are updated to use the combination of
ArenaAllocator and DirectAllocator instead of IncrementingAllocator,
which is now deprecated in favor of FixedBufferAllocator combined
with DirectAllocator.

The C allocator calls aligned_alloc instead of malloc, in order to
respect the alignment parameter.

Added asserts in Allocator to ensure that implementors of the
interface return slices of the correct size.

Fixed a bug in Allocator when you call realloc to grow the allocation.
2018-02-12 02:14:44 -05:00