diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-11-01 09:45:49 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-11-01 15:54:13 +0300 |
commit | c02e802d37b52f7065b85776c583f93025055ab6 (patch) | |
tree | effb1ed4d2ab86c115abbeb55c97ef4d688014f0 /tools/setjmp_t.c | |
parent | c0ed749a4b3fa1f65e2c62da1ea896a5e8fe6958 (diff) | |
download | bdwgc-c02e802d37b52f7065b85776c583f93025055ab6.tar.gz |
Fix missing getpagesize() definition on OS/2 for usage by valloc()
(fix of commit d4c81638d)
Issue #495 (bdwgc).
* include/private/gcconfig.h [I386 && OS2] (GETPAGESIZE): Define to
os2_getpagesize.
* os_dep.c [OS2] (INCL_DOSERRORS): Reorder among INCL_x defines
lexicographically.
* tools/setjmp_t.c [OS2] (INCL_DOSERRORS): Likewise.
* os_dep.c [OS2] (INCL_DOSFILEMGR, INCL_DOSMISC): Define (before
include os2.h).
* os_dep.c [!MSWIN32 && !MSWINCE && !CYGWIN32 && OS2]
(os2_getpagesize): New static function (code copied mostly from
getpagesize() in setjmp_t.c).
* tools/setjmp_t.c [OS2]: Update comment and move close to
os2_getpagesize().
* tools/setjmp_t.c [OS2] (getpagesize): Make static and rename to
os2_getpagesize.
Diffstat (limited to 'tools/setjmp_t.c')
-rw-r--r-- | tools/setjmp_t.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/tools/setjmp_t.c b/tools/setjmp_t.c index d3b0f1bb..106b1450 100644 --- a/tools/setjmp_t.c +++ b/tools/setjmp_t.c @@ -21,21 +21,23 @@ /* has no callee-save registers, then the generic code is */ /* safe, but this will not be noticed by this piece of */ /* code.) This test appears to be far from perfect. */ + #include <stdio.h> #include <setjmp.h> #include <string.h> + #include "private/gc_priv.h" #ifdef OS2 -/* GETPAGESIZE() is set to getpagesize() by default, but that */ -/* doesn't really exist, and the collector doesn't need it. */ -#define INCL_DOSFILEMGR -#define INCL_DOSMISC -#define INCL_DOSERRORS -#include <os2.h> - -int getpagesize(void) -{ +# define INCL_DOSERRORS +# define INCL_DOSFILEMGR +# define INCL_DOSMISC +# include <os2.h> + + /* Similar to that in os_dep.c but use fprintf() to report a failure. */ + /* GETPAGESIZE() macro is defined to os2_getpagesize(). */ + static int os2_getpagesize(void) + { ULONG result[1]; if (DosQuerySysInfo(QSV_PAGE_SIZE, QSV_PAGE_SIZE, @@ -44,7 +46,7 @@ int getpagesize(void) result[0] = 4096; } return (int)result[0]; -} + } #elif defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32) static int win32_getpagesize(void) |