- Fixed network headers in newlibc and C_layer

git-svn-id: svn://kolibrios.org@8522 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
superturbocat2001 2021-01-05 16:19:36 +00:00
parent 38cd0f8a9a
commit 08edaac2b6
2 changed files with 10 additions and 8 deletions

View File

@ -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

View File

@ -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(