diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 6e3806545..a27b21573 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +2003-11-06 Corinna Vinschen + + * syscalls.cc (getshmlba): New function. + * external.cc (cygwin_internal): Add CW_GET_SHMLBA handling. + * mmap.cc (mmap64): Call getshmlba to evaluate granularity. + * winsup.h (getshmlba): Add declaration. + * include/cygwin/version.h: Bump API minor number. + * include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GET_SHMLBA. + 2003-11-06 Christopher Faylor * winsup.h: Declare access_worker. diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc index 839d38050..8ab0c82d0 100644 --- a/winsup/cygwin/external.cc +++ b/winsup/cygwin/external.cc @@ -274,6 +274,10 @@ cygwin_internal (cygwin_getinfo_types t, ...) set_security_attribute (attribute, psa, sd_buf, sd_buf_size); return psa->lpSecurityDescriptor ? 0 : -1; } + case CW_GET_SHMLBA: + { + return getshmlba (); + } default: return (DWORD) -1; } diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 57ade5d66..d26ec4bc8 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -224,13 +224,14 @@ details. */ 97: Export sem_open, sem_close, sem_timedwait, sem_getvalue. 98: Export _tmpfile64. 99: CW_GET_POSIX_SECURITY_ATTRIBUTE addition to external.cc. + 100: CW_GET_SHMLBA addition to external.cc. */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 99 +#define CYGWIN_VERSION_API_MINOR 100 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h index 4aec8c358..6db5bb936 100644 --- a/winsup/cygwin/include/sys/cygwin.h +++ b/winsup/cygwin/include/sys/cygwin.h @@ -74,7 +74,8 @@ typedef enum CW_CMDLINE, CW_CHECK_NTSEC, CW_GET_ERRNO_FROM_WINERROR, - CW_GET_POSIX_SECURITY_ATTRIBUTE + CW_GET_POSIX_SECURITY_ATTRIBUTE, + CW_GET_SHMLBA } cygwin_getinfo_types; #define CW_NEXTPID 0x80000000 /* or with pid to get next one */ diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 79014310e..c572b082d 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -455,13 +455,7 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off) syscall_printf ("addr %x, len %u, prot %x, flags %x, fd %d, off %D", addr, len, prot, flags, fd, off); - static DWORD granularity; - if (!granularity) - { - SYSTEM_INFO si; - GetSystemInfo (&si); - granularity = si.dwAllocationGranularity; - } + static DWORD granularity = getshmlba (); /* Error conditions according to SUSv2 */ if (off % getpagesize () diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 0940ad028..2bda5ddd7 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1529,6 +1529,14 @@ getpagesize () return (int) system_info.dwPageSize; } +size_t +getshmlba () +{ + if (!system_info.dwAllocationGranularity) + GetSystemInfo (&system_info); + return system_info.dwAllocationGranularity; +} + static int check_posix_perm (const char *fname, int v) { diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index f0d534d26..c827ad8c7 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -282,6 +282,8 @@ int access_worker (path_conv&, int) __attribute__ ((regparm (2))); extern "C" int low_priority_sleep (DWORD) __attribute__ ((regparm (1))); #define SLEEP_0_STAY_LOW INFINITE +size_t getshmlba (void); + /**************************** Exports ******************************/ extern "C" {