Commit Graph

766 Commits

Author SHA1 Message Date
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
jason
b73275cf42 Get arm64 up to speed in os2 linux
Readded open flags for arm64 to sys/linux/bits.odin. Make process_start
name based instead of descriptor based to allow running of scripts. Fix
bug in heap_linux. Fix and simplify os2.remove.
2024-12-19 17:12:07 -05:00
Laytan Laats
6e1d028861 fix #4389 - retrieve file type by opening if other methods failed 2024-12-06 23:51:14 +01:00
Jeroen van Rijn
8581240ece Make O_RDONLY default for os.open on all platforms.
And also moved Windows file procs to `os_windows.odin`, in line with all the other platforms who didn't have a dedicated `file_<platform>.odin`
2024-11-28 15:57:48 +01:00
Laytan Laats
282d956aa7 os2: skip dir test when unsupported 2024-11-15 21:56:55 +01:00
Laytan Laats
de9d0134e4 os2: fix file type detection in dir_windows 2024-11-15 21:08:14 +01:00
Laytan Laats
b3c2f5cb12 os2: fix leak in dir_windows 2024-11-15 20:47:34 +01:00
gingerBill
aa36ae01cf Fix #4406 os2 to not close the std file handles but rather just free the memory for the ^File data. 2024-11-04 11:55:29 +00:00
gingerBill
ee76acd665 Merge pull request #4427 from laytan/posix-additions
Finish sys/posix with Linux and partial Windows support & clean up other packages as a result
2024-10-30 11:43:47 +00:00
Laytan Laats
1cebc025b0 sys/posix: impl rest of linux, impl some of Windows 2024-10-28 18:59:06 +01:00
Patric Dexheimer
b6599a52b5 Update process_windows.odin
Mistype
2024-10-27 23:27:18 -03:00
Jeroen van Rijn
00ec862b63 Merge pull request #4335 from colrdavidson/datetime_tz
Add Timezone Support to Odin
2024-10-22 10:18:38 +02:00