diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2007-02-07 20:22:40 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2007-02-07 20:22:40 +0300 |
commit | 59e3b6ca7dc10603d1e692928a236fe5a0523200 (patch) | |
tree | 17949dbe48d690e650c7b3cefa903f711e49477d /winsup/cygwin/mmap.cc | |
parent | 0e37a2e6e5f9bd3922f050da2a09b0e9d1dc5afd (diff) |
* cygmalloc.h (MALLOC_FAILURE_ACTION): Define empty.
* cygwin.din (posix_madvise): Export.
(posix_memalign): Export.
* fhandler.cc (fhandler_base::fpathconf): Return useful values in
_PC_VDISABLE, _PC_SYNC_IO and _PC_SYMLINK_MAX cases.
* malloc_wrapper.cc (malloc): Set errno here since it's not set in
dlmalloc.c anymore.
(realloc): Ditto.
(calloc): Ditto.
(memalign): Ditto.
(valloc): Ditto.
(posix_memalign): New function.
* mmap.cc (posix_madvise): New function.
* sysconf.cc (get_open_max): New function.
(get_page_size): Ditto.
(get_nproc_values): Ditto.
(get_avphys): Ditto.
(sc_type): New type.
(sca): New array to map _SC_xxx options to sysconf return values.
(sysconf): Reimplement using sca array.
* include/limits.h: Add all missing values as defined by SUSv3.
* include/pthread.h (PTHREAD_DESTRUCTOR_ITERATIONS): Move definition
to sys/limits.h.
(PTHREAD_KEYS_MAX): Ditto.
* include/semaphore.h (SEM_VALUE_MAX): Ditto.
* include/cygwin/stdlib.h (posix_memalign): Declare.
* include/cygwin/version.h: Bump API minor number.
* include/sys/mman.h: Add posix_madvise flags.
(posix_madvise): Declare.
* include/sys/termios.h (_POSIX_VDISABLE): Move definition to
sys/limits.h.
Diffstat (limited to 'winsup/cygwin/mmap.cc')
-rw-r--r-- | winsup/cygwin/mmap.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 3c1552f81..309620a90 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -1650,6 +1650,29 @@ munlock (const void *addr, size_t len) return ret; } +extern "C" int +posix_madvise (void *addr, size_t len, int advice) +{ + /* Check parameters. */ + if (advice < POSIX_MADV_NORMAL || advice > POSIX_MADV_DONTNEED + || !len) + return EINVAL; + + /* Check requested memory area. */ + MEMORY_BASIC_INFORMATION m; + char *p = (char *) addr; + char *endp = p + len; + while (p < endp) + { + if (!VirtualQuery (p, &m, sizeof m) || m.State == MEM_FREE) + return ENOMEM; + p = (char *) m.BaseAddress + m.RegionSize; + } + + /* Eventually do nothing. */ + return 0; +} + /* * Base implementation: * |