forked from KolibriOS/kolibrios
- Fixed socket functions for compatibility with UNIX.
git-svn-id: svn://kolibrios.org@8514 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
2082d3c93f
commit
0c1a5475ab
@ -40,7 +40,7 @@ struct addrinfo {
|
|||||||
int ai_protocol;
|
int ai_protocol;
|
||||||
int ai_addrlen;
|
int ai_addrlen;
|
||||||
char *ai_canonname;
|
char *ai_canonname;
|
||||||
sockaddr *ai_addr;
|
struct sockaddr *ai_addr;
|
||||||
struct addrinfo *ai_next;
|
struct addrinfo *ai_next;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
// Address families
|
// Address families
|
||||||
#define AF_UNSPEC 0
|
#define AF_UNSPEC 0
|
||||||
#define AF_LOCAL 1
|
#define AF_LOCAL 1
|
||||||
|
#define AF_INET 2
|
||||||
#define AF_INET4 2 // IPv4
|
#define AF_INET4 2 // IPv4
|
||||||
#define AF_INET6 10 // IPv6
|
#define AF_INET6 10 // IPv6
|
||||||
|
|
||||||
@ -75,12 +76,12 @@
|
|||||||
extern int err_code;
|
extern int err_code;
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
typedef struct{
|
struct sockaddr{
|
||||||
unsigned short sin_family;
|
unsigned short sin_family;
|
||||||
unsigned short sin_port;
|
unsigned short sin_port;
|
||||||
unsigned int sin_addr;
|
unsigned int sin_addr;
|
||||||
unsigned long long sin_zero;
|
unsigned long long sin_zero;
|
||||||
}sockaddr;
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
@ -94,10 +95,10 @@ typedef struct{
|
|||||||
|
|
||||||
int socket(int domain, int type, int protocol);
|
int socket(int domain, int type, int protocol);
|
||||||
int close(int socket);
|
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 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);
|
||||||
int accept(int socket, const sockaddr* address, int address_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 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 recv(int socket, void *buffer, size_t buff_len, int flag);
|
||||||
int setsockopt(int socket,const optstruct* opt);
|
int setsockopt(int socket,const optstruct* opt);
|
||||||
|
@ -19,7 +19,7 @@ int close(int socket)
|
|||||||
:"a"(75), "b"(1), "c"(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(
|
asm volatile(
|
||||||
"int $0x40"
|
"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(
|
asm volatile(
|
||||||
"int $0x40"
|
"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(
|
asm volatile(
|
||||||
"int $0x40"
|
"int $0x40"
|
||||||
|
Loading…
Reference in New Issue
Block a user