mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os: move C struct declarations in their own _default.c.v files (#12268)
This commit is contained in:
@@ -7,10 +7,6 @@ pub const (
|
||||
args = []string{}
|
||||
)
|
||||
|
||||
struct C.dirent {
|
||||
d_name [256]char
|
||||
}
|
||||
|
||||
fn C.readdir(voidptr) &C.dirent
|
||||
|
||||
fn C.readlink(pathname &char, buf &char, bufsiz usize) int
|
||||
@@ -41,36 +37,6 @@ fn C.ftruncate(voidptr, u64) int
|
||||
|
||||
fn C._chsize_s(voidptr, u64) int
|
||||
|
||||
// fn C.proc_pidpath(int, byteptr, int) int
|
||||
struct C.stat {
|
||||
st_size u64
|
||||
st_mode u32
|
||||
st_mtime int
|
||||
}
|
||||
|
||||
struct C.__stat64 {
|
||||
st_size u64
|
||||
st_mode u32
|
||||
st_mtime int
|
||||
}
|
||||
|
||||
struct C.DIR {
|
||||
}
|
||||
|
||||
type FN_SA_Handler = fn (sig int)
|
||||
|
||||
struct C.sigaction {
|
||||
mut:
|
||||
sa_mask int
|
||||
sa_sigaction int
|
||||
sa_flags int
|
||||
sa_handler FN_SA_Handler
|
||||
}
|
||||
|
||||
struct C.dirent {
|
||||
d_name &byte
|
||||
}
|
||||
|
||||
// read_bytes returns all bytes read from file in `path`.
|
||||
[manualfree]
|
||||
pub fn read_bytes(path string) ?[]byte {
|
||||
@@ -890,12 +856,12 @@ pub fn wait() int {
|
||||
}
|
||||
|
||||
// file_last_mod_unix returns the "last modified" time stamp of file in `path`.
|
||||
pub fn file_last_mod_unix(path string) int {
|
||||
pub fn file_last_mod_unix(path string) i64 {
|
||||
attr := C.stat{}
|
||||
// # struct stat attr;
|
||||
unsafe { C.stat(&char(path.str), &attr) }
|
||||
// # stat(path.str, &attr);
|
||||
return attr.st_mtime
|
||||
return i64(attr.st_mtime)
|
||||
// # return attr.st_mtime ;
|
||||
}
|
||||
|
||||
|
@@ -43,20 +43,6 @@ pub const (
|
||||
s_ixoth = 0o0001 // Execute by others
|
||||
)
|
||||
|
||||
struct C.utsname {
|
||||
mut:
|
||||
sysname &char
|
||||
nodename &char
|
||||
release &char
|
||||
version &char
|
||||
machine &char
|
||||
}
|
||||
|
||||
struct C.utimbuf {
|
||||
actime int
|
||||
modtime int
|
||||
}
|
||||
|
||||
fn C.utime(&char, voidptr) int
|
||||
|
||||
fn C.uname(name voidptr) int
|
||||
|
5
vlib/os/os_structs_dirent_default.c.v
Normal file
5
vlib/os/os_structs_dirent_default.c.v
Normal file
@@ -0,0 +1,5 @@
|
||||
module os
|
||||
|
||||
struct C.dirent {
|
||||
d_name [256]char
|
||||
}
|
11
vlib/os/os_structs_sigaction_default.c.v
Normal file
11
vlib/os/os_structs_sigaction_default.c.v
Normal file
@@ -0,0 +1,11 @@
|
||||
module os
|
||||
|
||||
pub type FN_SA_Handler = fn (sig int)
|
||||
|
||||
struct C.sigaction {
|
||||
mut:
|
||||
sa_mask int
|
||||
sa_sigaction int
|
||||
sa_flags int
|
||||
sa_handler FN_SA_Handler
|
||||
}
|
13
vlib/os/os_structs_stat_default.c.v
Normal file
13
vlib/os/os_structs_stat_default.c.v
Normal file
@@ -0,0 +1,13 @@
|
||||
module os
|
||||
|
||||
struct C.stat {
|
||||
st_size u64
|
||||
st_mode u32
|
||||
st_mtime int
|
||||
}
|
||||
|
||||
struct C.__stat64 {
|
||||
st_size u64
|
||||
st_mode u32
|
||||
st_mtime int
|
||||
}
|
23
vlib/os/os_structs_stat_linux.c.v
Normal file
23
vlib/os/os_structs_stat_linux.c.v
Normal file
@@ -0,0 +1,23 @@
|
||||
module os
|
||||
|
||||
struct C.stat {
|
||||
st_dev u64 // 8
|
||||
st_ino u64 // 8
|
||||
st_nlink u64 // 8
|
||||
st_mode u32 // 4
|
||||
st_uid u32 // 4
|
||||
st_gid u32 // 4
|
||||
st_rdev u64 // 8
|
||||
st_size u64 // 8
|
||||
st_blksize u64 // 8
|
||||
st_blocks u64 // 8
|
||||
st_atime i64 // 8
|
||||
st_mtime i64 // 8
|
||||
st_ctime i64 // 8
|
||||
}
|
||||
|
||||
struct C.__stat64 {
|
||||
st_mode u32
|
||||
st_size u64
|
||||
st_mtime u64
|
||||
}
|
15
vlib/os/os_structs_utsname_default.c.v
Normal file
15
vlib/os/os_structs_utsname_default.c.v
Normal file
@@ -0,0 +1,15 @@
|
||||
module os
|
||||
|
||||
struct C.utsname {
|
||||
mut:
|
||||
sysname &char
|
||||
nodename &char
|
||||
release &char
|
||||
version &char
|
||||
machine &char
|
||||
}
|
||||
|
||||
struct C.utimbuf {
|
||||
actime int
|
||||
modtime int
|
||||
}
|
Reference in New Issue
Block a user