blob: 5603708cc15b06a06e3c34175e84dd6d3ee114af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include "syslib.h"
#include <string.h>
/*
* Non-blocking variant of close(2). This call is to be used by system
* services that need to close arbitrary local file descriptors. The purpose
* of the call is to avoid that such services end up blocking on closing socket
* file descriptors with the SO_LINGER socket option enabled. They cannot put
* the file pointer in non-blocking mode to that end, because the file pointer
* may be shared with other processes.
*
* Even though this call is defined for system services only, there is no harm
* in letting arbitrary user processes use this functionality. Thus, it needs
* no separate VFS call number.
*/
int
closenb(int fd)
{
message m;
memset(&m, 0, sizeof(m));
m.m_lc_vfs_close.fd = fd;
m.m_lc_vfs_close.nblock = 1;
return _taskcall(VFS_PROC_NR, VFS_CLOSE, &m);
}
|