Adds lstat()

This commit is contained in:
2025-07-27 16:25:23 +02:00
parent 0c5bbde4a4
commit c40a59b4ff
3 changed files with 214 additions and 101 deletions

View File

@@ -7,6 +7,7 @@ extern umask_get
section .text
global stat
global lstat
global fgettype
global fgetmod
global fopen
@@ -34,6 +35,19 @@ stat:
add rsp, SIZE_QWORD
ret
;----- lstat(*file[], *statBuffer[]) -----;
; Same as stat, except do not follow links
lstat:
sub rsp, SIZE_QWORD
mov rax, NR_newfstatat
mov rdx, rsi
mov rsi, rdi
mov rdi, AT_FDCWD
mov r10, AT_SYMLINK_NOFOLLOW
syscall
add rsp, SIZE_QWORD
ret
;----- fgettype(*statBuffer[]) -----;
; Gets file type from stat buffer
; Return value: Permissions of given file or -EINVAL if statBuffer is invalid (first bit is 0)