- Moved error codes to errno.h

- Removed non-working files for compilation via gcc.

git-svn-id: svn://kolibrios.org@8536 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
superturbocat2001
2021-01-15 21:48:24 +00:00
parent b29cc6670d
commit a61177b2ae
10 changed files with 63 additions and 200 deletions

View File

@@ -1,12 +1,10 @@
#include <net/socket.h>
int err_code=0;
int socket(int domain, int type, int protocol)
{
asm volatile(
"int $0x40"
:"=b"(err_code)
:"=b"(errno)
:"a"(75), "b"(0), "c"(domain), "d"(type), "S"(protocol)
);
}
@@ -15,7 +13,7 @@ int close(int socket)
{
asm volatile(
"int $0x40"
:"=b"(err_code)
:"=b"(errno)
:"a"(75), "b"(1), "c"(socket)
);
}
@@ -23,7 +21,7 @@ int bind(int socket, const struct sockaddr *addres, int addres_len)
{
asm volatile(
"int $0x40"
:"=b"(err_code)
:"=b"(errno)
:"a"(75), "b"(2), "c"(socket), "d"(addres), "S"(addres_len)
);
}
@@ -32,7 +30,7 @@ int listen(int socket, int backlog)
{
asm volatile(
"int $0x40"
:"=b"(err_code)
:"=b"(errno)
:"a"(75), "b"(3), "c"(socket), "d"(backlog)
);
}
@@ -41,7 +39,7 @@ int connect(int socket,const struct sockaddr* address, int socket_len)
{
asm volatile(
"int $0x40"
:"=b"(err_code)
:"=b"(errno)
:"a"(75), "b"(4), "c"(socket), "d"(address), "S"(socket_len)
);
}
@@ -50,7 +48,7 @@ int accept(int socket, const struct sockaddr *address, int address_len)
{
asm volatile(
"int $0x40"
:"=b"(err_code)
:"=b"(errno)
:"a"(75), "b"(5), "c"(socket), "d"(address), "S"(address_len)
);
}
@@ -59,7 +57,7 @@ int send(int socket, const void *message, size_t msg_len, int flag)
{
asm volatile(
"int $0x40"
:"=b"(err_code)
:"=b"(errno)
:"a"(75), "b"(6), "c"(socket), "d"(message), "S"(msg_len), "D"(flag)
);
}
@@ -68,7 +66,7 @@ int recv(int socket, void *buffer, size_t buff_len, int flag)
{
asm volatile(
"int $0x40"
:"=b"(err_code)
:"=b"(errno)
:"a"(75), "b"(7), "c"(socket), "d"(buffer), "S"(buff_len), "D"(flag)
);
}
@@ -77,7 +75,7 @@ int setsockopt(int socket,const optstruct* opt)
{
asm volatile(
"int $0x40"
:"=b"(err_code)
:"=b"(errno)
:"a"(75), "b"(8), "c"(socket),"d"(opt)
);
}
@@ -86,7 +84,7 @@ int getsockopt(int socket, optstruct* opt)
{
asm volatile(
"int $0x40"
:"=b"(err_code)
:"=b"(errno)
:"a"(75), "b"(9), "c"(socket),"d"(opt)
);
}
@@ -98,6 +96,6 @@ int socketpair(int *sock1, int *sock2)
:"=b"(*sock2), "=a"(*sock1)
:"a"(75), "b"(10)
);
err_code = *sock2;
errno = *sock2;
return *sock1;
}