My Project
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
soc_shutdown.c
Go to the documentation of this file.
1 #include "soc_common.h"
2 #include <sys/socket.h>
3 
4 int shutdown(int sockfd, int shutdown_type)
5 {
6  int ret=0;
7  u32 *cmdbuf = getThreadCommandBuffer();
8 
9  cmdbuf[0] = 0x000C0082;
10  cmdbuf[1] = (u32)sockfd;
11  cmdbuf[2] = (u32)shutdown_type;
12  cmdbuf[3] = 0x20;
13 
14  if((ret = svcSendSyncRequest(SOCU_handle))!=0)return ret;
15 
16  ret = (int)cmdbuf[1];
17  if(ret==0)ret = _net_convert_error(cmdbuf[2]);
18  SOCU_errno = ret;
19 
20  if(ret!=0)return -1;
21  return 0;
22 }
int shutdown(int sockfd, int shutdown_type)
Definition: soc_shutdown.c:4
u32 * getThreadCommandBuffer(void)
int SOCU_errno
Definition: soc_common.c:5
uint32_t u32
Definition: types.h:23
s32 _net_convert_error(s32 sock_retval)
Definition: soc_common.c:92
s32 svcSendSyncRequest(Handle session)
Handle SOCU_handle
Definition: soc_common.c:4