MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / lwp_channel_close

Function lwp_channel_close

components/lwp/lwp_ipc.c:1141–1172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1139}
1140
1141rt_err_t lwp_channel_close(int fdt_type, int fd)
1142{
1143 rt_channel_t ch;
1144 struct dfs_file *d;
1145 struct dfs_vnode *vnode;
1146
1147 d = lwp_fd_get(fdt_type, fd);
1148 if (!d)
1149 {
1150 return -RT_EIO;
1151 }
1152
1153 vnode = d->vnode;
1154 if (!vnode)
1155 {
1156 return -RT_EIO;
1157 }
1158
1159 ch = fd_2_channel(fdt_type, fd);
1160 if (!ch)
1161 {
1162 return -RT_EIO;
1163 }
1164 _chfd_free(fd, fdt_type);
1165 if (vnode->ref_count == 1)
1166 {
1167 rt_free(vnode);
1168 return rt_raw_channel_close(ch);
1169 }
1170
1171 return 0;
1172}
1173
1174rt_err_t lwp_channel_send(int fdt_type, int fd, rt_channel_msg_t data)
1175{

Callers 2

rt_channel_closeFunction · 0.85
sys_channel_closeFunction · 0.85

Calls 5

lwp_fd_getFunction · 0.85
fd_2_channelFunction · 0.85
_chfd_freeFunction · 0.85
rt_freeFunction · 0.85
rt_raw_channel_closeFunction · 0.85

Tested by

no test coverage detected