Skip to content
Permalink
Browse files

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>
  • Loading branch information...
Nicolas Pitre authored and nashif committed Jul 3, 2019
1 parent 1b359e6 commit d19a5f911939c6ea4503485719c1ace816945b25
@@ -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;
@@ -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;
@@ -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;
@@ -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;

0 comments on commit d19a5f9

Please sign in to comment.
You can’t perform that action at this time.