Implemented SOCU_AddGlobalSocket.
This commit is contained in:
parent
7adab4d940
commit
b7b78414da
@ -138,3 +138,10 @@ int SOCU_GetNetworkOpt(int level, NetworkOpt optname, void * optval, socklen_t *
|
||||
* @return error
|
||||
*/
|
||||
int SOCU_GetIPInfo(struct in_addr *ip, struct in_addr *netmask, struct in_addr *broadcast);
|
||||
|
||||
/**
|
||||
* @brief Adds a global socket.
|
||||
* @param sockfd The socket fd.
|
||||
* @return error
|
||||
*/
|
||||
int SOCU_AddGlobalSocket(int sockfd);
|
||||
|
21
libctru/source/services/soc/soc_addglobalsocket.c
Normal file
21
libctru/source/services/soc/soc_addglobalsocket.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include "soc_common.h"
|
||||
#include <3ds/ipc.h>
|
||||
#include <3ds/result.h>
|
||||
|
||||
int SOCU_AddGlobalSocket(int sockfd)
|
||||
{
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
|
||||
sockfd = soc_get_fd(sockfd);
|
||||
if(sockfd < 0) {
|
||||
errno = -sockfd;
|
||||
return -1;
|
||||
}
|
||||
|
||||
cmdbuf[0] = IPC_MakeHeader(0x23,1,0); // 0x230040
|
||||
cmdbuf[1] = (u32)sockfd;
|
||||
|
||||
int ret = svcSendSyncRequest(SOCU_handle);
|
||||
if(R_FAILED(ret))return ret;
|
||||
return cmdbuf[1];
|
||||
}
|
Loading…
Reference in New Issue
Block a user