- Fixed socket functions for compatibility with UNIX.

git-svn-id: svn://kolibrios.org@8514 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
superturbocat2001 2021-01-04 20:24:35 +00:00
parent 2082d3c93f
commit 0c1a5475ab
3 changed files with 10 additions and 9 deletions

View File

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

View File

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

View File

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