Seperate usrsock device driver with usrsock core function layer
to make it more flexiable to adopt other kind of usrsock interface driver
Signed-off-by: liangchaozhong <liangchaozhong@xiaomi.com>
fix usrsock remote_disconnect fail:
nsh> usrsocktest
...
Testing group "remote_disconnect" =>
[TEST ASSERT FAILED!]
In function "receive":
line 497: Assertion `(ssize_t)((ret)) == (ssize_t)((0))' failed.
got value: -1
should be: 0
Group "remote_disconnect": [FAILED]
...
Reference:
RECV(2)
NAME
recv, recvfrom, recvmsg - receive a message from a socket
...
RETURN VALUE
...
When a stream socket peer has performed an orderly shutdown,
the return value will be 0 (the traditional "end-of-file" return).
Datagram sockets in various domains (e.g., the UNIX and Internet domains)
permit zero-length datagrams. When such a datagram is received, the return value is 0.
Signed-off-by: chao an <anchao@xiaomi.com>
Do not use 'pvconn' argument to get the connection pointer since
pvconn is normally NULL for some events like NETDEV_DOWN.
Instead, the connection pointer can be reliably obtained from the
corresponding private pointer.
Signed-off-by: chao.an <anchao@xiaomi.com>
In file included from usrsock/usrsock_bind.c:32:
usrsock/usrsock_bind.c: In function ‘usrsock_bind’:
usrsock/usrsock_bind.c:183:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
183 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_bind.c:183:54: note: format string is defined here
183 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ~^
| |
| int
| %ld
CC: usrsock/usrsock_connect.c
CC: usrsock/usrsock_dev.c
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c: In function ‘usrsockdev_handle_event’:
usrsock/usrsock_dev.c:488:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
488 | nwarn("message too short, %d < %d.\n", len, sizeof(*hdr));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| size_t {aka long unsigned int}
usrsock/usrsock_dev.c:488:40: note: format string is defined here
488 | nwarn("message too short, %d < %d.\n", len, sizeof(*hdr));
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c:488:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
488 | nwarn("message too short, %d < %d.\n", len, sizeof(*hdr));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
| |
| long unsigned int
usrsock/usrsock_dev.c:488:45: note: format string is defined here
488 | nwarn("message too short, %d < %d.\n", len, sizeof(*hdr));
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c: In function ‘usrsockdev_handle_datareq_response’:
usrsock/usrsock_dev.c:657:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
657 | nwarn("%dth buffer not large enough (need: %d, have: %d).\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
660 | conn->resp.datain.iov[iovpos].iov_len);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| size_t {aka long unsigned int}
usrsock/usrsock_dev.c:657:61: note: format string is defined here
657 | nwarn("%dth buffer not large enough (need: %d, have: %d).\n",
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c:678:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
678 | nwarn("%dth buffer not large enough "
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
682 | conn->resp.datain.iov[iovpos].iov_len);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| size_t {aka long unsigned int}
usrsock/usrsock_dev.c:679:45: note: format string is defined here
679 | "(need: %" PRId32 ", have: %d).\n",
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c: In function ‘usrsockdev_handle_req_response’:
usrsock/usrsock_dev.c:745:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
745 | nwarn("message too short, %d < %d.\n", len, hdrlen);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| size_t {aka long unsigned int}
usrsock/usrsock_dev.c:745:34: note: format string is defined here
745 | nwarn("message too short, %d < %d.\n", len, hdrlen);
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c: In function ‘usrsockdev_write’:
usrsock/usrsock_dev.c:858:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
858 | nwarn("message too short, %d < %d.\n", len,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| size_t {aka long unsigned int}
usrsock/usrsock_dev.c:858:38: note: format string is defined here
858 | nwarn("message too short, %d < %d.\n", len,
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_dev.c:37:
usrsock/usrsock_dev.c:858:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
858 | nwarn("message too short, %d < %d.\n", len,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
859 | sizeof(struct usrsock_message_common_s));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| long unsigned int
usrsock/usrsock_dev.c:858:43: note: format string is defined here
858 | nwarn("message too short, %d < %d.\n", len,
| ~^
| |
| int
| %ld
CC: usrsock/usrsock_getpeername.c
In file included from usrsock/usrsock_getpeername.c:32:
usrsock/usrsock_getpeername.c: In function ‘usrsock_getpeername’:
usrsock/usrsock_getpeername.c:190:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
190 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_getpeername.c:190:54: note: format string is defined here
190 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ~^
| |
| int
| %ld
CC: usrsock/usrsock_event.c
CC: usrsock/usrsock_getsockname.c
In file included from usrsock/usrsock_getsockname.c:32:
usrsock/usrsock_getsockname.c: In function ‘usrsock_getsockname’:
usrsock/usrsock_getsockname.c:190:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
190 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_getsockname.c:190:54: note: format string is defined here
190 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ~^
| |
| int
| %ld
CC: usrsock/usrsock_getsockopt.c
CC: usrsock/usrsock_poll.c
CC: usrsock/usrsock_recvmsg.c
In file included from usrsock/usrsock_recvmsg.c:32:
usrsock/usrsock_recvmsg.c: In function ‘usrsock_recvmsg’:
usrsock/usrsock_recvmsg.c:321:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
321 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_recvmsg.c:321:62: note: format string is defined here
321 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_recvmsg.c:32:
usrsock/usrsock_recvmsg.c:343:24: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
343 | nerr("net_timedwait errno: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_recvmsg.c:343:47: note: format string is defined here
343 | nerr("net_timedwait errno: %d\n", ret);
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_recvmsg.c:32:
usrsock/usrsock_recvmsg.c:384:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
384 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_recvmsg.c:384:58: note: format string is defined here
384 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ~^
| |
| int
| %ld
CC: usrsock/usrsock_sendmsg.c
In file included from usrsock/usrsock_sendmsg.c:32:
usrsock/usrsock_sendmsg.c: In function ‘usrsock_sendmsg’:
usrsock/usrsock_sendmsg.c:302:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
302 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_sendmsg.c:302:62: note: format string is defined here
302 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_sendmsg.c:32:
usrsock/usrsock_sendmsg.c:324:24: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
324 | nerr("net_timedwait errno: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_sendmsg.c:324:47: note: format string is defined here
324 | nerr("net_timedwait errno: %d\n", ret);
| ~^
| |
| int
| %ld
In file included from usrsock/usrsock_sendmsg.c:32:
usrsock/usrsock_sendmsg.c:364:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
364 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~
| |
| ssize_t {aka long int}
usrsock/usrsock_sendmsg.c:364:58: note: format string is defined here
364 | nwarn("usrsock_setup_request_callback failed: %d\n", ret);
| ~^
| |
| int
| %ld
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Gregory Nutt has submitted the SGA
Haltian Ltd has submitted the SGA
as a result we can migrate the licenses to Apache.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
Implement si_send/sendto/recvfrom with si_sendmsg/recvmsg, instead of
the other way round.
Change-Id: I7b858556996e0862df22807a6edf6d7cfe6518fc
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>