Skip to content

Commit 10e144e

Browse files
committed
implement shutdown
1 parent a3d11ad commit 10e144e

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

libogc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ add_library(ogc STATIC
1414
ogc_sockets/soc_send.c
1515
ogc_sockets/soc_recv.c
1616
ogc_sockets/soc_connect.c
17+
ogc_sockets/soc_shutdown.c
1718

1819
console.c
1920
lwp_queue.c

libogc/ogc_sockets/soc_shutdown.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include "soc_common.h"
2+
#include <errno.h>
3+
#include <sys/socket.h>
4+
5+
int shutdown(int socket, int how) {
6+
socket = soc_get_fd(socket);
7+
8+
if(socket < 0) {
9+
errno = -socket;
10+
return -1;
11+
}
12+
13+
int ret = net_shutdown(socket, how);
14+
if (ret < 0 ) {
15+
errno = -ret;
16+
ret = -1;
17+
}
18+
return ret;
19+
}

0 commit comments

Comments
 (0)