Skip to content

Commit cc04902

Browse files
cfriedtvaishnavachath
authored andcommitted
net: slnetsock: do not require posix to define SlNetSock_Timeval_t
Previously, the header `<ti/net/slnetsock.h>` was forward-declaring a typed struct when deprecated and nonexistent Kconfig options were not present. This caused a compile error when building `sample.net.sockets.http_get.offload.simplelink` because struct timeval was not defined in a non-standard header. Since the offload driver must exist whether or not the applciation has enabled POSIX, and struct timeval is POSIX, simply define the SlNetSock_Timeval_t typed structure whether or not POSIX is enabled using ANSI/ISO C types. In this case, `long` was chosen to match the wordsize of whatever architecture is being built. Signed-off-by: Chris Friedt <[email protected]>
1 parent d062844 commit cc04902

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

simplelink/source/ti/net/slnetsock.h

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,6 @@ interface. Some are mandatory, others are optional (but recommended).
191191
#define __SL_NET_SOCK_H__
192192

193193
#include <stdint.h>
194-
/*
195-
* Commented out to prevent zsock_timeval from being redefined
196-
* Can remove this if support for CONFIG_NET_SOCKETS_POSIX_NAMES
197-
* is dropped someday
198-
*/
199-
#if !(defined(CONFIG_NET_SOCKETS_POSIX_NAMES) || defined(CONFIG_POSIX_CLOCK) \
200-
|| defined(CONFIG_POSIX_API))
201-
#include <sys/time.h>
202-
#endif
203194

204195
#ifdef __cplusplus
205196
extern "C" {
@@ -646,7 +637,10 @@ typedef struct SlNetSock_linger_t
646637
to be equivalent to the POSIX-defined <tt>struct
647638
timeval</tt> data type.
648639
*/
649-
typedef struct timeval SlNetSock_Timeval_t;
640+
typedef struct {
641+
long tv_sec;
642+
long tv_usec;
643+
} SlNetSock_Timeval_t;
650644

651645
/*!
652646
\brief The SlNetSocklen_t is used for declaring the socket length parameter

0 commit comments

Comments
 (0)