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 /os_dep.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 'os_dep.c')
-rw-r--r-- | os_dep.c | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -689,11 +689,13 @@ struct o32_obj { # endif /* __IBMC__ */ -# define INCL_DOSEXCEPTIONS -# define INCL_DOSPROCESS # define INCL_DOSERRORS -# define INCL_DOSMODULEMGR +# define INCL_DOSEXCEPTIONS +# define INCL_DOSFILEMGR # define INCL_DOSMEMMGR +# define INCL_DOSMISC +# define INCL_DOSMODULEMGR +# define INCL_DOSPROCESS # include <os2.h> # endif /* OS/2 */ @@ -819,6 +821,21 @@ GC_INNER size_t GC_page_size = 0; # define HAVE_GET_STACK_BASE #else /* !MSWIN32 */ + +# ifdef OS2 + static int os2_getpagesize(void) + { + ULONG result[1]; + + if (DosQuerySysInfo(QSV_PAGE_SIZE, QSV_PAGE_SIZE, + (void *)result, sizeof(ULONG)) != NO_ERROR) { + WARN("DosQuerySysInfo failed\n", 0); + result[0] = 4096; + } + return (int)result[0]; + } +# endif /* OS2 */ + GC_INNER void GC_setpagesize(void) { # ifdef ALT_PAGESIZE_USED |