From 08edaac2b6d9f79c7bf8749be94006b55c1ecee1 Mon Sep 17 00:00:00 2001 From: superturbocat2001 Date: Tue, 5 Jan 2021 16:19:36 +0000 Subject: [PATCH] - Fixed network headers in newlibc and C_layer git-svn-id: svn://kolibrios.org@8522 a494cfbc-eb01-0410-851d-a64ba20cac60 --- contrib/C_Layer/INCLUDE/kolibri_network.h | 6 +++--- contrib/sdk/sources/newlib/libc/include/sys/socket.h | 12 +++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/contrib/C_Layer/INCLUDE/kolibri_network.h b/contrib/C_Layer/INCLUDE/kolibri_network.h index 46a33da3d9..5b771985af 100644 --- a/contrib/C_Layer/INCLUDE/kolibri_network.h +++ b/contrib/C_Layer/INCLUDE/kolibri_network.h @@ -33,14 +33,14 @@ unsigned short TTL; #pragma pack(pop) #pragma pack(push, 1) -struct addrinfo { +struct addrinfo{ int ai_flags; int ai_family; int ai_socktype; int ai_protocol; int ai_addrlen; char *ai_canonname; - sockaddr *ai_addr; + struct sockaddr *ai_addr; struct addrinfo *ai_next; }; #pragma pack(pop) @@ -48,7 +48,7 @@ struct addrinfo { extern int networklib_init (); extern int (*inet_addr)(const char* hostname) __attribute__ ((stdcall)); extern char* (*inet_ntoa)(int ip_addr) __attribute__ ((stdcall)); -extern int (*getaddrinfo)(char* hostname, int servname, struct addrinfo* hints, struct addrinfo** res) __attribute__ ((stdcall)); +extern int (*getaddrinfo)(char* hostname, char *servname, struct addrinfo* hints, struct addrinfo** res) __attribute__ ((stdcall)); extern void (*freeaddrinfo)(struct addrinfo* ai) __attribute__ ((stdcall)); #endif diff --git a/contrib/sdk/sources/newlib/libc/include/sys/socket.h b/contrib/sdk/sources/newlib/libc/include/sys/socket.h index 4c9b08619f..eb138edbe2 100644 --- a/contrib/sdk/sources/newlib/libc/include/sys/socket.h +++ b/contrib/sdk/sources/newlib/libc/include/sys/socket.h @@ -21,6 +21,7 @@ // Address families #define AF_UNSPEC 0 #define AF_LOCAL 1 +#define AF_INET 2 // Default INET=IPv4 #define AF_INET4 2 // IPv4 #define AF_INET6 10 // IPv6 @@ -75,12 +76,12 @@ 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) @@ -113,7 +114,8 @@ static inline int close(int socket) ); return status; } -static inline int bind(int socket, const sockaddr *addres, int addres_len) + +static inline int bind(int socket, const struct sockaddr *addres, int addres_len) { int status; asm volatile( @@ -135,7 +137,7 @@ static inline int listen(int socket, int backlog) return status; } -static inline int connect(int socket,const sockaddr* address, int socket_len) +static inline int connect(int socket, const struct sockaddr* address, int socket_len) { int status; asm volatile( @@ -146,7 +148,7 @@ static inline int connect(int socket,const sockaddr* address, int socket_len) return status; } -static inline int accept(int socket, const sockaddr *address, int address_len) +static inline int accept(int socket, const struct sockaddr *address, int address_len) { int new_socket; asm volatile(