![cinap_lenrek](/assets/img/avatar_default.png)
store errno on the private process stack so its always per process and not just per memory space. errno itself becomes a macro dereferencing int *_errnoloc; which is initialized from main9.s pointing to the private stack location. various fixes in programs that just imported errno variable with "extern int errno;" instead of including <errno.h>.
13 lines
237 B
C
13 lines
237 B
C
/*
|
|
* pANS stdio -- perror
|
|
*/
|
|
#include "iolib.h"
|
|
#include <errno.h>
|
|
|
|
void perror(const char *s){
|
|
if(s!=NULL && *s != '\0') fputs(s, stderr), fputs(": ", stderr);
|
|
fputs(strerror(errno), stderr);
|
|
putc('\n', stderr);
|
|
fflush(stderr);
|
|
}
|