os,sync: enable running v -cross -o x.c cmd/v on windows too (part 1, fix V errors)

This commit is contained in:
Delyan Angelov 2025-08-26 18:09:45 +03:00
parent e96355aca5
commit eb9fce090e
2 changed files with 21 additions and 0 deletions

View file

@ -26,6 +26,24 @@ fn C._getpid() int
const executable_suffixes = ['.exe', '.bat', '.cmd', '']
// these consts are declared for parity with the nix version, their values are not used, except for -cross
const s_ifmt = 0xF000 // type of file
const s_ifdir = 0x4000 // directory
const s_ifreg = 0x8000 // regular file
const s_iflnk = 0xa000 // link
const s_isuid = 0o4000 // SUID
const s_isgid = 0o2000 // SGID
const s_isvtx = 0o1000 // Sticky
const s_irusr = 0o0400 // Read by owner
const s_iwusr = 0o0200 // Write by owner
const s_ixusr = 0o0100 // Execute by owner
const s_irgrp = 0o0040 // Read by group
const s_iwgrp = 0o0020 // Write by group
const s_ixgrp = 0o0010 // Execute by group
const s_iroth = 0o0004 // Read by others
const s_iwoth = 0o0002 // Write by others
const s_ixoth = 0o0001
// Ref - https://docs.microsoft.com/en-us/windows/desktop/winprog/windows-data-types
// A handle to an object.
pub type HANDLE = voidptr

View file

@ -13,6 +13,9 @@ fn C.InitializeConditionVariable(voidptr)
fn C.WakeConditionVariable(voidptr)
fn C.SleepConditionVariableSRW(voidptr, voidptr, u32, u32) int
fn C.TryAcquireSRWLockExclusive(h voidptr) int
fn C.TryAcquireSRWLockShared(h voidptr) int
// TODO: The suggestion of using CriticalSection instead of mutex
// was discussed. Needs consideration.