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>
In case of enabled packet forwarding mode, packets were forwarded in a reverse order
because of LIFO behavior of the connection event list.
The issue exposed only during high network traffic. Thus the event list started to grow
that resulted in changing the order of packets inside of groups of several packets
like the following: 3, 2, 1, 6, 5, 4, 8, 7 etc.
Remarks concerning the connection event list implementation:
* Now the queue (list) is FIFO as it should be.
* The list is singly linked.
* The list has a head pointer (inside of outer net_driver_s structure),
and a tail pointer is added into outer net_driver_s structure.
* The list item is devif_callback_s structure.
It still has two pointers to two different list chains (*nxtconn and *nxtdev).
* As before the first argument (*dev) of the list functions can be NULL,
while the other argument (*list) is effective (not NULL).
* An extra (*tail) argument is added to devif_callback_alloc()
and devif_conn_callback_free() functions.
* devif_callback_alloc() time complexity is O(1) (i.e. O(n) to fill the whole list).
* devif_callback_free() time complexity is O(n) (i.e. O(n^2) to empty the whole list).
* devif_conn_event() time complexity is O(n).
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>
Add flags argument into sendto() and recvfrom() APIs for MSG_* flags can
handling in the daemon.
However, MSG_DONTWAIT should process in usrsock, so it unnecessary to pass to
the daemon like O_NONBLOCK.
Resolution of Issue 619 will require multiple steps, this part of the first step in that resolution: Every call to nxsem_wait_uninterruptible() must handle the return value from nxsem_wait_uninterruptible properly. This commit is only for those files under graphics/, mm/, net/, sched/, wireless/bluetooth.
Still to do: Files under fs/, drivers/, and arch. The last is 116 files and will take some effort.
since usrsock_conn_s::resp::result contain more detailed info and fix the below error in usrsocktest:
Testing group "WakeWithSignal" =>
[TEST ASSERT FAILED!]
In function "do_usrsock_blocking_connect_thread":
line 200: Assertion `(ssize_t)((*get_errno_ptr())) == (ssize_t)((test_abort ? 113 : 4))' failed.
got value: 110
should be: 113
[TEST ASSERT FAILED!]
In function "do_usrsock_blocking_connect_thread":
line 200: Assertion `(ssize_t)((*get_errno_ptr())) == (ssize_t)((test_abort ? 113 : 4))' failed.
got value: 110
should be: 113
[TEST ASSERT FAILED!]
In function "do_usrsock_blocking_connect_thread":
line 200: Assertion `(ssize_t)((*get_errno_ptr())) == (ssize_t)((test_abort ? 113 : 4))' failed.
got value: 110
should be: 113
[TEST ASSERT FAILED!]
In function "do_wake_test":
line 567: Assertion `(bool)((usrsocktest_test_failed)) == (bool)(false)' failed.
got value: 1
should be: 0
Group "WakeWithSignal": [FAILED]
MSG_DONTWAIT (since Linux 2.2)
Enables nonblocking operation; if the operation would block, the
call fails with the error EAGAIN or EWOULDBLOCK. This provides
similar behavior to setting the O_NONBLOCK flag (via the fcntl(2)
F_SETFL operation), but differs in that MSG_DONTWAIT is a per-call
option, whereas O_NONBLOCK is a setting on the open file description
(see open(2)), which will affect all threads in the calling process
and as well as other processes that hold file descriptors referring
to the same open file description.
1.Consolidate absolute to relative timeout conversion into one place(_net_timedwait)
2.Drive the wait timeout logic by net_timedwait instead of devif_timer
This patch help us remove devif_timer(period tick) to save the power in the future.
Change-Id: I534748a5d767ca6da8a7843c3c2f993ed9ea77d4
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
* Simplify EINTR/ECANCEL error handling
1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx
* Unify the void cast usage
1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
Author: Gregory Nutt <gnutt@nuttx.org>
Run all .h and .c files modified in last PR through nxstyle.
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Net cleanup (#17)
* Fix the semaphore usage issue found in tcp/udp
1. The count semaphore need disable priority inheritance
2. Loop again if net_lockedwait return -EINTR
3. Call nxsem_trywait to avoid the race condition
4. Call nxsem_post instead of sem_post
* Put the work notifier into free list to avoid the heap fragment in the long run. Since the allocation strategy is encapsulated internally, we can even refine the implementation later.
* Network stack shouldn't allocate memory in the poll implementation to avoid the heap fragment in the long run, other modification include:
1. Select MM_IOB automatically since ICMP[v6] socket can't work without the read ahead buffer
2. Remove the net lock since xxx_callback_free already do the same thing
3. TCP/UDP poll should work even the read ahead buffer isn't enabled at all
* Add NET_ prefix for UDP_NOTIFIER and TCP_NOTIFIER option to align with other UDP/TCP option convention
* Remove the unused _SF_[IDLE|ACCEPT|SEND|RECV|MASK] flags since there are code to set/clear these flags, but nobody check them.
net/usrsock: Fix debug logs and remove DEBUGASSERT from usrsockdev_do_request()
In a client mode, socket() will be the first request for usrsockdev_do_request().
However, in a server mode, the first request to accepted sockets will be recv()
or others which depend on applications. So I think we should remove this
DEBUGASSERT from usrsockdev_do_request().
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Approved-by: Gregory Nutt <gnutt@nuttx.org>
arch/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled.
sched/ audio/ crypto/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled.
Documentation/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled.
fs/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled.
graphics/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled.
net/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled.
drivers/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled.
include/, syscall/, wireless/: Removed all references to CONFIG_DISABLE_POLL. The standard POSIX poll() can not longer be disabled.
configs/: Remove all references to CONFIG_DISABLE_POLL. Standard POSIX poll can no longer be disabled.