libc: fix for linux using GNU strerror_r (for now).
parent
ccfd9101f0
commit
fd19fadcc6
|
@ -46,8 +46,6 @@ FUNCTION-ALIAS: strerror_unsafe
|
||||||
! Add a default strerror even though it's not threadsafe
|
! Add a default strerror even though it's not threadsafe
|
||||||
M: object strerror strerror_unsafe ;
|
M: object strerror strerror_unsafe ;
|
||||||
|
|
||||||
FUNCTION: int strerror_r ( int errno, char* buf, size_t buflen ) ;
|
|
||||||
|
|
||||||
ERROR: libc-error errno message ;
|
ERROR: libc-error errno message ;
|
||||||
|
|
||||||
: (io-error) ( -- * ) errno dup strerror libc-error ;
|
: (io-error) ( -- * ) errno dup strerror libc-error ;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
USING: alien.syntax ;
|
USING: alien.c-types alien.syntax destructors kernel system ;
|
||||||
IN: libc
|
IN: libc
|
||||||
|
|
||||||
LIBRARY: libc
|
LIBRARY: libc
|
||||||
|
@ -169,3 +169,10 @@ CONSTANT: SIGIO 29
|
||||||
ALIAS: SIGPOLL SIGIO
|
ALIAS: SIGPOLL SIGIO
|
||||||
CONSTANT: SIGPWR 30
|
CONSTANT: SIGPWR 30
|
||||||
CONSTANT: SIGSYS 31
|
CONSTANT: SIGSYS 31
|
||||||
|
|
||||||
|
FUNCTION: c-string strerror_r ( int errno, char* buf, size_t buflen ) ;
|
||||||
|
|
||||||
|
M: linux strerror ( errno -- str )
|
||||||
|
[
|
||||||
|
1024 [ malloc &free ] keep strerror_r
|
||||||
|
] with-destructors ;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
USING: alien.syntax ;
|
USING: alien.c-types alien.strings alien.syntax destructors
|
||||||
|
kernel system ;
|
||||||
IN: libc
|
IN: libc
|
||||||
|
|
||||||
LIBRARY: libc
|
LIBRARY: libc
|
||||||
|
@ -139,3 +140,11 @@ CONSTANT: SIGWINCH 28
|
||||||
CONSTANT: SIGINFO 29
|
CONSTANT: SIGINFO 29
|
||||||
CONSTANT: SIGUSR1 30
|
CONSTANT: SIGUSR1 30
|
||||||
CONSTANT: SIGUSR2 31
|
CONSTANT: SIGUSR2 31
|
||||||
|
|
||||||
|
FUNCTION: int strerror_r ( int errno, char* buf, size_t buflen ) ;
|
||||||
|
|
||||||
|
M: macosx strerror ( errno -- str )
|
||||||
|
[
|
||||||
|
1024 [ malloc &free ] keep [ strerror_r ] 2keep drop nip
|
||||||
|
alien>native-string
|
||||||
|
] with-destructors ;
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Doug Coleman
|
|
|
@ -1 +0,0 @@
|
||||||
unix
|
|
|
@ -1,10 +0,0 @@
|
||||||
! Copyright (C) 2014 Doug Coleman.
|
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
|
||||||
USING: alien.strings destructors kernel libc system ;
|
|
||||||
IN: libc.unix
|
|
||||||
|
|
||||||
M: unix strerror ( errno -- str )
|
|
||||||
[
|
|
||||||
1024 [ malloc &free ] keep [ strerror_r ] 2keep drop nip
|
|
||||||
alien>native-string
|
|
||||||
] with-destructors ;
|
|
Loading…
Reference in New Issue