net: socket: mgmt: use uintptr_t for the nm_pid field

This may contain a pointer so make sure it is sufficiently wide
on 64-bit targets.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
Nicolas Pitre 2019-07-03 15:25:38 -04:00 committed by Anas Nashif
commit d19a5f9119
4 changed files with 5 additions and 5 deletions

View file

@ -52,7 +52,7 @@ extern "C" {
* When used with bind(), the nm_pid field of the sockaddr_nm can be
* filled with the calling thread' own id. The nm_pid serves here as the local
* address of this net_mgmt socket. The application is responsible for picking
* a unique 32-bit integer to fill in nm_pid.
* a unique integer value to fill in nm_pid.
*/
struct sockaddr_nm {
/** AF_NET_MGMT address family. */
@ -64,7 +64,7 @@ struct sockaddr_nm {
/** Thread id or similar that is used to separate the different
* sockets. Application can decide how the pid is constructed.
*/
u32_t nm_pid;
uintptr_t nm_pid;
/** net_mgmt mask */
u32_t nm_mask;

View file

@ -97,7 +97,7 @@ static void listener(void)
sockaddr.nm_family = AF_NET_MGMT;
sockaddr.nm_ifindex = 0; /* Any network interface */
sockaddr.nm_pid = (int)k_current_get();
sockaddr.nm_pid = (uintptr_t)k_current_get();
sockaddr.nm_mask = NET_EVENT_IPV6_DAD_SUCCEED |
NET_EVENT_IPV6_ADDR_ADD |
NET_EVENT_IPV6_ADDR_DEL;

View file

@ -28,7 +28,7 @@ struct net_mgmt_socket {
struct net_if *iface;
/* A way to separate different sockets that listen same events */
u32_t pid;
uintptr_t pid;
/* net_mgmt mask */
u32_t mask;

View file

@ -354,7 +354,7 @@ static void test_net_mgmt_setup(void)
sockaddr.nm_family = AF_NET_MGMT;
sockaddr.nm_ifindex = net_if_get_by_iface(net_if_get_default());
sockaddr.nm_pid = (int)k_current_get();
sockaddr.nm_pid = (uintptr_t)k_current_get();
sockaddr.nm_mask = NET_EVENT_IPV6_DAD_SUCCEED |
NET_EVENT_IPV6_ADDR_ADD |
NET_EVENT_IPV6_ADDR_DEL;