Skip to content

Commit 2e4b943

Browse files
committed
(linux) std/sys: add Fstat
1 parent 0f9b160 commit 2e4b943

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

std/sys/syscall_linux_amd64.jule

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,13 @@ fn Lstat(path: str, mut &stat: *SysStat)! {
578578
Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)?
579579
}
580580

581+
fn Fstat(fd: int, mut &stat: *SysStat)! {
582+
_, e := syscall(SYS_FSTAT, uintptr(fd), uintptr(stat), 0, 0, 0, 0)
583+
if e != _NO_ERROR {
584+
throw e
585+
}
586+
}
587+
581588
fn Ftruncate(fd: int, length: i64)! {
582589
_, e := syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0, 0, 0, 0)
583590
if e != _NO_ERROR {

std/sys/syscall_linux_arm64.jule

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,13 @@ fn Lstat(path: str, mut &stat: *SysStat)! {
582582
Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)?
583583
}
584584

585+
fn Fstat(fd: int, mut &stat: *SysStat)! {
586+
_, e := syscall(SYS_FSTAT, uintptr(fd), uintptr(stat), 0, 0, 0, 0)
587+
if e != _NO_ERROR {
588+
throw e
589+
}
590+
}
591+
585592
fn Ftruncate(fd: int, length: i64)! {
586593
_, e := syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0, 0, 0, 0)
587594
if e != _NO_ERROR {

std/sys/syscall_linux_i386.jule

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,13 @@ fn Lstat(path: str, mut &stat: *SysStat)! {
610610
}
611611
}
612612

613+
fn Fstat(fd: int, mut &stat: *SysStat)! {
614+
_, e := syscall(SYS_FSTAT64, uintptr(fd), uintptr(stat), 0, 0, 0, 0)
615+
if e != _NO_ERROR {
616+
throw e
617+
}
618+
}
619+
613620
fn Ftruncate(fd: int, length: i64)! {
614621
_, e := syscall(SYS_FTRUNCATE64, uintptr(fd), uintptr(length>>32), 0, 0, 0, 0)
615622
if e != _NO_ERROR {

0 commit comments

Comments
 (0)