mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +00:00
sockets: expect fd argument
This commit is contained in:
+12
-10
@@ -65,41 +65,43 @@ int socket_listen(struct _socket_t* sock, int backlog){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int socket_connect(struct _socket_t* sock, void* addr, socklen_t addrlen){
|
int socket_connect(struct _socket_t* sock, void* addr, socklen_t addrlen, fd_t* fd){
|
||||||
|
|
||||||
switch(sock->family){
|
switch(sock->family){
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
return unsocket_connect(sock, addr, addrlen);
|
return unsocket_connect(sock, addr, addrlen, fd);
|
||||||
default:
|
default:
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int socket_accept(socket_t** peer, socket_t* sock, void* addr, socklen_t* addrlen){
|
int socket_accept(socket_t** peer, socket_t* sock, void* addr, socklen_t* addrlen, fd_t* fd){
|
||||||
switch(sock->family){
|
switch(sock->family){
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
return unsocket_accept(peer, sock, addr, addrlen);
|
return unsocket_accept(peer, sock, addr, addrlen, fd);
|
||||||
default:
|
default:
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int socket_send(socket_t* socket, void* buff, socklen_t len, int flags, int* count){
|
int socket_send(socket_t* socket, void* buff, size_t len, int flags, int* error, fd_t* fd){
|
||||||
switch(socket->family){
|
switch(socket->family){
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
return unsocket_send(socket, buff, len, flags, count);
|
return unsocket_send(socket, buff, len, flags, error, fd);
|
||||||
default:
|
default:
|
||||||
return EINVAL;
|
*error = EINVAL;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int socket_recv(socket_t* socket, void* buff, socklen_t len, int flags, int* count){
|
int socket_recv(socket_t* socket, void* buff, size_t len, int flags, int* error, fd_t* fd){
|
||||||
switch(socket->family){
|
switch(socket->family){
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
return unsocket_recv(socket, buff, len, flags, count);
|
return unsocket_recv(socket, buff, len, flags, error, fd);
|
||||||
default:
|
default:
|
||||||
return EINVAL;
|
*error = EINVAL;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ syscallret syscall_accept(int sockfd, void* addr, socklen_t* addrlen){
|
|||||||
|
|
||||||
socket_t* peer;
|
socket_t* peer;
|
||||||
|
|
||||||
retv.errno = socket_accept(&peer, listenersock, addr, addrlen);
|
retv.errno = socket_accept(&peer, listenersock, addr, addrlen, fd);
|
||||||
|
|
||||||
if(retv.errno)
|
if(retv.errno)
|
||||||
goto _fail;
|
goto _fail;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ syscallret syscall_connect(int sockfd, void* addr, size_t addrlen){
|
|||||||
goto _ret;
|
goto _ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
retv.errno = socket_connect(fd->node->objdata, addr, addrlen);
|
retv.errno = socket_connect(fd->node->objdata, addr, addrlen, fd);
|
||||||
|
|
||||||
_ret:
|
_ret:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user