Commit Graph

74 Commits

Author SHA1 Message Date
Hasen Judy
705984f828 Fix darwin open flags and mode 2020-04-19 01:39:22 +09:00
gingerBill
93955a0fd8 Remove context.std* parameters; Fix unary boolean not 2020-03-19 15:03:02 +00:00
gingerBill
a0d0e93475 Fix os.read_entire_file 2020-03-12 23:45:46 +00:00
gingerBill
2ce1f4ba9f Revert os_windows.odin behaviour 2020-03-12 23:37:24 +00:00
gingerBill
a985449c31 Fix os_windows.h 2020-03-12 23:24:30 +00:00
gingerBill
6abc93ad84 Fix os.read for windows 2020-03-12 23:22:01 +00:00
Tetralux
1181d7cf90 Fix os.read / os.read_entire_file
- DWORDs are NOT i32
- os.read didn't correctly read as much as it could
2020-03-12 22:31:00 +00:00
gingerBill
4ee936ab8d Merge pull request #581 from terickson001/linux_stat_fix
Linux stat fix
2020-03-06 15:42:05 +00:00
Tyler Erickson
f6f2ab2f25 Fixed bad merge 2020-03-05 19:29:32 -08:00
Tyler Erickson
bb026c99a9 Merged with master 2020-03-05 16:49:53 -08:00
Tyler Erickson
2817bab494 Fix os_linux stat 2020-03-05 12:13:22 -08:00
Clay Murray
85f2f4aa88 Fix issues with stat struct.
The stat struct was the format for the 64 bit version of stat. So we need to call stat64 to get the proper data.
Also we need to use _File_Time instead of File_Time because it is a compound value. 

These changes were tested and work on my computer, MacOS 64 bit.
2020-03-03 19:42:20 -07:00
gingerBill
5e903ed2ff Merge pull request #537 from Tetralux/fix-heap-alloc
Fix heap allocator alignment on all platforms
2020-02-29 09:49:24 +00:00
Tetralux
a4b60b78c8 Fix heap allocator alignment on all platforms 2020-01-22 12:03:16 +00:00
Tetralux
66d1656367 Add os.get_current_directory / os.set_current_directory 2020-01-20 14:28:31 +00:00
gingerBill
85e31e1b69 Fix os.open 2019-12-23 18:10:09 +00:00
Justas Dabrila
38a9a2b7fc Linux: write_entire_file sets 644 permissions on open. 2019-12-23 16:35:10 +02:00
Justas Dabrila
005c6af302 Fix improper _unix_open binding that was ignoring the mode arg 2019-12-23 16:34:20 +02:00
gingerBill
ee78374281 Fix typo 2019-12-01 18:57:43 +00:00
gingerBill
ebe152a155 Disable aligned heap allocations hack in os.heap_allocator_proc 2019-12-01 18:53:27 +00:00
gingerBill
9db81498d8 Make the string type elements "immutable", akin to char const * in C
Allows for extra security and optimization benefits
2019-12-01 14:10:59 +00:00
gingerBill
7fbe0a6f23 Fix nil comparisons for soa slices and dynamic arrays 2019-12-01 11:56:08 +00:00
Tetralux
99121d6ff2 Implement core:thread and core:sync on Unix using pthreads
Also do some cleanup and refactoring of the thread, sync and time APIs.

- remove 'semaphore_release' because 'post' and 'wait' is easier to understand

- change 'semaphore_wait' to '*_wait_for' to match Condition

- pthreads can be given a stack, but doing so requires the user to set up the guard
  pages manually. BE WARNED. The alignment requirements of the stack are also
  platform-dependant; it may need to be page size aligned on some systems.
  Unclear which systems, however. See 'os.get_page_size', and 'mem.make_aligned'.
  HOWEVER: I was unable to get custom stacks with guard pages working reliably,
  so while you can do it, the API does not support it.

- add 'os.get_page_size', 'mem.make_aligned', and 'mem.new_aligned'.

- removed thread return values because windows and linux are not consistent; windows returns 'i32'
  and pthreads return 'void*'; besides which, if you really wanted to communicate how the
  thread exited, you probably wouldn't do it with the thread's exit code.

- fixed 'thread.is_done' on Windows; it didn't report true immediately after calling 'thread.join'.

- moved time related stuff out of 'core:os' to 'core:time'.

- add 'mem.align_backward'

- fixed default allocator alignment
  The heap on Windows, and calloc on Linux, both have no facility to request alignment.
  It's a bit of hack, but the heap_allocator now overallocates; `size + alignment` bytes,
  and aligns things to at least 2.
  It does both of these things to ensure that there is at least two bytes before the payload,
  which it uses to store how much padding it needed to insert in order to fulfil the alignment
  requested.

- make conditions more sane by matching the Windows behaviour.
  The fact that they were signalled now lingers until a thread tries to wait,
  causing them to just pass by uninterrupted, without sleeping or locking the
  underlying mutex, as it would otherwise need to do.
  This means that a thread no longer has to be waiting in order to be signalled, which
  avoids timing bugs that causes deadlocks that are hard to debug and fix.
  See the comment on the `sync.Condition.flag` field.

- add thread priority: `thread.create(worker_proc, .High)`
2019-12-01 00:46:23 +00:00
gingerBill
902d313c6a Fix issue with os.write on *nix with writing nothing 2019-11-24 10:08:08 +00:00
gingerBill
9b4d4a2c61 Minor fix to os.write on darwin 2019-11-16 06:59:14 -08:00
Chris Heyes
adca5b57cd Move time code from os to time package 2019-11-01 19:33:48 +00:00
Chris Heyes
153e7525b5 Merge remote-tracking branch 'upstream/master' 2019-11-01 19:18:33 +00:00
gingerBill
d63878d0dd Merge pull request #437 from nakst/master
updated os_essence.odin
2019-11-01 10:20:29 +00:00
gingerBill
068993a819 Remove os_osx.odin 2019-10-01 20:55:15 +01:00
gingerBill
66ae4e5afc Change ODIN_OS string for osx from "osx" to "darwin" to allow for other platforms 2019-10-01 20:38:50 +01:00
gingerBill
f4f6e9ad49 Fix -debug crash on windows caused by missing debug info for files. 2019-09-25 21:07:56 +01:00
nakst
1e53a6fa96 updated os_essence.odin 2019-09-18 16:19:19 +01:00
nakst
22e982c8fb New Essence OS layer; cross-compiling improvements 2019-09-02 16:46:50 +01:00
gingerBill
980890ee8a Make -vet happy on *nix 2019-08-13 22:39:53 +01:00
Chris Heyes
d85893954d Impl time for macOS 2019-07-16 23:49:53 +01:00
gingerBill
a019059975 Fix -vet for demo.odin 2019-03-30 10:52:53 +00:00
matt
314d5a778e Replace calls to deprecated string functions on linux 2019-03-18 07:13:52 -07:00
gingerBill
c634d4a96d Using implicit selector expressions in the core library 2019-03-06 19:13:50 +00:00
gingerBill
76a6757ee9 Add os.file_size_from_path 2019-02-25 18:03:44 +00:00
Jeroen van Rijn
be1a3488a4 Initial support for GetVersionExA 2019-01-18 13:37:40 +01:00
gingerBill
594238a86c Reorganize fmt and strings; Replace fmt.String_Buffer with strings.Builder 2019-01-06 14:41:42 +00:00
gingerBill
1c9656aedb Vet core library 2018-12-31 15:50:49 +00:00
gingerBill
5ba3d90893 Fix os_windows.odin bugs 2018-12-30 14:43:39 +00:00
matt
e084799b31 Fix bugs and inconsistencies with linux versions of os package 2018-12-30 02:06:41 -07:00
matt
0bcf53b513 Fix os.open on linux/osx 2018-12-26 04:31:12 -07:00
Hasen Judy
9d85f236b8 fix missing declaration in osx 2018-12-18 21:47:23 +09:00
CaptainKraft
cfcb0514bf Add the missing INVALID_HANDLE so that the demo will build and run on Linux. 2018-12-09 20:52:03 -06:00
Jeroen van Rijn
1584260886 Add Linux support for core:time
In addition to sleep() and now(), it also defines nanosleep(), boot_time() and seconds_since_boot()
2018-12-08 20:39:33 +01:00
gingerBill
ce2e23849e Fix context initialization 2018-10-20 16:34:56 +01:00
gingerBill
307c58d908 Fix compilation error #272 2018-10-17 15:27:36 +01:00