fix some errno related stuff, "make all" works again

This commit is contained in:
mrdudz
2022-08-28 22:09:44 +02:00
parent 2dabb65ee0
commit 54aff47513
7 changed files with 25 additions and 12 deletions

View File

@@ -92,8 +92,8 @@ L3: sta tmp1 ; Save returned count
; Didn't read enough bytes. This is an error for us, but errno is not set
lda #<EIO
sta __errno
stx __errno+1 ; X is zero
sta ___errno
stx ___errno+1 ; X is zero
bne L1 ; Branch always

View File

@@ -126,7 +126,7 @@ struct dirent* __fastcall__ readdir (register DIR* dir)
}
/* Something went wrong when parsing the directory entry */
_errno = EIO;
__errno = EIO;
exitpoint:
return 0;
}

View File

@@ -1,7 +1,7 @@
;
; Ullrich von Bassewitz, 2004-05-13
;
; ___seterrno: Will set __errno to the value in A and return zero in A. Other
; ___seterrno: Will set ___errno to the value in A and return zero in A. Other
; registers aren't changed. The function is C callable, but
; currently only called from asm code.
;
@@ -12,9 +12,9 @@
.proc ___seterrno
sta __errno
sta ___errno
lda #0
sta __errno+1
sta ___errno+1
rts
.endproc

View File

@@ -2,7 +2,7 @@
; 2003-08-12, Ullrich von Bassewitz
; 2015-09-24, Greg King
;
; extern int _errno;
; extern int __errno;
; /* Library errors go here. */
;
@@ -10,5 +10,5 @@
.bss
__errno:
___errno:
.word 0

View File

@@ -42,7 +42,7 @@
void __fastcall__ perror (const char* msg)
{
/* Fetch the message that corresponds to errno */
const char* errormsg = strerror (_errno);
const char* errormsg = strerror (__errno);
/* Different output depending on msg */
if (msg) {

View File

@@ -19,9 +19,9 @@ _strerror:
; The given error code is invalid
@L1: lda #<EINVAL
sta __errno
sta ___errno
lda #>EINVAL ; = 0
sta __errno+1
sta ___errno+1
; lda #$00 ; A contains zero: "Unknown error"
; Load the pointer to the error message and return