From b31125fb39e58859e1ac6e028df0725d8c6658ee Mon Sep 17 00:00:00 2001 From: no92 Date: Mon, 29 Jan 2024 00:56:11 +0100 Subject: [PATCH 1/4] options/posix: fix wrong ABI in for `RTLD_*` defines --- options/posix/include/dlfcn.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/options/posix/include/dlfcn.h b/options/posix/include/dlfcn.h index 3bb8a027e2..bef80ac664 100644 --- a/options/posix/include/dlfcn.h +++ b/options/posix/include/dlfcn.h @@ -3,12 +3,12 @@ #define _DLFCN_H #define RTLD_LOCAL 0 -#define RTLD_NOW 1 -#define RTLD_GLOBAL 2 +#define RTLD_LAZY 1 +#define RTLD_NOW 2 #define RTLD_NOLOAD 4 -#define RTLD_NODELETE 8 -#define RTLD_DEEPBIND 16 -#define RTLD_LAZY 32 +#define RTLD_DEEPBIND 8 +#define RTLD_GLOBAL 256 +#define RTLD_NODELETE 4096 #define RTLD_NEXT ((void *)-1) #define RTLD_DEFAULT ((void *)0) From 925c364273c2d44d5a5aedeb9ae0e4822c5f01b4 Mon Sep 17 00:00:00 2001 From: no92 Date: Wed, 7 Feb 2024 22:18:29 +0100 Subject: [PATCH 2/4] options/posix: fix typo in glob.h --- options/posix/include/glob.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/posix/include/glob.h b/options/posix/include/glob.h index 2bf9e480ae..78296ffa13 100644 --- a/options/posix/include/glob.h +++ b/options/posix/include/glob.h @@ -44,7 +44,7 @@ typedef struct glob_t { #ifndef __MLIBC_ABI_ONLY -int glob(const char *__restirct, int, int(*)(const char *, int), struct glob_t *__restrict); +int glob(const char *__restrict, int, int(*)(const char *, int), struct glob_t *__restrict); void globfree(struct glob_t *); #endif /* !__MLIBC_ABI_ONLY */ From 9664806f65e1290f296d79294e0df48f7d95d4fa Mon Sep 17 00:00:00 2001 From: no92 Date: Wed, 7 Feb 2024 22:20:04 +0100 Subject: [PATCH 3/4] options/ansi: fix fgets argument type --- options/ansi/include/stdio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/ansi/include/stdio.h b/options/ansi/include/stdio.h index 168a3c77e9..8938e6fe28 100644 --- a/options/ansi/include/stdio.h +++ b/options/ansi/include/stdio.h @@ -151,7 +151,7 @@ int vasprintf(char **, const char *, __builtin_va_list); // [C11-7.21.7] Character input/output functions int fgetc(FILE *stream); -char *fgets(char *__restrict buffer, size_t max_size, FILE *__restrict stream); +char *fgets(char *__restrict buffer, int max_size, FILE *__restrict stream); int fputc(int c, FILE *stream); int fputs(const char *__restrict string, FILE *__restrict stream); char *gets(char *s); From 201531185c31a81a00e4e7e8c3120c4c9bdadcef Mon Sep 17 00:00:00 2001 From: no92 Date: Wed, 7 Feb 2024 22:24:31 +0100 Subject: [PATCH 4/4] options/posix: make sure ioctl numbers are of `unsigned long` type The `request` argument in `ioctl` is defined to be `unsigned long`, which leads to warnings when generating rust bindings as we can't figure out the intended type from the lexed macro tokens. To avoid this confusion, this commit manually specifies the type to be extra clear. --- options/posix/include/termios.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/options/posix/include/termios.h b/options/posix/include/termios.h index a5a6a2feeb..6d3b4053c4 100644 --- a/options/posix/include/termios.h +++ b/options/posix/include/termios.h @@ -86,11 +86,11 @@ int tcsetattr(int, int, const struct termios *); // This is a linux extension -#define TIOCGPGRP 0x540F -#define TIOCSPGRP 0x5410 -#define TIOCGWINSZ 0x5413 -#define TIOCSWINSZ 0x5414 -#define TIOCGSID 0x5429 +#define TIOCGPGRP 0x540FUL +#define TIOCSPGRP 0x5410UL +#define TIOCGWINSZ 0x5413UL +#define TIOCSWINSZ 0x5414UL +#define TIOCGSID 0x5429UL #ifdef __cplusplus }