net/socket: add SOCK_CLOEXEC/SOCK_NONBLOCK support

Reference here:
https://github.com/torvalds/linux/blob/master/include/linux/net.h

Change-Id: I9fd0170bcd1ae7e778e951d454ada76f63854de5
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an
2020-08-13 15:30:54 +08:00
committed by Xiang Xiao
parent 07ce0deda0
commit e5f6dafe1f
2 changed files with 42 additions and 20 deletions
+13 -1
View File
@@ -86,12 +86,24 @@ int psock_socket(int domain, int type, int protocol,
psock->s_crefs = 1;
psock->s_domain = domain;
psock->s_type = type;
psock->s_conn = NULL;
#if defined(CONFIG_NET_TCP_WRITE_BUFFERS) || defined(CONFIG_NET_UDP_WRITE_BUFFERS)
psock->s_sndcb = NULL;
#endif
if (type & SOCK_CLOEXEC)
{
psock->s_flags |= _SF_CLOEXEC;
}
if (type & SOCK_NONBLOCK)
{
psock->s_flags |= _SF_NONBLOCK;
}
type &= SOCK_TYPE_MASK;
psock->s_type = type;
#ifdef CONFIG_NET_USRSOCK
if (domain != PF_LOCAL && domain != PF_UNSPEC)
{