summaryrefslogtreecommitdiff
path: root/components/libc/compilers
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2021-10-13 12:57:32 -0400
committerMeco Man <[email protected]>2021-10-13 15:29:01 -0400
commit8f6260146c8c157b02a263925239389260e958c0 (patch)
tree7640d7588d0cf75966d94e493e13b05c08c7ab1e /components/libc/compilers
parent0873b8163bf425fdbbf0f528c54382c7923f54f1 (diff)
[libc][win32] improve win32 support
Diffstat (limited to 'components/libc/compilers')
-rw-r--r--components/libc/compilers/common/nogcc/sys/select.h12
-rw-r--r--components/libc/compilers/common/sys/ioctl.h6
-rw-r--r--components/libc/compilers/gcc/newlib/stdio.c3
3 files changed, 16 insertions, 5 deletions
diff --git a/components/libc/compilers/common/nogcc/sys/select.h b/components/libc/compilers/common/nogcc/sys/select.h
index 575ad3a1b5..02fb77dd89 100644
--- a/components/libc/compilers/common/nogcc/sys/select.h
+++ b/components/libc/compilers/common/nogcc/sys/select.h
@@ -15,6 +15,10 @@
#include <sys/types.h>
#include <sys/time.h>
+#ifdef _WIN32
+#include <winsock.h>
+#endif
+
#ifndef FD_SETSIZE
#define FD_SETSIZE 32
#endif
@@ -26,16 +30,17 @@
#define FD_SETSIZE DFS_FD_MAX
#endif /* SAL_USING_POSIX */
-#define NBBY 8 /* number of bits in a byte */
-
typedef long fd_mask;
+#ifndef _WIN32
+#ifndef _SYS_TYPES_FD_SET /* MIPS */
+
+#define NBBY 8 /* number of bits in a byte */
#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */
#ifndef howmany
#define howmany(x,y) (((x)+((y)-1))/(y))
#endif
-#ifndef _SYS_TYPES_FD_SET /* MIPS */
typedef struct _types_fd_set {
fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
} _types_fd_set;
@@ -48,5 +53,6 @@ typedef struct _types_fd_set {
#endif /* _SYS_TYPES_FD_SET */
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
+#endif /* _WIN32 */
#endif /* __SYS_SELECT_H__ */
diff --git a/components/libc/compilers/common/sys/ioctl.h b/components/libc/compilers/common/sys/ioctl.h
index b926a71875..04f73837bc 100644
--- a/components/libc/compilers/common/sys/ioctl.h
+++ b/components/libc/compilers/common/sys/ioctl.h
@@ -15,6 +15,10 @@
#include <dfs_posix.h>
#endif
+#ifdef _WIN32
+#include <winsock.h>
+#endif
+
struct winsize {
unsigned short ws_row;
unsigned short ws_col;
@@ -35,8 +39,8 @@ struct winsize {
#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */
#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */
-#define FIONWRITE _IOR('f', 121, int) /* get # bytes outstanding in send queue */
#endif
+#define FIONWRITE _IOR('f', 121, int) /* get # bytes outstanding in send queue */
#define TCGETS 0x5401
#define TCSETS 0x5402
diff --git a/components/libc/compilers/gcc/newlib/stdio.c b/components/libc/compilers/gcc/newlib/stdio.c
index baccafad87..1875d50e3f 100644
--- a/components/libc/compilers/gcc/newlib/stdio.c
+++ b/components/libc/compilers/gcc/newlib/stdio.c
@@ -72,7 +72,8 @@ int libc_stdio_set_console(const char* device_name, int mode)
return -1;
}
-int libc_stdio_get_console(void) {
+int libc_stdio_get_console(void)
+{
if (std_console)
return fileno(std_console);
else