Error: route/net_del_ramroute.c:94:9: error: format specifies type 'unsigned long' but the argument has type 'unsigned int' [-Werror,-Wformat]
HTONL(match->target), HTONL(match->netmask));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/github/workspace/sources/nuttx/include/debug.h:232:23: note: expanded from macro 'ninfo'
^
/github/workspace/sources/nuttx/include/debug.h:102:43: note: expanded from macro '_none'
do { if (0) syslog(LOG_ERR, format, ##__VA_ARGS__); } while (0)
~~~~~~ ^~~~~~~~~~~
/github/workspace/sources/nuttx/include/netinet/in.h:233:17: note: expanded from macro 'HTONL'
^
/github/workspace/sources/nuttx/include/endian.h:63:25: note: expanded from macro '__swap_uint32'
^
Error: route/net_del_ramroute.c:94:31: error: format specifies type 'unsigned long' but the argument has type 'unsigned int' [-Werror,-Wformat]
HTONL(match->target), HTONL(match->netmask));
~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/github/workspace/sources/nuttx/include/debug.h:232:23: note: expanded from macro 'ninfo'
^
/github/workspace/sources/nuttx/include/debug.h:102:43: note: expanded from macro '_none'
do { if (0) syslog(LOG_ERR, format, ##__VA_ARGS__); } while (0)
~~~~~~ ^~~~~~~~~~~
/github/workspace/sources/nuttx/include/netinet/in.h:233:17: note: expanded from macro 'HTONL'
^
/github/workspace/sources/nuttx/include/endian.h:63:25: note: expanded from macro '__swap_uint32'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
In file included from route/net_del_ramroute.c:30:
route/net_del_ramroute.c: In function ‘net_match_ipv4’:
route/net_del_ramroute.c:93:9: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘unsigned int’ [-Wformat=]
93 | ninfo(" target=%08lx netmask=%08lx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
route/net_del_ramroute.c:93:23: note: format string is defined here
93 | ninfo(" target=%08lx netmask=%08lx\n",
| ~~~~^
| |
| long unsigned int
| %08x
mld/mld_timer.c: In function ‘mld_gendog_work’:
mld/mld_timer.c:118:13: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
118 | ifindex = (int)arg;
| ^
mld/mld_timer.c: In function ‘mld_v1dog_work’:
mld/mld_timer.c:237:13: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
237 | ifindex = (int)arg;
| ^
Signed-off-by: chao an <anchao@xiaomi.com>
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.
* 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
many locations: Change occurences of open() followed by file_detach() to file_open(). Change most non-controversion calls to open() to nx_open().
fs/inode/fs_fileopen.c: Flesh out file_open() with some interim, placeholder logic.
fs/inode/fs_fileopen.c: Add a framework for a file_open() implementation (no real logic in place yet).
fs/vfs/fs_open.c: Add nx_open() which is the same as open() except that it does not create a cancellation point nor does it modify the errno variable.
binfmt/, configs/, grahics/, libc/, mm/, net/, sched/: OS references to the errno variable should always use the set_errno(), get_errno() macros
arch/arm/src/stm32 and stm32f7: Architecture-specific code is not permitted to modify the errno variable. drivers/ and libc/: OS references to the errno variable should always use the set_errno(), get_errno() macros
fs: Add truncate() support for userfs
fs/unionfs: Add truncate() support to the unionfs
fs/tmpfs: Add ftruncate() support to tmpfs
syscall/: Add system call support for ftruncate()
net/route: Adding ftruncate() support eliminates an issue in file-based routing table management.
fs: Add basic framework to support truncate() and ftruncate(). The infrastructure is complete. Now, however, the actual implementation of ftruncate() will have to be done for each file system.
This commit backs out most of commit b4747286b1. That change was added because sem_wait() would sometimes cause cancellation points inappropriated. But with these recent changes, nxsem_wait() is used instead and it is not a cancellation point.
In the OS, all calls to sem_wait() changed to nxsem_wait(). nxsem_wait() does not return errors via errno so each place where nxsem_wait() is now called must not examine the errno variable.
In all OS functions (not libraries), change sem_wait() to nxsem_wait(). This will prevent the OS from creating bogus cancellation points and from modifying the per-task errno variable.
sched/semaphore: Add the function nxsem_wait(). This is a new internal OS interface. It is functionally equivalent to sem_wait() except that (1) it is not a cancellation point, and (2) it does not set the per-thread errno value on return.
sched/semaphore: Add nxsem_post() which is identical to sem_post() except that it never modifies the errno variable. Changed all references to sem_post in the OS to nxsem_post().
sched/semaphore: Add nxsem_destroy() which is identical to sem_destroy() except that it never modifies the errno variable. Changed all references to sem_destroy() in the OS to nxsem_destroy().
libc/semaphore and sched/semaphore: Add nxsem_getprotocol() and nxsem_setprotocola which are identical to sem_getprotocol() and set_setprotocol() except that they never modifies the errno variable. Changed all references to sem_setprotocol in the OS to nxsem_setprotocol(). sem_getprotocol() was not used in the OS
libc/semaphore: Add nxsem_getvalue() which is identical to sem_getvalue() except that it never modifies the errno variable. Changed all references to sem_getvalue in the OS to nxsem_getvalue().
sched/semaphore: Rename all internal private functions from sem_xyz to nxsem_xyz. The sem_ prefix is (will be) reserved only for the application semaphore interfaces.
libc/semaphore: Add nxsem_init() which is identical to sem_init() except that it never modifies the errno variable. Changed all references to sem_init in the OS to nxsem_init().
sched/semaphore: Rename sem_tickwait() to nxsem_tickwait() so that it is clear this is an internal OS function.
sched/semaphoate: Rename sem_reset() to nxsem_reset() so that it is clear this is an internal OS function.
Squashed commit of the following:
net/route: Flush in cache when any entry is deleted from the routing table. When a router matching an IP address is found, add the routing table entry to the cache.
net/route: Add utility functions to manage an in-memory cache to improve performance when use a file-based routing table.
There are two issues with it however:
1. Reading from file system on a per packet basis could be slow. I think it probably should have a small, in-memory cache of most frequently used routes for good problem.
2. Currently the delroute logic is disabled due to a problem with the design. NuttX does not currently support truncate(). Therefore, it is not possible to delete entries from the routing table file.
In this current implementation, that leaves the last entry intact at the end of the file. An alternative design might include a tag on each record to indicate if the record is valid or not. That would work but would add complexity to the other routing table functions.
The existing implementation is available for testing purposes only if CONFIG_EXPERIMENTAL=y.
Squashed commit of the following:
net/route: The current delroute design depends on file truncation. However, NuttX does not currently support truncate. Alternative, more complex designs are possible but not implemented. At present the file routing table are otherwise functional but the delroute logic is disabled via CONFIG_EXPERIMENTAL. Enable it only if you plan to fix it.
net/route: Fix some issues with locking routing table files.
net/route: Add partial implementation of delroute for the case where the routing table is in a file.
net/route: Add support for seeking to positions in the routing table.
net/route: Add net_addroute_ipv4/6() using a file-based routing table.
net/route: Add net_foreach_ipv4/4() using a file-based routing table.
net/route: Initial build, configuration, and fs utilies to support routing tables in a file.
This would be particularly useful, for example, in the case where there is only a single network adaptor and you want all output packets to go to the single adaptor in all cases. So for that behavior you could add a read-only routing table to the board-specific long that contains a single entry, the default route: 0.0.0.0/0.
Squashed commit of the following:
net/route: RAM and ROM routing tables build correctly in all IPv4 and IPv6 configurations.
net/route: Verify IPv6 ROM route build; Make number of ROM routes a variable, not a configuration item.
net/route: Add initial support for ROM-base, read-only routing tables.
net/route: Adjust and generalize some structures, rename some functions, and add configuration and build support that will eventually support read-only routing tables.
net/route: Some initial though experiments on use of a fixe, read-only routing table