cygwin: export __getpagesize

The inclusion of <sys/cygwin.h> by <sys/shm.h>, besides causing namespace
pollution, also makes it very difficult to get the WINVER-dependent parts
of the former.  This affects code (such as x11vnc -unixpw_nis) which use
both SysV shared memory (e.g. the X11 MIT-SHM extension) and user password
authentication.

getpagesize is the simplest function to retreive this information, but it
is a legacy function and would also pollute the global namespace. The LSB
lists another form which is in the implementation-reserved namespace:

http://refspecs.linuxfoundation.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/baselib---getpagesize.html

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
This commit is contained in:
Yaakov Selkowitz 2016-03-28 12:48:20 -05:00 committed by Corinna Vinschen
parent ecf453f963
commit 660f84b15b
4 changed files with 10 additions and 3 deletions

View File

@ -60,6 +60,7 @@ __freading NOSIGFE
__fsetlocking SIGFE __fsetlocking SIGFE
__fwritable NOSIGFE __fwritable NOSIGFE
__fwriting NOSIGFE __fwriting NOSIGFE
__getpagesize = getpagesize SIGFE
__getreent NOSIGFE __getreent NOSIGFE
__gnu_basename NOSIGFE __gnu_basename NOSIGFE
__infinity NOSIGFE __infinity NOSIGFE

View File

@ -13,7 +13,6 @@ details. */
#define _CYGWIN_SHM_H #define _CYGWIN_SHM_H
#include <cygwin/ipc.h> #include <cygwin/ipc.h>
#include <sys/cygwin.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
@ -24,7 +23,9 @@ extern "C"
* *
* 64 Kb was hardcoded for x86. MS states this may change so the constant * 64 Kb was hardcoded for x86. MS states this may change so the constant
* expression is replaced by a function call returning the correct value. */ * expression is replaced by a function call returning the correct value. */
#define SHMLBA (cygwin_internal (CW_GET_SHMLBA)) #define SHMLBA (__getpagesize ())
/* internal alias of legacy getpagesize to avoid polluting global namespace */
int __getpagesize (void);
/* Shared memory operation flags: /* Shared memory operation flags:
*/ */

View File

@ -477,13 +477,14 @@ details. */
293: Convert utmpname/utmpxname to int. 293: Convert utmpname/utmpxname to int.
294: Export clog10, clog10f. 294: Export clog10, clog10f.
295: Export POSIX ACL functions. 295: Export POSIX ACL functions.
296: Export __getpagesize.
*/ */
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull, /* Note that we forgot to bump the api for ualarm, strtoll, strtoull,
sigaltstack, sethostname. */ sigaltstack, sethostname. */
#define CYGWIN_VERSION_API_MAJOR 0 #define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 295 #define CYGWIN_VERSION_API_MINOR 296
/* There is also a compatibity version number associated with the /* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible shared memory regions. It is incremented when incompatible

View File

@ -21,6 +21,10 @@ details. */
#include "sync.h" #include "sync.h"
#include "ntdll.h" #include "ntdll.h"
/* __getpagesize is only available from libcygwin.a */
#undef SHMLBA
#define SHMLBA (wincap.allocation_granularity ())
/* /*
* client_request_shm Constructors * client_request_shm Constructors
*/ */