Commit Graph

777 Commits

Author SHA1 Message Date
Jeroen van Rijn
c13b68f103 Fix os2/process defer error. 2025-04-07 13:33:21 +02:00
Dave Voutila
18988b5f94 Fix use of errno on OpenBSD. 2025-03-27 10:36:40 -04:00
Jeroen van Rijn
660598ca8a Fix #4968 2025-03-25 12:01:02 +01:00
gingerBill
2b8c76354d Use copy over intrinsics.mem_copy_non_overlapping 2025-03-24 11:31:05 +00:00
Feoramund
649376fcfe Add require_results to getters in os2 path API 2025-03-21 19:14:15 -04:00
Feoramund
cfa3e97968 Make os2 Linux _is_path_separator compare against _Path_Separator 2025-03-21 19:14:15 -04:00
Feoramund
6a6980fda8 Remove if ODIN_OS == .Windows in file that can only be built on Windows 2025-03-21 19:14:15 -04:00
Feoramund
4e7f54c565 Decouple usage of filepath from os2 2025-03-21 19:14:15 -04:00
Feoramund
abe0c30837 Add new path API for os2 2025-03-21 19:14:15 -04:00
Feoramund
d1d86234aa Add missing documentation to os2/path 2025-03-20 18:36:26 -04:00
Feoramund
a495cd581c Assert that _Path_Separator is 7-bit ASCII
There are several places where this is assumed to be true, most visibly
in `is_path_separator`, as it takes a `byte` argument.

Note that the data type of `_Path_Separator` is a rune, which allows any
Unicode value.
2025-03-20 14:43:54 -04:00
Feoramund
2ab1ca29e6 Fix data races in os2/env_linux.odin
Switched to a recursive mutex so that procedures which need to perform
lookups can do so while also maintaining the lock across their entire
body in order to guarantee atomicity for each environment operation.
2025-03-04 19:32:05 -05:00
Feoramund
179e5b9266 Fix typo 2025-03-04 19:12:45 -05:00
Feoramund
266f15b672 Fix indentation 2025-03-04 19:11:32 -05:00
Feoramund
2d0dc44636 Shorten buffers used for os2.random_string results
This is needed now that `os2.random_string` fills the whole slice.
2025-03-03 19:18:54 -05:00
Feoramund
d6002d68a2 Make os2.random_string use context.random_generator
This removes the data race caused by multiple threads using the
unprotected global `random_string_seed`, so long as no two threads share
the same random generator; this is the default case.

Additionally, `os2.random_string` now takes into account the full buffer
slice given to it.
2025-03-03 19:17:29 -05:00
Feoramund
675bffce88 Add missing allocator in os2.file_info_clone 2025-03-02 17:22:43 -05:00
Feoramund
7d1fcfa09b Fix wrong path in os2.user_config_dir 2025-03-02 17:22:40 -05:00
gingerBill
bb429696f8 Merge pull request #4877 from laytan/os2-additions
os/os2: recursive directory walker, expose errors in read_directory, file clone
2025-02-28 14:37:47 +00:00
gingerBill
8a8894a981 Merge pull request #4891 from Feoramund/fix-4890
Fix #4890
2025-02-28 14:08:27 +00:00
gingerBill
79944056b9 Add Error to os2.set_env 2025-02-28 13:52:51 +00:00
gingerBill
b3bbb00f1a Add Error as part of the return values of os2.environ 2025-02-28 13:43:50 +00:00
Feoramund
b2e3b34ce0 Fix #4890
`strings.to_cstring` previously would not check if the buffer could
handle the extra null byte and could lead to segmentation violations
when using the resulting string in an API expecting the terminator.
2025-02-27 18:54:38 -05:00
Laytan Laats
0e4140a602 os/os2: recursive directory walker, expose errors in read_directory, file clone
Adds a directory walker, a method of exposing and retrieving errors from
the existing read directory iterator, allows reusing of the existing
read directory iterator, and adds a file clone procedure
2025-02-24 20:40:44 +01:00
Samuel Elgozi
61f02d9f49 pass flags down from os.send in darwin and linux 2025-01-26 14:03:45 +02:00
gingerBill
3a13c598e2 Merge pull request #4733 from laytan/get-executable-path
os/os2: add get_executable_path and get_executable_directory
2025-01-24 13:09:10 +00:00
gingerBill
13a2a29b90 Merge pull request #4730 from laytan/os2-linux-loop-writes-and-cap-rw
os/os2: bring Linux to other impls standards by looping writes and maxing one shot RW sizes
2025-01-24 13:03:29 +00:00
Laytan Laats
d54de6704a os/os2: use proc_pidpath for executable path on darwin 2025-01-22 18:40:06 +01:00
Laytan Laats
f1b0b19710 os/os2: get_executable_path and working directory on wasi 2025-01-21 19:14:15 +01:00
Laytan Laats
b673642412 os/os2: add get_executable_path and get_executable_directory 2025-01-21 18:54:45 +01:00
gingerBill
223970671f Merge pull request #4716 from laytan/os2-wasi
os/os2: wasi target support
2025-01-21 13:08:04 +00:00
Laytan
68653081be Merge pull request #4732 from zen3ger/os2-process-incorrect-working-dir
os/os2: Properly update CWD on Linux when using _process_start()
2025-01-21 00:07:32 +01:00
Roland Kovacs
f6ead2e777 os/os2: Linux _process_start() write back error on fchdir failure 2025-01-20 23:31:13 +01:00
Roland Kovacs
ac30d36206 os/os2: Properly update CWD on Linux when using _process_start()
The `dir_fd` argument to `execveat()` is not for setting the current working
directory. It is used to resolve relative executable paths, hence explicit
`chdir/fchdir` call is required to set CWD.
2025-01-20 22:34:49 +01:00
Laytan Laats
bf58107402 os/os2: bring Linux to other impls standards by looping writes and maxing one shot RW sizes 2025-01-20 20:15:03 +01:00
jason
27998e0d21 os2/heap_linux point to runtime._heap_allocator_proc 2025-01-19 06:05:55 -05:00
Laytan Laats
e4892f1bb2 os/os2: wasi target support 2025-01-18 22:23:44 +01:00
jason
fa7ef28acf Implement _read_directory_iterator in os2.
Also, fix minor bug in linux.dirent_name.
2025-01-10 20:54:09 -05:00
Laytan
cd93e2f6f8 Merge pull request #4672 from shizeeg/master
add os.exists() to FreeBSD
2025-01-11 01:03:36 +01:00
avanspector
c686728184 Update dir_unix.odin 2025-01-10 07:15:44 +01:00
avanspector
0a985f5d02 Haiku: small fixes across core 2025-01-10 07:07:40 +01:00
sh!zeeg
509da8e632 add os.exists() to FreeBSD 2025-01-10 05:56:56 +03:00
avanspector
be7799459b Merge branch 'odin-lang:master' into master 2025-01-06 16:42:29 +04:00
gingerBill
4d63ee0794 Remove unused import 2025-01-05 12:55:35 +00:00
gingerBill
1bf33fe373 Use static global memory for std handles instead of allocating. 2025-01-05 12:53:20 +00:00
jason
074bef7baf Fix sys/linux 64 bit arguments on 32 bit systems
Reverese return values of compat64_arg_pair
Add register alignment to specific arm32 system calls
2025-01-02 14:50:45 -05:00
jason
ce1f3b34c0 Minor fixes + cleanup in os2 and sys/linux
Add NOFOLLOW to os2.remove
Change Dev from int to u64 and make relavant casts
Fix compat64_arg_pair
2025-01-02 11:03:24 -05:00
gingerBill
1cf7a56ba7 General clean up of code 2025-01-01 15:13:46 +00:00
avanspector
a20d85df1e Fix os_haiku.odin (again) 2024-12-21 17:15:53 +01:00
avanspector
5376d2a20b fix haiku 2024-12-20 17:19:04 +01:00