From 0c1a5475abdc3b853f330fc15886cb0a8f6ce057 Mon Sep 17 00:00:00 2001 From: superturbocat2001 Date: Mon, 4 Jan 2021 20:24:35 +0000 Subject: [PATCH] - Fixed socket functions for compatibility with UNIX. git-svn-id: svn://kolibrios.org@8514 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../develop/ktcc/trunk/libc/include/net/network.h | 2 +- programs/develop/ktcc/trunk/libc/include/net/socket.h | 11 ++++++----- programs/develop/ktcc/trunk/libc/net/socket.c | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/programs/develop/ktcc/trunk/libc/include/net/network.h b/programs/develop/ktcc/trunk/libc/include/net/network.h index 38158193ba..784c22edc8 100644 --- a/programs/develop/ktcc/trunk/libc/include/net/network.h +++ b/programs/develop/ktcc/trunk/libc/include/net/network.h @@ -40,7 +40,7 @@ struct addrinfo { int ai_protocol; int ai_addrlen; char *ai_canonname; - sockaddr *ai_addr; + struct sockaddr *ai_addr; struct addrinfo *ai_next; }; #pragma pack(pop) diff --git a/programs/develop/ktcc/trunk/libc/include/net/socket.h b/programs/develop/ktcc/trunk/libc/include/net/socket.h index 114a5fae7a..e233b96841 100644 --- a/programs/develop/ktcc/trunk/libc/include/net/socket.h +++ b/programs/develop/ktcc/trunk/libc/include/net/socket.h @@ -21,6 +21,7 @@ // Address families #define AF_UNSPEC 0 #define AF_LOCAL 1 +#define AF_INET 2 #define AF_INET4 2 // IPv4 #define AF_INET6 10 // IPv6 @@ -75,12 +76,12 @@ extern int err_code; #pragma pack(push,1) -typedef struct{ +struct sockaddr{ unsigned short sin_family; unsigned short sin_port; unsigned int sin_addr; unsigned long long sin_zero; -}sockaddr; +}; #pragma pack(pop) #pragma pack(push,1) @@ -94,10 +95,10 @@ typedef struct{ int socket(int domain, int type, int protocol); int close(int socket); -int bind(int socket, const sockaddr *addres, int addres_len); +int bind(int socket, const struct sockaddr *addres, int addres_len); int listen(int socket, int backlog); -int connect(int socket, const sockaddr* address, int socket_len); -int accept(int socket, const sockaddr* address, int address_len); +int connect(int socket, const struct sockaddr* address, int socket_len); +int accept(int socket, const struct sockaddr* address, int address_len); int send(int socket, const void *message, size_t msg_len, int flag); int recv(int socket, void *buffer, size_t buff_len, int flag); int setsockopt(int socket,const optstruct* opt); diff --git a/programs/develop/ktcc/trunk/libc/net/socket.c b/programs/develop/ktcc/trunk/libc/net/socket.c index ce5720a77c..495b8681f7 100644 --- a/programs/develop/ktcc/trunk/libc/net/socket.c +++ b/programs/develop/ktcc/trunk/libc/net/socket.c @@ -19,7 +19,7 @@ int close(int socket) :"a"(75), "b"(1), "c"(socket) ); } -int bind(int socket, const sockaddr *addres, int addres_len) +int bind(int socket, const struct sockaddr *addres, int addres_len) { asm volatile( "int $0x40" @@ -37,7 +37,7 @@ int listen(int socket, int backlog) ); } -int connect(int socket,const sockaddr* address, int socket_len) +int connect(int socket,const struct sockaddr* address, int socket_len) { asm volatile( "int $0x40" @@ -46,7 +46,7 @@ int connect(int socket,const sockaddr* address, int socket_len) ); } -int accept(int socket, const sockaddr *address, int address_len) +int accept(int socket, const struct sockaddr *address, int address_len) { asm volatile( "int $0x40"