forked from KolibriOS/kolibrios
svn commit -m " newlibc reverted to revision 8522"
git-svn-id: svn://kolibrios.org@8538 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
f4bcacd66c
commit
59994f2adb
@ -128,10 +128,10 @@ extern __IMPORT char *program_invocation_short_name;
|
|||||||
#define ENOTEMPTY 90 /* Directory not empty */
|
#define ENOTEMPTY 90 /* Directory not empty */
|
||||||
#define ENAMETOOLONG 91 /* File or path name too long */
|
#define ENAMETOOLONG 91 /* File or path name too long */
|
||||||
#define ELOOP 92 /* Too many symbolic links */
|
#define ELOOP 92 /* Too many symbolic links */
|
||||||
#define EOPNOTSUPP 4 /* Operation not supported on socket */
|
#define EOPNOTSUPP 95 /* Operation not supported on socket */
|
||||||
#define EPFNOSUPPORT 96 /* Protocol family not supported */
|
#define EPFNOSUPPORT 96 /* Protocol family not supported */
|
||||||
#define ECONNRESET 51 /* Connection reset by peer */
|
#define ECONNRESET 104 /* Connection reset by peer */
|
||||||
#define ENOBUFS 1 /* No buffer space available */
|
#define ENOBUFS 105 /* No buffer space available */
|
||||||
#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */
|
#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */
|
||||||
#define EPROTOTYPE 107 /* Protocol wrong type for socket */
|
#define EPROTOTYPE 107 /* Protocol wrong type for socket */
|
||||||
#define ENOTSOCK 108 /* Socket operation on non-socket */
|
#define ENOTSOCK 108 /* Socket operation on non-socket */
|
||||||
@ -139,29 +139,26 @@ extern __IMPORT char *program_invocation_short_name;
|
|||||||
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
||||||
#define ESHUTDOWN 110 /* Can't send after socket shutdown */
|
#define ESHUTDOWN 110 /* Can't send after socket shutdown */
|
||||||
#endif
|
#endif
|
||||||
#define ECONNREFUSED 61 /* Connection refused */
|
#define ECONNREFUSED 111 /* Connection refused */
|
||||||
#define EADDRINUSE 20 /* Address already in use */
|
#define EADDRINUSE 112 /* Address already in use */
|
||||||
#define ECONNABORTED 53 /* Software caused connection abort */
|
#define ECONNABORTED 113 /* Software caused connection abort */
|
||||||
#define ENETUNREACH 114 /* Network is unreachable */
|
#define ENETUNREACH 114 /* Network is unreachable */
|
||||||
#define ENETDOWN 115 /* Network interface is not configured */
|
#define ENETDOWN 115 /* Network interface is not configured */
|
||||||
#define ETIMEDOUT 60 /* Connection timed out */
|
#define ETIMEDOUT 116 /* Connection timed out */
|
||||||
#define EHOSTDOWN 117 /* Host is down */
|
#define EHOSTDOWN 117 /* Host is down */
|
||||||
#define EHOSTUNREACH 118 /* Host is unreachable */
|
#define EHOSTUNREACH 118 /* Host is unreachable */
|
||||||
#define EINPROGRESS 2 /* Connection already in progress */
|
#define EINPROGRESS 119 /* Connection already in progress */
|
||||||
#define EALREADY 10 /* Socket already connected */
|
#define EALREADY 120 /* Socket already connected */
|
||||||
#define EDESTADDRREQ 121 /* Destination address required */
|
#define EDESTADDRREQ 121 /* Destination address required */
|
||||||
#define EMSGSIZE 12 /* Message too long */
|
#define EMSGSIZE 122 /* Message too long */
|
||||||
#define EPROTONOSUPPORT 123 /* Unknown protocol */
|
#define EPROTONOSUPPORT 123 /* Unknown protocol */
|
||||||
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
||||||
#define ESOCKTNOSUPPORT 124 /* Socket type not supported */
|
#define ESOCKTNOSUPPORT 124 /* Socket type not supported */
|
||||||
#endif
|
#endif
|
||||||
#define EADDRNOTAVAIL 125 /* Address not available */
|
#define EADDRNOTAVAIL 125 /* Address not available */
|
||||||
#define ENETRESET 126 /* Connection aborted by network */
|
#define ENETRESET 126 /* Connection aborted by network */
|
||||||
#define EISCONN 56 /* Socket is already connected */
|
#define EISCONN 127 /* Socket is already connected */
|
||||||
#define ENOTCONN 9 /* Socket is not connected */
|
#define ENOTCONN 128 /* Socket is not connected */
|
||||||
#define EINVALUE 11
|
|
||||||
#define ENOMEM_S 18
|
|
||||||
|
|
||||||
#define ETOOMANYREFS 129
|
#define ETOOMANYREFS 129
|
||||||
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
||||||
#define EPROCLIM 130
|
#define EPROCLIM 130
|
||||||
@ -185,7 +182,7 @@ extern __IMPORT char *program_invocation_short_name;
|
|||||||
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
||||||
#define ESTRPIPE 143 /* Streams pipe error */
|
#define ESTRPIPE 143 /* Streams pipe error */
|
||||||
#endif
|
#endif
|
||||||
#define EWOULDBLOCK 6 /* Operation would block */
|
#define EWOULDBLOCK EAGAIN /* Operation would block */
|
||||||
|
|
||||||
#define __ELASTERROR 2000 /* Users can add values starting here */
|
#define __ELASTERROR 2000 /* Users can add values starting here */
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#define __SOCKET_H__
|
#define __SOCKET_H__
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
// Socket Types
|
// Socket Types
|
||||||
#define SOCK_STREAM 1
|
#define SOCK_STREAM 1
|
||||||
@ -55,7 +54,26 @@
|
|||||||
#define SO_BINDTODEVICE (1<<9)
|
#define SO_BINDTODEVICE (1<<9)
|
||||||
#define SO_NONBLOCK (1<<31)
|
#define SO_NONBLOCK (1<<31)
|
||||||
|
|
||||||
|
// Error Codes
|
||||||
|
#define ENOBUFS 1
|
||||||
|
#define EINPROGRESS 2
|
||||||
|
#define EOPNOTSUPP 4
|
||||||
|
#define EWOULDBLOCK 6
|
||||||
|
#define ENOTCONN 9
|
||||||
|
#define EALREADY 10
|
||||||
|
#define EINVALUE 11
|
||||||
|
#define EMSGSIZE 12
|
||||||
|
#define ENOMEM 18
|
||||||
|
#define EADDRINUSE 20
|
||||||
|
#define ECONNREFUSED 61
|
||||||
|
#define ECONNRESET 52
|
||||||
|
#define EISCONN 56
|
||||||
|
#define ETIMEDOUT 60
|
||||||
|
#define ECONNABORTED 53
|
||||||
|
|
||||||
|
|
||||||
#define PORT(X) (X<<8)
|
#define PORT(X) (X<<8)
|
||||||
|
int err_code;
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct sockaddr{
|
struct sockaddr{
|
||||||
@ -80,7 +98,7 @@ static inline int socket(int domain, int type, int protocol)
|
|||||||
int socket;
|
int socket;
|
||||||
asm volatile(
|
asm volatile(
|
||||||
"int $0x40"
|
"int $0x40"
|
||||||
:"=b"(errno), "=a"(socket)
|
:"=b"(err_code), "=a"(socket)
|
||||||
:"a"(75), "b"(0), "c"(domain), "d"(type), "S"(protocol)
|
:"a"(75), "b"(0), "c"(domain), "d"(type), "S"(protocol)
|
||||||
);
|
);
|
||||||
return socket;
|
return socket;
|
||||||
@ -91,7 +109,7 @@ static inline int close(int socket)
|
|||||||
int status;
|
int status;
|
||||||
asm volatile(
|
asm volatile(
|
||||||
"int $0x40"
|
"int $0x40"
|
||||||
:"=b"(errno), "=a"(status)
|
:"=b"(err_code), "=a"(status)
|
||||||
:"a"(75), "b"(1), "c"(socket)
|
:"a"(75), "b"(1), "c"(socket)
|
||||||
);
|
);
|
||||||
return status;
|
return status;
|
||||||
@ -102,7 +120,7 @@ static inline int bind(int socket, const struct sockaddr *addres, int addres_len
|
|||||||
int status;
|
int status;
|
||||||
asm volatile(
|
asm volatile(
|
||||||
"int $0x40"
|
"int $0x40"
|
||||||
:"=b"(errno), "=a"(status)
|
:"=b"(err_code), "=a"(status)
|
||||||
:"a"(75), "b"(2), "c"(socket), "d"(addres), "S"(addres_len)
|
:"a"(75), "b"(2), "c"(socket), "d"(addres), "S"(addres_len)
|
||||||
);
|
);
|
||||||
return status;
|
return status;
|
||||||
@ -113,7 +131,7 @@ static inline int listen(int socket, int backlog)
|
|||||||
int status;
|
int status;
|
||||||
asm volatile(
|
asm volatile(
|
||||||
"int $0x40"
|
"int $0x40"
|
||||||
:"=b"(errno), "=a"(status)
|
:"=b"(err_code), "=a"(status)
|
||||||
:"a"(75), "b"(3), "c"(socket), "d"(backlog)
|
:"a"(75), "b"(3), "c"(socket), "d"(backlog)
|
||||||
);
|
);
|
||||||
return status;
|
return status;
|
||||||
@ -124,7 +142,7 @@ static inline int connect(int socket, const struct sockaddr* address, int socket
|
|||||||
int status;
|
int status;
|
||||||
asm volatile(
|
asm volatile(
|
||||||
"int $0x40"
|
"int $0x40"
|
||||||
:"=b"(errno), "=a"(status)
|
:"=b"(err_code), "=a"(status)
|
||||||
:"a"(75), "b"(4), "c"(socket), "d"(address), "S"(socket_len)
|
:"a"(75), "b"(4), "c"(socket), "d"(address), "S"(socket_len)
|
||||||
);
|
);
|
||||||
return status;
|
return status;
|
||||||
@ -135,7 +153,7 @@ static inline int accept(int socket, const struct sockaddr *address, int address
|
|||||||
int new_socket;
|
int new_socket;
|
||||||
asm volatile(
|
asm volatile(
|
||||||
"int $0x40"
|
"int $0x40"
|
||||||
:"=b"(errno), "=a"(new_socket)
|
:"=b"(err_code), "=a"(new_socket)
|
||||||
:"a"(75), "b"(5), "c"(socket), "d"(address), "S"(address_len)
|
:"a"(75), "b"(5), "c"(socket), "d"(address), "S"(address_len)
|
||||||
);
|
);
|
||||||
return new_socket;
|
return new_socket;
|
||||||
@ -146,7 +164,7 @@ static inline int send(int socket, const void *message, size_t msg_len, int flag
|
|||||||
int status;
|
int status;
|
||||||
asm volatile(
|
asm volatile(
|
||||||
"int $0x40"
|
"int $0x40"
|
||||||
:"=b"(errno), "=a"(status)
|
:"=b"(err_code), "=a"(status)
|
||||||
:"a"(75), "b"(6), "c"(socket), "d"(message), "S"(msg_len), "D"(flag)
|
:"a"(75), "b"(6), "c"(socket), "d"(message), "S"(msg_len), "D"(flag)
|
||||||
);
|
);
|
||||||
return status;
|
return status;
|
||||||
@ -157,7 +175,7 @@ static inline int recv(int socket, void *buffer, size_t buff_len, int flag)
|
|||||||
int status;
|
int status;
|
||||||
asm volatile(
|
asm volatile(
|
||||||
"int $0x40"
|
"int $0x40"
|
||||||
:"=b"(errno), "=a"(status)
|
:"=b"(err_code), "=a"(status)
|
||||||
:"a"(75), "b"(7), "c"(socket), "d"(buffer), "S"(buff_len), "D"(flag)
|
:"a"(75), "b"(7), "c"(socket), "d"(buffer), "S"(buff_len), "D"(flag)
|
||||||
);
|
);
|
||||||
return status;
|
return status;
|
||||||
@ -168,7 +186,7 @@ static inline int setsockopt(int socket,const optstruct* opt)
|
|||||||
int status;
|
int status;
|
||||||
asm volatile(
|
asm volatile(
|
||||||
"int $0x40"
|
"int $0x40"
|
||||||
:"=b"(errno), "=a"(status)
|
:"=b"(err_code), "=a"(status)
|
||||||
:"a"(75), "b"(8), "c"(socket),"d"(opt)
|
:"a"(75), "b"(8), "c"(socket),"d"(opt)
|
||||||
);
|
);
|
||||||
return status;
|
return status;
|
||||||
@ -179,7 +197,7 @@ static inline int getsockopt(int socket, optstruct* opt)
|
|||||||
int status;
|
int status;
|
||||||
asm volatile(
|
asm volatile(
|
||||||
"int $0x40"
|
"int $0x40"
|
||||||
:"=b"(errno), "=a"(status)
|
:"=b"(err_code), "=a"(status)
|
||||||
:"a"(75), "b"(9), "c"(socket),"d"(opt)
|
:"a"(75), "b"(9), "c"(socket),"d"(opt)
|
||||||
);
|
);
|
||||||
return status;
|
return status;
|
||||||
@ -192,7 +210,7 @@ static inline int socketpair(int *socket1, int *socket2)
|
|||||||
:"=b"(*socket2), "=a"(*socket1)
|
:"=b"(*socket2), "=a"(*socket1)
|
||||||
:"a"(75), "b"(10)
|
:"a"(75), "b"(10)
|
||||||
);
|
);
|
||||||
errno=*socket2;
|
err_code=*socket2;
|
||||||
return *socket1;
|
return *socket1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user