From 57a933e330219d1ea6955a6ceef7454c58ae163d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Thu, 17 Oct 2013 17:05:26 +0200 Subject: [PATCH] libc.*, unix.*: move constants and functions from the unix namespace to libc The E* errno and SIG* constants are defined on Windows too, so they should be in the libc vocab which is available there. They will be used for SSL error handling. --- basis/libc/libc-tests.factor | 2 + basis/libc/libc.factor | 16 ++- basis/libc/linux/linux.factor | 171 ++++++++++++++++++++++++++++ basis/libc/macosx/macosx.factor | 141 +++++++++++++++++++++++ basis/libc/windows/windows.factor | 104 +++++++++++++++++ basis/unix/debugger/debugger.factor | 4 +- basis/unix/ffi/ffi.factor | 2 - basis/unix/ffi/linux/linux.factor | 167 --------------------------- basis/unix/ffi/macosx/macosx.factor | 139 +--------------------- basis/unix/unix.factor | 6 - 10 files changed, 434 insertions(+), 318 deletions(-) create mode 100644 basis/libc/linux/linux.factor create mode 100644 basis/libc/macosx/macosx.factor create mode 100644 basis/libc/windows/windows.factor diff --git a/basis/libc/libc-tests.factor b/basis/libc/libc-tests.factor index 3dcebb5e7a..0a35a2b7b2 100644 --- a/basis/libc/libc-tests.factor +++ b/basis/libc/libc-tests.factor @@ -9,3 +9,5 @@ destructors kernel ; [ ] [ [ "block" get &free drop ] with-destructors ] unit-test [ f ] [ "block" get malloc-exists? ] unit-test + +[ "No error" ] [ 0 strerror ] unit-test diff --git a/basis/libc/libc.factor b/basis/libc/libc.factor index 95ed73c7e6..ab2d5047e6 100644 --- a/basis/libc/libc.factor +++ b/basis/libc/libc.factor @@ -2,11 +2,13 @@ ! Copyright (C) 2007, 2010 Slava Pestov ! Copyright (C) 2007, 2008 Doug Coleman ! See http://factorcode.org/license.txt for BSD license. -USING: alien alien.c-types alien.syntax assocs continuations -alien.destructors kernel namespaces accessors sets summary -destructors destructors.private ; +USING: accessors alien alien.c-types alien.destructors alien.syntax assocs +combinators continuations destructors destructors.private kernel math +namespaces prettyprint sequences sets summary system vocabs ; IN: libc +<< "libc." os unparse append require >> + LIBRARY: factor FUNCTION-ALIAS: errno @@ -23,6 +25,14 @@ FUNCTION-ALIAS: set-errno LIBRARY: libc +FUNCTION: c-string strerror ( int errno ) ; + +ERROR: libc-error errno message ; + +: (io-error) ( -- * ) errno dup strerror libc-error ; + +: io-error ( n -- ) 0 < [ (io-error) ] when ; + FUNCTION-ALIAS: (malloc) void* malloc ( size_t size ) ; diff --git a/basis/libc/linux/linux.factor b/basis/libc/linux/linux.factor new file mode 100644 index 0000000000..40a2ea9fe8 --- /dev/null +++ b/basis/libc/linux/linux.factor @@ -0,0 +1,171 @@ +USING: alien.syntax ; +IN: libc.linux + +LIBRARY: libc + +CONSTANT: EPERM 1 +CONSTANT: ENOENT 2 +CONSTANT: ESRCH 3 +CONSTANT: EINTR 4 +CONSTANT: EIO 5 +CONSTANT: ENXIO 6 +CONSTANT: E2BIG 7 +CONSTANT: ENOEXEC 8 +CONSTANT: EBADF 9 +CONSTANT: ECHILD 10 +CONSTANT: EAGAIN 11 +CONSTANT: ENOMEM 12 +CONSTANT: EACCES 13 +CONSTANT: EFAULT 14 +CONSTANT: ENOTBLK 15 +CONSTANT: EBUSY 16 +CONSTANT: EEXIST 17 +CONSTANT: EXDEV 18 +CONSTANT: ENODEV 19 +CONSTANT: ENOTDIR 20 +CONSTANT: EISDIR 21 +CONSTANT: EINVAL 22 +CONSTANT: ENFILE 23 +CONSTANT: EMFILE 24 +CONSTANT: ENOTTY 25 +CONSTANT: ETXTBSY 26 +CONSTANT: EFBIG 27 +CONSTANT: ENOSPC 28 +CONSTANT: ESPIPE 29 +CONSTANT: EROFS 30 +CONSTANT: EMLINK 31 +CONSTANT: EPIPE 32 +CONSTANT: EDOM 33 +CONSTANT: ERANGE 34 +CONSTANT: EDEADLK 35 +CONSTANT: ENAMETOOLONG 36 +CONSTANT: ENOLCK 37 +CONSTANT: ENOSYS 38 +CONSTANT: ENOTEMPTY 39 +CONSTANT: ELOOP 40 +ALIAS: EWOULDBLOCK EAGAIN +CONSTANT: ENOMSG 42 +CONSTANT: EIDRM 43 +CONSTANT: ECHRNG 44 +CONSTANT: EL2NSYNC 45 +CONSTANT: EL3HLT 46 +CONSTANT: EL3RST 47 +CONSTANT: ELNRNG 48 +CONSTANT: EUNATCH 49 +CONSTANT: ENOCSI 50 +CONSTANT: EL2HLT 51 +CONSTANT: EBADE 52 +CONSTANT: EBADR 53 +CONSTANT: EXFULL 54 +CONSTANT: ENOANO 55 +CONSTANT: EBADRQC 56 +CONSTANT: EBADSLT 57 +ALIAS: EDEADLOCK EDEADLK +CONSTANT: EBFONT 59 +CONSTANT: ENOSTR 60 +CONSTANT: ENODATA 61 +CONSTANT: ETIME 62 +CONSTANT: ENOSR 63 +CONSTANT: ENONET 64 +CONSTANT: ENOPKG 65 +CONSTANT: EREMOTE 66 +CONSTANT: ENOLINK 67 +CONSTANT: EADV 68 +CONSTANT: ESRMNT 69 +CONSTANT: ECOMM 70 +CONSTANT: EPROTO 71 +CONSTANT: EMULTIHOP 72 +CONSTANT: EDOTDOT 73 +CONSTANT: EBADMSG 74 +CONSTANT: EOVERFLOW 75 +CONSTANT: ENOTUNIQ 76 +CONSTANT: EBADFD 77 +CONSTANT: EREMCHG 78 +CONSTANT: ELIBACC 79 +CONSTANT: ELIBBAD 80 +CONSTANT: ELIBSCN 81 +CONSTANT: ELIBMAX 82 +CONSTANT: ELIBEXEC 83 +CONSTANT: EILSEQ 84 +CONSTANT: ERESTART 85 +CONSTANT: ESTRPIPE 86 +CONSTANT: EUSERS 87 +CONSTANT: ENOTSOCK 88 +CONSTANT: EDESTADDRREQ 89 +CONSTANT: EMSGSIZE 90 +CONSTANT: EPROTOTYPE 91 +CONSTANT: ENOPROTOOPT 92 +CONSTANT: EPROTONOSUPPORT 93 +CONSTANT: ESOCKTNOSUPPORT 94 +CONSTANT: EOPNOTSUPP 95 +CONSTANT: EPFNOSUPPORT 96 +CONSTANT: EAFNOSUPPORT 97 +CONSTANT: EADDRINUSE 98 +CONSTANT: EADDRNOTAVAIL 99 +CONSTANT: ENETDOWN 100 +CONSTANT: ENETUNREACH 101 +CONSTANT: ENETRESET 102 +CONSTANT: ECONNABORTED 103 +CONSTANT: ECONNRESET 104 +CONSTANT: ENOBUFS 105 +CONSTANT: EISCONN 106 +CONSTANT: ENOTCONN 107 +CONSTANT: ESHUTDOWN 108 +CONSTANT: ETOOMANYREFS 109 +CONSTANT: ETIMEDOUT 110 +CONSTANT: ECONNREFUSED 111 +CONSTANT: EHOSTDOWN 112 +CONSTANT: EHOSTUNREACH 113 +CONSTANT: EALREADY 114 +CONSTANT: EINPROGRESS 115 +CONSTANT: ESTALE 116 +CONSTANT: EUCLEAN 117 +CONSTANT: ENOTNAM 118 +CONSTANT: ENAVAIL 119 +CONSTANT: EISNAM 120 +CONSTANT: EREMOTEIO 121 +CONSTANT: EDQUOT 122 +CONSTANT: ENOMEDIUM 123 +CONSTANT: EMEDIUMTYPE 124 +CONSTANT: ECANCELED 125 +CONSTANT: ENOKEY 126 +CONSTANT: EKEYEXPIRED 127 +CONSTANT: EKEYREVOKED 128 +CONSTANT: EKEYREJECTED 129 +CONSTANT: EOWNERDEAD 130 +CONSTANT: ENOTRECOVERABLE 131 + +CONSTANT: SIGHUP 1 +CONSTANT: SIGINT 2 +CONSTANT: SIGQUIT 3 +CONSTANT: SIGILL 4 +CONSTANT: SIGTRAP 5 +CONSTANT: SIGABRT 6 +CONSTANT: SIGIOT 6 +CONSTANT: SIGBUS 7 +CONSTANT: SIGFPE 8 +CONSTANT: SIGKILL 9 +CONSTANT: SIGUSR1 10 +CONSTANT: SIGSEGV 11 +CONSTANT: SIGUSR2 12 +CONSTANT: SIGPIPE 13 +CONSTANT: SIGALRM 14 +CONSTANT: SIGTERM 15 +CONSTANT: SIGSTKFLT 16 +CONSTANT: SIGCHLD 17 +ALIAS: SIGCLD SIGCHLD +CONSTANT: SIGCONT 18 +CONSTANT: SIGSTOP 19 +CONSTANT: SIGTSTP 20 +CONSTANT: SIGTTIN 21 +CONSTANT: SIGTTOU 22 +CONSTANT: SIGURG 23 +CONSTANT: SIGXCPU 24 +CONSTANT: SIGXFSZ 25 +CONSTANT: SIGVTALRM 26 +CONSTANT: SIGPROF 27 +CONSTANT: SIGWINCH 28 +CONSTANT: SIGIO 29 +ALIAS: SIGPOLL SIGIO +CONSTANT: SIGPWR 30 +CONSTANT: SIGSYS 31 diff --git a/basis/libc/macosx/macosx.factor b/basis/libc/macosx/macosx.factor new file mode 100644 index 0000000000..e91a705c61 --- /dev/null +++ b/basis/libc/macosx/macosx.factor @@ -0,0 +1,141 @@ +USING: alien.syntax ; +IN: libc.macosx + +LIBRARY: libc + +CONSTANT: EPERM 1 +CONSTANT: ENOENT 2 +CONSTANT: ESRCH 3 +CONSTANT: EINTR 4 +CONSTANT: EIO 5 +CONSTANT: ENXIO 6 +CONSTANT: E2BIG 7 +CONSTANT: ENOEXEC 8 +CONSTANT: EBADF 9 +CONSTANT: ECHILD 10 +CONSTANT: EDEADLK 11 +CONSTANT: ENOMEM 12 +CONSTANT: EACCES 13 +CONSTANT: EFAULT 14 +CONSTANT: ENOTBLK 15 +CONSTANT: EBUSY 16 +CONSTANT: EEXIST 17 +CONSTANT: EXDEV 18 +CONSTANT: ENODEV 19 +CONSTANT: ENOTDIR 20 +CONSTANT: EISDIR 21 +CONSTANT: EINVAL 22 +CONSTANT: ENFILE 23 +CONSTANT: EMFILE 24 +CONSTANT: ENOTTY 25 +CONSTANT: ETXTBSY 26 +CONSTANT: EFBIG 27 +CONSTANT: ENOSPC 28 +CONSTANT: ESPIPE 29 +CONSTANT: EROFS 30 +CONSTANT: EMLINK 31 +CONSTANT: EPIPE 32 +CONSTANT: EDOM 33 +CONSTANT: ERANGE 34 +CONSTANT: EAGAIN 35 +ALIAS: EWOULDBLOCK EAGAIN +CONSTANT: EINPROGRESS 36 +CONSTANT: EALREADY 37 +CONSTANT: ENOTSOCK 38 +CONSTANT: EDESTADDRREQ 39 +CONSTANT: EMSGSIZE 40 +CONSTANT: EPROTOTYPE 41 +CONSTANT: ENOPROTOOPT 42 +CONSTANT: EPROTONOSUPPORT 43 +CONSTANT: ESOCKTNOSUPPORT 44 +CONSTANT: ENOTSUP 45 +CONSTANT: EPFNOSUPPORT 46 +CONSTANT: EAFNOSUPPORT 47 +CONSTANT: EADDRINUSE 48 +CONSTANT: EADDRNOTAVAIL 49 +CONSTANT: ENETDOWN 50 +CONSTANT: ENETUNREACH 51 +CONSTANT: ENETRESET 52 +CONSTANT: ECONNABORTED 53 +CONSTANT: ECONNRESET 54 +CONSTANT: ENOBUFS 55 +CONSTANT: EISCONN 56 +CONSTANT: ENOTCONN 57 +CONSTANT: ESHUTDOWN 58 +CONSTANT: ETOOMANYREFS 59 +CONSTANT: ETIMEDOUT 60 +CONSTANT: ECONNREFUSED 61 +CONSTANT: ELOOP 62 +CONSTANT: ENAMETOOLONG 63 +CONSTANT: EHOSTDOWN 64 +CONSTANT: EHOSTUNREACH 65 +CONSTANT: ENOTEMPTY 66 +CONSTANT: EPROCLIM 67 +CONSTANT: EUSERS 68 +CONSTANT: EDQUOT 69 +CONSTANT: ESTALE 70 +CONSTANT: EREMOTE 71 +CONSTANT: EBADRPC 72 +CONSTANT: ERPCMISMATCH 73 +CONSTANT: EPROGUNAVAIL 74 +CONSTANT: EPROGMISMATCH 75 +CONSTANT: EPROCUNAVAIL 76 +CONSTANT: ENOLCK 77 +CONSTANT: ENOSYS 78 +CONSTANT: EFTYPE 79 +CONSTANT: EAUTH 80 +CONSTANT: ENEEDAUTH 81 +CONSTANT: EPWROFF 82 +CONSTANT: EDEVERR 83 +CONSTANT: EOVERFLOW 84 +CONSTANT: EBADEXEC 85 +CONSTANT: EBADARCH 86 +CONSTANT: ESHLIBVERS 87 +CONSTANT: EBADMACHO 88 +CONSTANT: ECANCELED 89 +CONSTANT: EIDRM 90 +CONSTANT: ENOMSG 91 +CONSTANT: EILSEQ 92 +CONSTANT: ENOATTR 93 +CONSTANT: EBADMSG 94 +CONSTANT: EMULTIHOP 95 +CONSTANT: ENODATA 96 +CONSTANT: ENOLINK 97 +CONSTANT: ENOSR 98 +CONSTANT: ENOSTR 99 +CONSTANT: EPROTO 100 +CONSTANT: ETIME 101 +CONSTANT: EOPNOTSUPP 102 +CONSTANT: ENOPOLICY 103 + +CONSTANT: SIGHUP 1 +CONSTANT: SIGINT 2 +CONSTANT: SIGQUIT 3 +CONSTANT: SIGILL 4 +CONSTANT: SIGTRAP 5 +CONSTANT: SIGABRT 6 +CONSTANT: SIGEMT 7 +CONSTANT: SIGFPE 8 +CONSTANT: SIGKILL 9 +CONSTANT: SIGBUS 10 +CONSTANT: SIGSEGV 11 +CONSTANT: SIGSYS 12 +CONSTANT: SIGPIPE 13 +CONSTANT: SIGALRM 14 +CONSTANT: SIGTERM 15 +CONSTANT: SIGURG 16 +CONSTANT: SIGSTOP 17 +CONSTANT: SIGTSTP 18 +CONSTANT: SIGCONT 19 +CONSTANT: SIGCHLD 20 +CONSTANT: SIGTTIN 21 +CONSTANT: SIGTTOU 22 +CONSTANT: SIGIO 23 +CONSTANT: SIGXCPU 24 +CONSTANT: SIGXFSZ 25 +CONSTANT: SIGVTALRM 26 +CONSTANT: SIGPROF 27 +CONSTANT: SIGWINCH 28 +CONSTANT: SIGINFO 29 +CONSTANT: SIGUSR1 30 +CONSTANT: SIGUSR2 31 diff --git a/basis/libc/windows/windows.factor b/basis/libc/windows/windows.factor new file mode 100644 index 0000000000..2a7f0cbbb6 --- /dev/null +++ b/basis/libc/windows/windows.factor @@ -0,0 +1,104 @@ +USING: alien.syntax ; +IN: libc.windows + +LIBRARY: libc + +! From errno.h in msvc 10: +CONSTANT: EPERM 1 +CONSTANT: ENOENT 2 +CONSTANT: ESRCH 3 +CONSTANT: EINTR 4 +CONSTANT: EIO 5 +CONSTANT: ENXIO 6 +CONSTANT: E2BIG 7 +CONSTANT: ENOEXEC 8 +CONSTANT: EBADF 9 +CONSTANT: ECHILD 10 +CONSTANT: EAGAIN 11 +CONSTANT: ENOMEM 12 +CONSTANT: EACCES 13 +CONSTANT: EFAULT 14 +CONSTANT: EBUSY 16 +CONSTANT: EEXIST 17 +CONSTANT: EXDEV 18 +CONSTANT: ENODEV 19 +CONSTANT: ENOTDIR 20 +CONSTANT: EISDIR 21 +CONSTANT: ENFILE 23 +CONSTANT: EMFILE 24 +CONSTANT: ENOTTY 25 +CONSTANT: EFBIG 27 +CONSTANT: ENOSPC 28 +CONSTANT: ESPIPE 29 +CONSTANT: EROFS 30 +CONSTANT: EMLINK 31 +CONSTANT: EPIPE 32 +CONSTANT: EDOM 33 +CONSTANT: EDEADLK 36 +CONSTANT: ENAMETOOLONG 38 +CONSTANT: ENOLCK 39 +CONSTANT: ENOSYS 40 +CONSTANT: ENOTEMPTY 41 + +! Error codes used in the Secure CRT functions +CONSTANT: EINVAL 22 +CONSTANT: ERANGE 34 +CONSTANT: EILSEQ 42 +CONSTANT: STRUNCATE 80 + +! Support EDEADLOCK for compatibility with older MS-C versions +ALIAS: EDEADLOCK EDEADLK + +! POSIX SUPPLEMENT +CONSTANT: EADDRINUSE 100 +CONSTANT: EADDRNOTAVAIL 101 +CONSTANT: EAFNOSUPPORT 102 +CONSTANT: EALREADY 103 +CONSTANT: EBADMSG 104 +CONSTANT: ECANCELED 105 +CONSTANT: ECONNABORTED 106 +CONSTANT: ECONNREFUSED 107 +CONSTANT: ECONNRESET 108 +CONSTANT: EDESTADDRREQ 109 +CONSTANT: EHOSTUNREACH 110 +CONSTANT: EIDRM 111 +CONSTANT: EINPROGRESS 112 +CONSTANT: EISCONN 113 +CONSTANT: ELOOP 114 +CONSTANT: EMSGSIZE 115 +CONSTANT: ENETDOWN 116 +CONSTANT: ENETRESET 117 +CONSTANT: ENETUNREACH 118 +CONSTANT: ENOBUFS 119 +CONSTANT: ENODATA 120 +CONSTANT: ENOLINK 121 +CONSTANT: ENOMSG 122 +CONSTANT: ENOPROTOOPT 123 +CONSTANT: ENOSR 124 +CONSTANT: ENOSTR 125 +CONSTANT: ENOTCONN 126 +CONSTANT: ENOTRECOVERABLE 127 +CONSTANT: ENOTSOCK 128 +CONSTANT: ENOTSUP 129 +CONSTANT: EOPNOTSUPP 130 +CONSTANT: EOTHER 131 +CONSTANT: EOVERFLOW 132 +CONSTANT: EOWNERDEAD 133 +CONSTANT: EPROTO 134 +CONSTANT: EPROTONOSUPPORT 135 +CONSTANT: EPROTOTYPE 136 +CONSTANT: ETIME 137 +CONSTANT: ETIMEDOUT 138 +CONSTANT: ETXTBSY 139 +CONSTANT: EWOULDBLOCK 140 + +! From signal.h in msvc 10: +CONSTANT: SIGINT 2 +CONSTANT: SIGILL 4 +CONSTANT: SIGFPE 8 +CONSTANT: SIGSEGV 11 +CONSTANT: SIGTERM 15 +CONSTANT: SIGBREAK 21 +CONSTANT: SIGABRT 22 + +CONSTANT: SIGABRT_COMPAT 6 diff --git a/basis/unix/debugger/debugger.factor b/basis/unix/debugger/debugger.factor index 7a085731d1..7df7ffda43 100644 --- a/basis/unix/debugger/debugger.factor +++ b/basis/unix/debugger/debugger.factor @@ -1,9 +1,9 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors debugger io kernel prettyprint unix ; +USING: accessors debugger io kernel libc prettyprint unix ; IN: unix.debugger -M: unix-error error. +M: libc-error error. "Unix system call failed:" print nl dup message>> write " (" write errno>> pprint ")" print ; diff --git a/basis/unix/ffi/ffi.factor b/basis/unix/ffi/ffi.factor index d5faa8f6d5..599492d323 100644 --- a/basis/unix/ffi/ffi.factor +++ b/basis/unix/ffi/ffi.factor @@ -45,8 +45,6 @@ CONSTANT: DT_WHT 14 LIBRARY: libc -FUNCTION: c-string strerror ( int errno ) ; - STRUCT: group { gr_name c-string } { gr_passwd c-string } diff --git a/basis/unix/ffi/linux/linux.factor b/basis/unix/ffi/linux/linux.factor index 9e3a9b7f65..31afb2365d 100644 --- a/basis/unix/ffi/linux/linux.factor +++ b/basis/unix/ffi/linux/linux.factor @@ -110,173 +110,6 @@ FUNCTION: int open64 ( c-string path, int flags, int prot ) ; FUNCTION: dirent* readdir64 ( DIR* dirp ) ; FUNCTION: int readdir64_r ( void* dirp, dirent* entry, dirent** result ) ; -CONSTANT: EPERM 1 -CONSTANT: ENOENT 2 -CONSTANT: ESRCH 3 -CONSTANT: EINTR 4 -CONSTANT: EIO 5 -CONSTANT: ENXIO 6 -CONSTANT: E2BIG 7 -CONSTANT: ENOEXEC 8 -CONSTANT: EBADF 9 -CONSTANT: ECHILD 10 -CONSTANT: EAGAIN 11 -CONSTANT: ENOMEM 12 -CONSTANT: EACCES 13 -CONSTANT: EFAULT 14 -CONSTANT: ENOTBLK 15 -CONSTANT: EBUSY 16 -CONSTANT: EEXIST 17 -CONSTANT: EXDEV 18 -CONSTANT: ENODEV 19 -CONSTANT: ENOTDIR 20 -CONSTANT: EISDIR 21 -CONSTANT: EINVAL 22 -CONSTANT: ENFILE 23 -CONSTANT: EMFILE 24 -CONSTANT: ENOTTY 25 -CONSTANT: ETXTBSY 26 -CONSTANT: EFBIG 27 -CONSTANT: ENOSPC 28 -CONSTANT: ESPIPE 29 -CONSTANT: EROFS 30 -CONSTANT: EMLINK 31 -CONSTANT: EPIPE 32 -CONSTANT: EDOM 33 -CONSTANT: ERANGE 34 -CONSTANT: EDEADLK 35 -CONSTANT: ENAMETOOLONG 36 -CONSTANT: ENOLCK 37 -CONSTANT: ENOSYS 38 -CONSTANT: ENOTEMPTY 39 -CONSTANT: ELOOP 40 -ALIAS: EWOULDBLOCK EAGAIN -CONSTANT: ENOMSG 42 -CONSTANT: EIDRM 43 -CONSTANT: ECHRNG 44 -CONSTANT: EL2NSYNC 45 -CONSTANT: EL3HLT 46 -CONSTANT: EL3RST 47 -CONSTANT: ELNRNG 48 -CONSTANT: EUNATCH 49 -CONSTANT: ENOCSI 50 -CONSTANT: EL2HLT 51 -CONSTANT: EBADE 52 -CONSTANT: EBADR 53 -CONSTANT: EXFULL 54 -CONSTANT: ENOANO 55 -CONSTANT: EBADRQC 56 -CONSTANT: EBADSLT 57 -ALIAS: EDEADLOCK EDEADLK -CONSTANT: EBFONT 59 -CONSTANT: ENOSTR 60 -CONSTANT: ENODATA 61 -CONSTANT: ETIME 62 -CONSTANT: ENOSR 63 -CONSTANT: ENONET 64 -CONSTANT: ENOPKG 65 -CONSTANT: EREMOTE 66 -CONSTANT: ENOLINK 67 -CONSTANT: EADV 68 -CONSTANT: ESRMNT 69 -CONSTANT: ECOMM 70 -CONSTANT: EPROTO 71 -CONSTANT: EMULTIHOP 72 -CONSTANT: EDOTDOT 73 -CONSTANT: EBADMSG 74 -CONSTANT: EOVERFLOW 75 -CONSTANT: ENOTUNIQ 76 -CONSTANT: EBADFD 77 -CONSTANT: EREMCHG 78 -CONSTANT: ELIBACC 79 -CONSTANT: ELIBBAD 80 -CONSTANT: ELIBSCN 81 -CONSTANT: ELIBMAX 82 -CONSTANT: ELIBEXEC 83 -CONSTANT: EILSEQ 84 -CONSTANT: ERESTART 85 -CONSTANT: ESTRPIPE 86 -CONSTANT: EUSERS 87 -CONSTANT: ENOTSOCK 88 -CONSTANT: EDESTADDRREQ 89 -CONSTANT: EMSGSIZE 90 -CONSTANT: EPROTOTYPE 91 -CONSTANT: ENOPROTOOPT 92 -CONSTANT: EPROTONOSUPPORT 93 -CONSTANT: ESOCKTNOSUPPORT 94 -CONSTANT: EOPNOTSUPP 95 -CONSTANT: EPFNOSUPPORT 96 -CONSTANT: EAFNOSUPPORT 97 -CONSTANT: EADDRINUSE 98 -CONSTANT: EADDRNOTAVAIL 99 -CONSTANT: ENETDOWN 100 -CONSTANT: ENETUNREACH 101 -CONSTANT: ENETRESET 102 -CONSTANT: ECONNABORTED 103 -CONSTANT: ECONNRESET 104 -CONSTANT: ENOBUFS 105 -CONSTANT: EISCONN 106 -CONSTANT: ENOTCONN 107 -CONSTANT: ESHUTDOWN 108 -CONSTANT: ETOOMANYREFS 109 -CONSTANT: ETIMEDOUT 110 -CONSTANT: ECONNREFUSED 111 -CONSTANT: EHOSTDOWN 112 -CONSTANT: EHOSTUNREACH 113 -CONSTANT: EALREADY 114 -CONSTANT: EINPROGRESS 115 -CONSTANT: ESTALE 116 -CONSTANT: EUCLEAN 117 -CONSTANT: ENOTNAM 118 -CONSTANT: ENAVAIL 119 -CONSTANT: EISNAM 120 -CONSTANT: EREMOTEIO 121 -CONSTANT: EDQUOT 122 -CONSTANT: ENOMEDIUM 123 -CONSTANT: EMEDIUMTYPE 124 -CONSTANT: ECANCELED 125 -CONSTANT: ENOKEY 126 -CONSTANT: EKEYEXPIRED 127 -CONSTANT: EKEYREVOKED 128 -CONSTANT: EKEYREJECTED 129 -CONSTANT: EOWNERDEAD 130 -CONSTANT: ENOTRECOVERABLE 131 - -CONSTANT: SIGHUP 1 -CONSTANT: SIGINT 2 -CONSTANT: SIGQUIT 3 -CONSTANT: SIGILL 4 -CONSTANT: SIGTRAP 5 -CONSTANT: SIGABRT 6 -CONSTANT: SIGIOT 6 -CONSTANT: SIGBUS 7 -CONSTANT: SIGFPE 8 -CONSTANT: SIGKILL 9 -CONSTANT: SIGUSR1 10 -CONSTANT: SIGSEGV 11 -CONSTANT: SIGUSR2 12 -CONSTANT: SIGPIPE 13 -CONSTANT: SIGALRM 14 -CONSTANT: SIGTERM 15 -CONSTANT: SIGSTKFLT 16 -CONSTANT: SIGCHLD 17 -ALIAS: SIGCLD SIGCHLD -CONSTANT: SIGCONT 18 -CONSTANT: SIGSTOP 19 -CONSTANT: SIGTSTP 20 -CONSTANT: SIGTTIN 21 -CONSTANT: SIGTTOU 22 -CONSTANT: SIGURG 23 -CONSTANT: SIGXCPU 24 -CONSTANT: SIGXFSZ 25 -CONSTANT: SIGVTALRM 26 -CONSTANT: SIGPROF 27 -CONSTANT: SIGWINCH 28 -CONSTANT: SIGIO 29 -ALIAS: SIGPOLL SIGIO -CONSTANT: SIGPWR 30 -CONSTANT: SIGSYS 31 - FUNCTION: ssize_t sendfile ( int out_fd, int in_fd, off_t* offset, size_t count ) ; diff --git a/basis/unix/ffi/macosx/macosx.factor b/basis/unix/ffi/macosx/macosx.factor index 5a04ebe98c..d3301e0787 100644 --- a/basis/unix/ffi/macosx/macosx.factor +++ b/basis/unix/ffi/macosx/macosx.factor @@ -94,7 +94,7 @@ ALIAS: PF_INET6 AF_INET6 STRUCT: addrinfo { flags int } - { family int } + { family int } { socktype int } { protocol int } { addrlen socklen_t } @@ -128,143 +128,6 @@ STRUCT: dirent { d_namlen __uint8_t } { d_name { char __DARWIN_MAXNAMELEN+1 } } ; -CONSTANT: EPERM 1 -CONSTANT: ENOENT 2 -CONSTANT: ESRCH 3 -CONSTANT: EINTR 4 -CONSTANT: EIO 5 -CONSTANT: ENXIO 6 -CONSTANT: E2BIG 7 -CONSTANT: ENOEXEC 8 -CONSTANT: EBADF 9 -CONSTANT: ECHILD 10 -CONSTANT: EDEADLK 11 -CONSTANT: ENOMEM 12 -CONSTANT: EACCES 13 -CONSTANT: EFAULT 14 -CONSTANT: ENOTBLK 15 -CONSTANT: EBUSY 16 -CONSTANT: EEXIST 17 -CONSTANT: EXDEV 18 -CONSTANT: ENODEV 19 -CONSTANT: ENOTDIR 20 -CONSTANT: EISDIR 21 -CONSTANT: EINVAL 22 -CONSTANT: ENFILE 23 -CONSTANT: EMFILE 24 -CONSTANT: ENOTTY 25 -CONSTANT: ETXTBSY 26 -CONSTANT: EFBIG 27 -CONSTANT: ENOSPC 28 -CONSTANT: ESPIPE 29 -CONSTANT: EROFS 30 -CONSTANT: EMLINK 31 -CONSTANT: EPIPE 32 -CONSTANT: EDOM 33 -CONSTANT: ERANGE 34 -CONSTANT: EAGAIN 35 -ALIAS: EWOULDBLOCK EAGAIN -CONSTANT: EINPROGRESS 36 -CONSTANT: EALREADY 37 -CONSTANT: ENOTSOCK 38 -CONSTANT: EDESTADDRREQ 39 -CONSTANT: EMSGSIZE 40 -CONSTANT: EPROTOTYPE 41 -CONSTANT: ENOPROTOOPT 42 -CONSTANT: EPROTONOSUPPORT 43 -CONSTANT: ESOCKTNOSUPPORT 44 -CONSTANT: ENOTSUP 45 -CONSTANT: EPFNOSUPPORT 46 -CONSTANT: EAFNOSUPPORT 47 -CONSTANT: EADDRINUSE 48 -CONSTANT: EADDRNOTAVAIL 49 -CONSTANT: ENETDOWN 50 -CONSTANT: ENETUNREACH 51 -CONSTANT: ENETRESET 52 -CONSTANT: ECONNABORTED 53 -CONSTANT: ECONNRESET 54 -CONSTANT: ENOBUFS 55 -CONSTANT: EISCONN 56 -CONSTANT: ENOTCONN 57 -CONSTANT: ESHUTDOWN 58 -CONSTANT: ETOOMANYREFS 59 -CONSTANT: ETIMEDOUT 60 -CONSTANT: ECONNREFUSED 61 -CONSTANT: ELOOP 62 -CONSTANT: ENAMETOOLONG 63 -CONSTANT: EHOSTDOWN 64 -CONSTANT: EHOSTUNREACH 65 -CONSTANT: ENOTEMPTY 66 -CONSTANT: EPROCLIM 67 -CONSTANT: EUSERS 68 -CONSTANT: EDQUOT 69 -CONSTANT: ESTALE 70 -CONSTANT: EREMOTE 71 -CONSTANT: EBADRPC 72 -CONSTANT: ERPCMISMATCH 73 -CONSTANT: EPROGUNAVAIL 74 -CONSTANT: EPROGMISMATCH 75 -CONSTANT: EPROCUNAVAIL 76 -CONSTANT: ENOLCK 77 -CONSTANT: ENOSYS 78 -CONSTANT: EFTYPE 79 -CONSTANT: EAUTH 80 -CONSTANT: ENEEDAUTH 81 -CONSTANT: EPWROFF 82 -CONSTANT: EDEVERR 83 -CONSTANT: EOVERFLOW 84 -CONSTANT: EBADEXEC 85 -CONSTANT: EBADARCH 86 -CONSTANT: ESHLIBVERS 87 -CONSTANT: EBADMACHO 88 -CONSTANT: ECANCELED 89 -CONSTANT: EIDRM 90 -CONSTANT: ENOMSG 91 -CONSTANT: EILSEQ 92 -CONSTANT: ENOATTR 93 -CONSTANT: EBADMSG 94 -CONSTANT: EMULTIHOP 95 -CONSTANT: ENODATA 96 -CONSTANT: ENOLINK 97 -CONSTANT: ENOSR 98 -CONSTANT: ENOSTR 99 -CONSTANT: EPROTO 100 -CONSTANT: ETIME 101 -CONSTANT: EOPNOTSUPP 102 -CONSTANT: ENOPOLICY 103 - -CONSTANT: SIGHUP 1 -CONSTANT: SIGINT 2 -CONSTANT: SIGQUIT 3 -CONSTANT: SIGILL 4 -CONSTANT: SIGTRAP 5 -CONSTANT: SIGABRT 6 -CONSTANT: SIGEMT 7 -CONSTANT: SIGFPE 8 -CONSTANT: SIGKILL 9 -CONSTANT: SIGBUS 10 -CONSTANT: SIGSEGV 11 -CONSTANT: SIGSYS 12 -CONSTANT: SIGPIPE 13 -CONSTANT: SIGALRM 14 -CONSTANT: SIGTERM 15 -CONSTANT: SIGURG 16 -CONSTANT: SIGSTOP 17 -CONSTANT: SIGTSTP 18 -CONSTANT: SIGCONT 19 -CONSTANT: SIGCHLD 20 -CONSTANT: SIGTTIN 21 -CONSTANT: SIGTTOU 22 -CONSTANT: SIGIO 23 -CONSTANT: SIGXCPU 24 -CONSTANT: SIGXFSZ 25 -CONSTANT: SIGVTALRM 26 -CONSTANT: SIGPROF 27 -CONSTANT: SIGWINCH 28 -CONSTANT: SIGINFO 29 -CONSTANT: SIGUSR1 30 -CONSTANT: SIGUSR2 31 - STRUCT: sf_hdtr { headers void* } { hdr_cnt int } diff --git a/basis/unix/unix.factor b/basis/unix/unix.factor index 80e0dd2c9b..9f69d8e683 100644 --- a/basis/unix/unix.factor +++ b/basis/unix/unix.factor @@ -9,12 +9,6 @@ sequences sequences.generalizations stack-checker strings system unix.time unix.types vocabs vocabs.loader unix.ffi ; IN: unix -ERROR: unix-error errno message ; - -: (io-error) ( -- * ) errno dup strerror unix-error ; - -: io-error ( n -- ) 0 < [ (io-error) ] when ; - ERROR: unix-system-call-error args errno message word ; : unix-call-failed? ( ret -- ? )