Skip to content

Commit c546c1c

Browse files
jukkarhenrikbrixandersen
authored andcommitted
net: socket: Change socklen_t to be 4 bytes long
There is an issue when zephyr is compiled with native_sim_64 where size_t is 8 bytes. The socklen_t in specified as 4 bytes in Linux even for 64 bit builds so we have a conflict between Linux and Zephyr. To make things work properly, define socklen_t as uint32_t in order to align with Linux. Four bytes is enough for socket address length anyway. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent b28b570 commit c546c1c

File tree

6 files changed

+75
-72
lines changed

6 files changed

+75
-72
lines changed

include/zephyr/net/net_context.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,7 @@ enum net_context_option {
14191419
*/
14201420
int net_context_set_option(struct net_context *context,
14211421
enum net_context_option option,
1422-
const void *value, size_t len);
1422+
const void *value, uint32_t len);
14231423

14241424
/**
14251425
* @brief Get connection option value for this context.
@@ -1433,7 +1433,7 @@ int net_context_set_option(struct net_context *context,
14331433
*/
14341434
int net_context_get_option(struct net_context *context,
14351435
enum net_context_option option,
1436-
void *value, size_t *len);
1436+
void *value, uint32_t *len);
14371437

14381438
/**
14391439
* @typedef net_context_cb_t

include/zephyr/net/net_ip.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ typedef unsigned short int sa_family_t;
169169

170170
/** Length of a socket address */
171171
#ifndef __socklen_t_defined
172-
typedef size_t socklen_t;
172+
typedef uint32_t socklen_t;
173173
#define __socklen_t_defined
174174
#endif
175175

0 commit comments

Comments
 (0)