* 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.
This commit is contained in:
parent
0e37a2e6e5
commit
59e3b6ca7d
|
@ -1,3 +1,37 @@
|
||||||
|
2007-02-07 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2007-02-05 Corinna Vinschen <corinna@vinschen.de>
|
2007-02-05 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* fhandler_serial.cc (fhandler_serial::tcsetattr): Add support for
|
* fhandler_serial.cc (fhandler_serial::tcsetattr): Add support for
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* cygmalloc.h: cygwin DLL malloc stuff
|
/* cygmalloc.h: cygwin DLL malloc stuff
|
||||||
|
|
||||||
Copyright 2002, 2003, 2004, 2005 Red Hat, Inc.
|
Copyright 2002, 2003, 2004, 2005, 2007 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ void dlmalloc_stats ();
|
||||||
#ifndef __INSIDE_CYGWIN__
|
#ifndef __INSIDE_CYGWIN__
|
||||||
# define USE_DL_PREFIX 1
|
# define USE_DL_PREFIX 1
|
||||||
#else
|
#else
|
||||||
|
#define MALLOC_FAILURE_ACTION
|
||||||
# define __malloc_lock() mallock.acquire ()
|
# define __malloc_lock() mallock.acquire ()
|
||||||
# define __malloc_unlock() mallock.release ()
|
# define __malloc_unlock() mallock.release ()
|
||||||
extern muto mallock;
|
extern muto mallock;
|
||||||
|
|
|
@ -988,6 +988,8 @@ popen SIGFE
|
||||||
_popen = popen SIGFE
|
_popen = popen SIGFE
|
||||||
posix_fadvise SIGFE
|
posix_fadvise SIGFE
|
||||||
posix_fallocate SIGFE
|
posix_fallocate SIGFE
|
||||||
|
posix_madvise SIGFE
|
||||||
|
posix_memalign SIGFE
|
||||||
posix_openpt SIGFE
|
posix_openpt SIGFE
|
||||||
posix_regcomp SIGFE
|
posix_regcomp SIGFE
|
||||||
posix_regerror SIGFE
|
posix_regerror SIGFE
|
||||||
|
|
|
@ -1852,19 +1852,21 @@ fhandler_base::fpathconf (int v)
|
||||||
case _PC_NO_TRUNC:
|
case _PC_NO_TRUNC:
|
||||||
return 1;
|
return 1;
|
||||||
case _PC_VDISABLE:
|
case _PC_VDISABLE:
|
||||||
if (!is_tty ())
|
if (is_tty ())
|
||||||
set_errno (EINVAL);
|
return _POSIX_VDISABLE;
|
||||||
|
set_errno (EINVAL);
|
||||||
break;
|
break;
|
||||||
case _PC_ASYNC_IO:
|
case _PC_ASYNC_IO:
|
||||||
case _PC_PRIO_IO:
|
case _PC_PRIO_IO:
|
||||||
case _PC_SYNC_IO:
|
|
||||||
break;
|
break;
|
||||||
|
case _PC_SYNC_IO:
|
||||||
|
return 1;
|
||||||
case _PC_FILESIZEBITS:
|
case _PC_FILESIZEBITS:
|
||||||
return FILESIZEBITS;
|
return FILESIZEBITS;
|
||||||
case _PC_2_SYMLINKS:
|
case _PC_2_SYMLINKS:
|
||||||
return 1;
|
return 1;
|
||||||
case _PC_SYMLINK_MAX:
|
case _PC_SYMLINK_MAX:
|
||||||
break;
|
return SYMLINK_MAX;
|
||||||
case _PC_POSIX_PERMISSIONS:
|
case _PC_POSIX_PERMISSIONS:
|
||||||
case _PC_POSIX_SECURITY:
|
case _PC_POSIX_SECURITY:
|
||||||
if (get_device () == FH_FS)
|
if (get_device () == FH_FS)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* stdlib.h
|
/* stdlib.h
|
||||||
|
|
||||||
Copyright 2005, 2006 Red Hat Inc.
|
Copyright 2005, 2006, 2007 Red Hat Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ int unlockpt (int);
|
||||||
#endif /*__STRICT_ANSI__*/
|
#endif /*__STRICT_ANSI__*/
|
||||||
|
|
||||||
int posix_openpt (int);
|
int posix_openpt (int);
|
||||||
|
int posix_memalign (void **, size_t, size_t);
|
||||||
|
|
||||||
#ifdef _COMPILING_NEWLIB
|
#ifdef _COMPILING_NEWLIB
|
||||||
#define unsetenv UNUSED_unsetenv
|
#define unsetenv UNUSED_unsetenv
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* version.h -- Cygwin version numbers and accompanying documentation.
|
/* version.h -- Cygwin version numbers and accompanying documentation.
|
||||||
|
|
||||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||||
2005, 2006 Red Hat, Inc.
|
2005, 2006, 2007 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -301,12 +301,13 @@ details. */
|
||||||
161: Export resolver functions.
|
161: Export resolver functions.
|
||||||
162: New struct ifreq. Export if_nametoindex, if_indextoname,
|
162: New struct ifreq. Export if_nametoindex, if_indextoname,
|
||||||
if_nameindex, if_freenameindex.
|
if_nameindex, if_freenameindex.
|
||||||
|
163: Export posix_madvise, posix_memalign.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
|
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
|
||||||
|
|
||||||
#define CYGWIN_VERSION_API_MAJOR 0
|
#define CYGWIN_VERSION_API_MAJOR 0
|
||||||
#define CYGWIN_VERSION_API_MINOR 162
|
#define CYGWIN_VERSION_API_MINOR 163
|
||||||
|
|
||||||
/* 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
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* limits.h
|
/* limits.h
|
||||||
|
|
||||||
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
|
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -127,16 +127,46 @@ details. */
|
||||||
|
|
||||||
/* Runtime Invariant Values */
|
/* Runtime Invariant Values */
|
||||||
|
|
||||||
|
/* Please note that symbolic names shall be ommited, on specific
|
||||||
|
implementations where the corresponding value is equal to or greater
|
||||||
|
than the stated minimum, but is unspecified. This indetermination
|
||||||
|
might depend on the amount of available memory space on a specific
|
||||||
|
instance of a specific implementation. The actual value supported by
|
||||||
|
a specific instance shall be provided by the sysconf() function. */
|
||||||
|
|
||||||
|
/* Maximum number of I/O operations in a single list I/O call supported by
|
||||||
|
the implementation. Not yet implemented. */
|
||||||
|
#undef AIO_LISTIO_MAX
|
||||||
|
/* #define AIO_LISTIO_MAX >= _POSIX_AIO_LISTIO_MAX */
|
||||||
|
|
||||||
|
/* Maximum number of outstanding asynchronous I/O operations supported by
|
||||||
|
the implementation. Not yet implemented. */
|
||||||
|
#undef AIO_MAX
|
||||||
|
/* #define AIO_MAX >= _POSIX_AIO_MAX */
|
||||||
|
|
||||||
|
/* The maximum amount by which a process can decrease its asynchronous I/O
|
||||||
|
priority level from its own scheduling priority. */
|
||||||
|
#undef AIO_PRIO_DELTA_MAX
|
||||||
|
/* #define AIO_PRIO_DELTA_MAX >= 0 */
|
||||||
|
|
||||||
/* Maximum number of bytes in arguments and environment passed in an exec
|
/* Maximum number of bytes in arguments and environment passed in an exec
|
||||||
call. 32000 is the safe value used for Windows processes when called
|
call. 32000 is the safe value used for Windows processes when called
|
||||||
from Cygwin processes. */
|
from Cygwin processes. */
|
||||||
#undef ARG_MAX
|
#undef ARG_MAX
|
||||||
#define ARG_MAX 32000
|
#define ARG_MAX 32000
|
||||||
|
|
||||||
|
/* Maximum number of functions that may be registered with atexit(). */
|
||||||
|
#undef ATEXIT_MAX
|
||||||
|
#define ATEXIT_MAX 32
|
||||||
|
|
||||||
/* Maximum number of simultaneous processes per real user ID. */
|
/* Maximum number of simultaneous processes per real user ID. */
|
||||||
#undef CHILD_MAX
|
#undef CHILD_MAX
|
||||||
#define CHILD_MAX 256
|
#define CHILD_MAX 256
|
||||||
|
|
||||||
|
/* Maximum number of timer expiration overruns. Not yet implemented. */
|
||||||
|
#undef DELAYTIMER_MAX
|
||||||
|
/* #define DELAYTIMER_MAX >= _POSIX_DELAYTIMER_MAX */
|
||||||
|
|
||||||
/* Maximum length of a host name. */
|
/* Maximum length of a host name. */
|
||||||
#undef HOST_NAME_MAX
|
#undef HOST_NAME_MAX
|
||||||
#define HOST_NAME_MAX 255
|
#define HOST_NAME_MAX 255
|
||||||
|
@ -149,6 +179,16 @@ details. */
|
||||||
#undef LOGIN_NAME_MAX
|
#undef LOGIN_NAME_MAX
|
||||||
#define LOGIN_NAME_MAX 256 /* equal to UNLEN defined in w32api/lmcons.h */
|
#define LOGIN_NAME_MAX 256 /* equal to UNLEN defined in w32api/lmcons.h */
|
||||||
|
|
||||||
|
/* The maximum number of open message queue descriptors a process may hold.
|
||||||
|
Not yet implemented. */
|
||||||
|
#undef MQ_OPEN_MAX
|
||||||
|
/* #define MQ_OPEN_MAX >= _POSIX_MQ_OPEN_MAX */
|
||||||
|
|
||||||
|
/* The maximum number of message priorities supported by the implementation.
|
||||||
|
Not yet implemented. */
|
||||||
|
#undef MQ_PRIO_MAX
|
||||||
|
/* #define MQ_PRIO_MAX >= _POSIX_MQ_PRIO_MAX */
|
||||||
|
|
||||||
/* # of open files per process. Actually it can be more since Cygwin
|
/* # of open files per process. Actually it can be more since Cygwin
|
||||||
grows the dtable as necessary. We define a reasonable limit here
|
grows the dtable as necessary. We define a reasonable limit here
|
||||||
which is returned by getdtablesize(), sysconf(_SC_OPEN_MAX) and
|
which is returned by getdtablesize(), sysconf(_SC_OPEN_MAX) and
|
||||||
|
@ -162,11 +202,61 @@ details. */
|
||||||
#define PAGESIZE 65536
|
#define PAGESIZE 65536
|
||||||
#define PAGE_SIZE PAGESIZE
|
#define PAGE_SIZE PAGESIZE
|
||||||
|
|
||||||
|
/* Maximum number of attempts made to destroy a thread's thread-specific
|
||||||
|
data values on thread exit. */
|
||||||
|
/* FIXME: I really don't understand this value. Why should multiple
|
||||||
|
attempts be necessary to destroy thread-specific data?!? Anyway, the
|
||||||
|
current value here is 1, taken originally from our pthread.h file,
|
||||||
|
where it was mistakenly defined first. Unfortunately this value is
|
||||||
|
lower than the POSIX defined minimum value, which is 4. */
|
||||||
|
#undef PTHREAD_DESTRUCTOR_ITERATIONS
|
||||||
|
#define PTHREAD_DESTRUCTOR_ITERATIONS 1
|
||||||
|
|
||||||
|
/* Maximum number of data keys that can be created by a process. */
|
||||||
|
/* Tls has 64 items for pre win2000 - and we don't want to use them all :] */
|
||||||
|
#undef PTHREAD_KEYS_MAX
|
||||||
|
#define PTHREAD_KEYS_MAX 32
|
||||||
|
|
||||||
|
/* Minimum size in bytes of thread stack storage. */
|
||||||
|
/* Actually the minimum stack size is somewhat of a split personality.
|
||||||
|
The size parameter in a CreateThread call is the size of the initially
|
||||||
|
commited stack size, which can be specified as low as 4K. However, the
|
||||||
|
default *reserved* stack size is 1 Meg, unless the .def file specifies
|
||||||
|
another STACKSIZE value. And even if you specify a stack size below 64K,
|
||||||
|
the allocation granularity is in the way. You can never squeeze multiple
|
||||||
|
threads in the same allocation granularity slot. Oh well. */
|
||||||
|
#undef PTHREAD_STACK_MIN
|
||||||
|
#define PTHREAD_STACK_MIN 65536
|
||||||
|
|
||||||
|
/* Maximum number of threads that can be created per process. */
|
||||||
|
/* Windows allows any arbitrary number of threads per process. */
|
||||||
|
#undef PTHREAD_THREADS_MAX
|
||||||
|
/* #define PTHREAD_THREADS_MAX unspecified */
|
||||||
|
|
||||||
/* Maximum number of realtime signals reserved for application use. */
|
/* Maximum number of realtime signals reserved for application use. */
|
||||||
/* FIXME: We only support one realtime signal but _POSIX_RTSIG_MAX is 8. */
|
/* FIXME: We only support one realtime signal but _POSIX_RTSIG_MAX is 8. */
|
||||||
#undef RTSIG_MAX
|
#undef RTSIG_MAX
|
||||||
#define RTSIG_MAX 1
|
#define RTSIG_MAX 1
|
||||||
|
|
||||||
|
/* Maximum number of semaphores that a process may have. */
|
||||||
|
/* Windows allows any arbitrary number of semaphores per process. */
|
||||||
|
#undef SEM_NSEMS_MAX
|
||||||
|
/* #define SEM_NSEMS_MAX unspecified */
|
||||||
|
|
||||||
|
/* The maximum value a semaphore may have. */
|
||||||
|
#undef SEM_VALUE_MAX
|
||||||
|
#define SEM_VALUE_MAX 1147483648
|
||||||
|
|
||||||
|
/* Maximum number of queued signals that a process may send and have pending
|
||||||
|
at the receiver(s) at any time. */
|
||||||
|
#undef SIGQUEUE_MAX
|
||||||
|
#define SIGQUEUE_MAX 32
|
||||||
|
|
||||||
|
/* The maximum number of replenishment operations that may be simultaneously
|
||||||
|
pending for a particular sporadic server scheduler. Not implemented. */
|
||||||
|
#undef SS_REPL_MAX
|
||||||
|
/* #define SS_REPL_MAX >= _POSIX_SS_REPL_MAX */
|
||||||
|
|
||||||
/* Number of streams that one process can have open at one time. */
|
/* Number of streams that one process can have open at one time. */
|
||||||
#undef STREAM_MAX
|
#undef STREAM_MAX
|
||||||
#define STREAM_MAX 20
|
#define STREAM_MAX 20
|
||||||
|
@ -179,10 +269,34 @@ details. */
|
||||||
#undef TIMER_MAX
|
#undef TIMER_MAX
|
||||||
#define TIMER_MAX 32
|
#define TIMER_MAX 32
|
||||||
|
|
||||||
|
/* Maximum length of the trace event name. Not implemented. */
|
||||||
|
#undef TRACE_EVENT_NAME_MAX
|
||||||
|
/* #define TRACE_EVENT_NAME_MAX >= _POSIX_TRACE_EVENT_NAME_MAX */
|
||||||
|
|
||||||
|
/* Maximum length of the trace generation version string or of the trace
|
||||||
|
stream name. Not implemented. */
|
||||||
|
#undef TRACE_NAME_MAX
|
||||||
|
/* #define TRACE_NAME_MAX >= _POSIX_TRACE_NAME_MAX */
|
||||||
|
|
||||||
|
/* Maximum number of trace streams that may simultaneously exist in the
|
||||||
|
system. Not implemented. */
|
||||||
|
#undef TRACE_SYS_MAX
|
||||||
|
/* #define TRACE_SYS_MAX >= _POSIX_TRACE_SYS_MAX */
|
||||||
|
|
||||||
|
/* Maximum number of user trace event type identifiers that may simultaneously
|
||||||
|
exist in a traced process, including the predefined user trace event
|
||||||
|
POSIX_TRACE_UNNAMED_USER_EVENT. Not implemented. */
|
||||||
|
#undef TRACE_USER_EVENT_MAX
|
||||||
|
/* #define TRACE_USER_EVENT_MAX >= _POSIX_TRACE_USER_EVENT_MAX */
|
||||||
|
|
||||||
/* Maximum number of characters in a tty name. */
|
/* Maximum number of characters in a tty name. */
|
||||||
#undef TTY_NAME_MAX
|
#undef TTY_NAME_MAX
|
||||||
#define TTY_NAME_MAX 12
|
#define TTY_NAME_MAX 12
|
||||||
|
|
||||||
|
/* Maximum number of bytes supported for the name of a timezone (not of the TZ variable). Not implemented. */
|
||||||
|
#undef TZNAME_MAX
|
||||||
|
/* #define TZNAME_MAX >= _POSIX_TZNAME_MAX */
|
||||||
|
|
||||||
|
|
||||||
/* Pathname Variable Values */
|
/* Pathname Variable Values */
|
||||||
|
|
||||||
|
@ -215,6 +329,33 @@ details. */
|
||||||
#undef PIPE_BUF
|
#undef PIPE_BUF
|
||||||
#define PIPE_BUF 4096
|
#define PIPE_BUF 4096
|
||||||
|
|
||||||
|
/* Minimum number of bytes of storage actually allocated for any portion
|
||||||
|
of a file. Not implemented. */
|
||||||
|
#undef POSIX_ALLOC_SIZE_MIN
|
||||||
|
/* #define POSIX_ALLOC_SIZE_MIN unspecifed */
|
||||||
|
|
||||||
|
/* Recommended increment for file transfer sizes between the
|
||||||
|
{POSIX_REC_MIN_XFER_SIZE} and {POSIX_REC_MAX_XFER_SIZE} values.
|
||||||
|
Not implemented. */
|
||||||
|
#undef POSIX_REC_INCR_XFER_SIZE
|
||||||
|
/* #define POSIX_REC_INCR_XFER_SIZE unspecifed */
|
||||||
|
|
||||||
|
/* Maximum recommended file transfer size. Not implemented. */
|
||||||
|
#undef POSIX_REC_MAX_XFER_SIZE
|
||||||
|
/* #define POSIX_REC_MAX_XFER_SIZE unspecifed */
|
||||||
|
|
||||||
|
/* Minimum recommended file transfer size. Not implemented. */
|
||||||
|
#undef POSIX_REC_MIN_XFER_SIZE
|
||||||
|
/* #define POSIX_REC_MIN_XFER_SIZE unspecifed */
|
||||||
|
|
||||||
|
/* Recommended file transfer buffer alignment. Not implemented. */
|
||||||
|
#undef POSIX_REC_XFER_ALIGN
|
||||||
|
/* #define POSIX_REC_XFER_ALIGN unspecifed */
|
||||||
|
|
||||||
|
/* Maximum number of bytes in a symbolic link. */
|
||||||
|
#undef SYMLINK_MAX
|
||||||
|
#define SYMLINK_MAX PATH_MAX
|
||||||
|
|
||||||
|
|
||||||
/* Runtime Increasable Values */
|
/* Runtime Increasable Values */
|
||||||
|
|
||||||
|
@ -234,16 +375,18 @@ details. */
|
||||||
#undef BC_STRING_MAX
|
#undef BC_STRING_MAX
|
||||||
#define BC_STRING_MAX 1000
|
#define BC_STRING_MAX 1000
|
||||||
|
|
||||||
|
/* Maximum number of bytes in a character class name. Not implemented. */
|
||||||
|
#undef CHARCLASS_NAME_MAX
|
||||||
|
/* #define CHARCLASS_NAME_MAX >= _POSIX2_CHARCLASS_NAME_MAX */
|
||||||
|
|
||||||
/* Maximum number of weights that can be assigned to an entry of the
|
/* Maximum number of weights that can be assigned to an entry of the
|
||||||
LC_COLLATE order keyword in the locale definition file. */
|
LC_COLLATE order keyword in the locale definition file. */
|
||||||
/* FIXME: We don't support this at all right now, so this value is
|
/* FIXME: We don't support this at all right now, so this value is
|
||||||
misleading at best. It's also lower than _POSIX2_COLL_WEIGHTS_MAX
|
misleading at best. It's also lower than _POSIX2_COLL_WEIGHTS_MAX
|
||||||
which is not good. So, for now we deliberately not define it even
|
which is not good. So, for now we deliberately not define it even
|
||||||
though it was defined in the former syslimits.h file. */
|
though it was defined in the former syslimits.h file. */
|
||||||
#if 0
|
|
||||||
#undef COLL_WEIGHTS_MAX
|
#undef COLL_WEIGHTS_MAX
|
||||||
#define COLL_WEIGHTS_MAX 0
|
/* #define COLL_WEIGHTS_MAX >= _POSIX2_COLL_WEIGHTS_MAX */
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Maximum number of expressions that can be nested within parentheses
|
/* Maximum number of expressions that can be nested within parentheses
|
||||||
by the expr utility. */
|
by the expr utility. */
|
||||||
|
@ -265,51 +408,80 @@ details. */
|
||||||
#define RE_DUP_MAX 255
|
#define RE_DUP_MAX 255
|
||||||
|
|
||||||
|
|
||||||
/* Minimum Values */
|
|
||||||
|
|
||||||
/* POSIX values */
|
/* POSIX values */
|
||||||
/* These should never vary from one system type to another */
|
/* These should never vary from one system type to another */
|
||||||
/* They represent the minimum values that POSIX systems must support.
|
/* They represent the minimum values that POSIX systems must support.
|
||||||
POSIX-conforming apps must not require larger values. */
|
POSIX-conforming apps must not require larger values. */
|
||||||
#define _POSIX_ARG_MAX 4096
|
|
||||||
#define _POSIX_CHILD_MAX 6
|
|
||||||
#define _POSIX_HOST_NAME_MAX 255
|
|
||||||
#define _POSIX_LINK_MAX 8
|
|
||||||
#define _POSIX_LOGIN_NAME_MAX 9
|
|
||||||
#define _POSIX_MAX_CANON 255
|
|
||||||
#define _POSIX_MAX_INPUT 255
|
|
||||||
#define _POSIX_NAME_MAX 14
|
|
||||||
#define _POSIX_NGROUPS_MAX 0
|
|
||||||
#define _POSIX_OPEN_MAX 16
|
|
||||||
#define _POSIX_PATH_MAX 255
|
|
||||||
#define _POSIX_PIPE_BUF 512
|
|
||||||
#define _POSIX_RE_DUP_MAX 255
|
|
||||||
#define _POSIX_RTSIG_MAX 8
|
|
||||||
#define _POSIX_SSIZE_MAX 32767
|
|
||||||
#define _POSIX_STREAM_MAX 8
|
|
||||||
#define _POSIX_SYMLINK_MAX 255
|
|
||||||
#define _POSIX_SYMLOOP_MAX 8
|
|
||||||
#define _POSIX_TIMER_MAX 32
|
|
||||||
#define _POSIX_TTY_NAME_MAX 9
|
|
||||||
#define _POSIX_TZNAME_MAX 3
|
|
||||||
|
|
||||||
#define _POSIX2_BC_BASE_MAX 99
|
/* Maximum Values */
|
||||||
#define _POSIX2_BC_DIM_MAX 2048
|
|
||||||
#define _POSIX2_BC_SCALE_MAX 99
|
|
||||||
#define _POSIX2_BC_STRING_MAX 1000
|
|
||||||
#if 0 /* See comment about COLL_WEIGHTS_MAX above. */
|
|
||||||
#define _POSIX2_COLL_WEIGHTS_MAX 2
|
|
||||||
#endif
|
|
||||||
#define _POSIX2_EXPR_NEST_MAX 32
|
|
||||||
#define _POSIX2_LINE_MAX 2048
|
|
||||||
#define _POSIX2_RE_DUP_MAX 255
|
|
||||||
|
|
||||||
|
#define _POSIX_CLOCKRES_MIN 20000000
|
||||||
|
|
||||||
|
/* Minimum Values */
|
||||||
|
|
||||||
|
#define _POSIX_AIO_LISTIO_MAX 2
|
||||||
|
#define _POSIX_AIO_MAX 1
|
||||||
|
#define _POSIX_ARG_MAX 4096
|
||||||
|
#define _POSIX_CHILD_MAX 25
|
||||||
|
#define _POSIX_DELAYTIMER_MAX 32
|
||||||
|
#define _POSIX_HOST_NAME_MAX 255
|
||||||
|
#define _POSIX_LINK_MAX 8
|
||||||
|
#define _POSIX_LOGIN_NAME_MAX 9
|
||||||
|
#define _POSIX_MAX_CANON 255
|
||||||
|
#define _POSIX_MAX_INPUT 255
|
||||||
|
#define _POSIX_MQ_OPEN_MAX 8
|
||||||
|
#define _POSIX_MQ_PRIO_MAX 32
|
||||||
|
#define _POSIX_NAME_MAX 14
|
||||||
|
#define _POSIX_NGROUPS_MAX 8
|
||||||
|
#define _POSIX_OPEN_MAX 20
|
||||||
|
#define _POSIX_PATH_MAX 256
|
||||||
|
#define _POSIX_PIPE_BUF 512
|
||||||
|
#define _POSIX_RE_DUP_MAX 255
|
||||||
|
#define _POSIX_RTSIG_MAX 8
|
||||||
|
#define _POSIX_SEM_NSEMS_MAX 256
|
||||||
|
#define _POSIX_SEM_VALUE_MAX 32767
|
||||||
|
#define _POSIX_SIGQUEUE_MAX 32
|
||||||
|
#define _POSIX_SSIZE_MAX 32767
|
||||||
|
#define _POSIX_STREAM_MAX 8
|
||||||
|
#define _POSIX_SS_REPL_MAX 4
|
||||||
|
#define _POSIX_SYMLINK_MAX 255
|
||||||
|
#define _POSIX_SYMLOOP_MAX 8
|
||||||
|
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
|
||||||
|
#define _POSIX_THREAD_KEYS_MAX 128
|
||||||
|
#define _POSIX_THREAD_THREADS_MAX 64
|
||||||
|
#define _POSIX_TIMER_MAX 32
|
||||||
|
#define _POSIX_TRACE_EVENT_NAME_MAX 30
|
||||||
|
#define _POSIX_TRACE_NAME_MAX 8
|
||||||
|
#define _POSIX_TRACE_SYS_MAX 8
|
||||||
|
#define _POSIX_TRACE_USER_EVENT_MAX 32
|
||||||
|
#define _POSIX_TTY_NAME_MAX 9
|
||||||
|
#define _POSIX_TZNAME_MAX 6
|
||||||
|
|
||||||
|
#define _POSIX2_BC_BASE_MAX 99
|
||||||
|
#define _POSIX2_BC_DIM_MAX 2048
|
||||||
|
#define _POSIX2_BC_SCALE_MAX 99
|
||||||
|
#define _POSIX2_BC_STRING_MAX 1000
|
||||||
|
#define _POSIX2_COLL_WEIGHTS_MAX 2
|
||||||
|
#define _POSIX2_EXPR_NEST_MAX 32
|
||||||
|
#define _POSIX2_LINE_MAX 2048
|
||||||
|
#define _POSIX2_RE_DUP_MAX 255
|
||||||
|
|
||||||
|
#define _XOPEN_IOV_MAX 16
|
||||||
|
#define _XOPEN_NAME_MAX 255
|
||||||
|
#define _XOPEN_PATH_MAX 1024
|
||||||
|
|
||||||
/* Other Invariant Values */
|
/* Other Invariant Values */
|
||||||
|
|
||||||
|
#define NL_ARGMAX 9
|
||||||
|
#define NL_LANGMAX 14
|
||||||
|
#define NL_MSGMAX 32767
|
||||||
|
#define NL_NMAX INT_MAX
|
||||||
|
#define NL_SETMAX 255
|
||||||
|
#define NL_TEXTMAX _POSIX2_LINE_MAX
|
||||||
|
|
||||||
/* Default process priority. */
|
/* Default process priority. */
|
||||||
#undef NZERO
|
#undef NZERO
|
||||||
#define NZERO 20
|
#define NZERO 20
|
||||||
|
|
||||||
#endif /* _MACH_MACHLIMITS_H_ */
|
#endif /* _MACH_MACHLIMITS_H_ */
|
||||||
#endif /* _LIMITS_H___ */
|
#endif /* _LIMITS_H___ */
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* pthread.h: POSIX pthread interface
|
/* pthread.h: POSIX pthread interface
|
||||||
|
|
||||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006 Red Hat, Inc.
|
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006,
|
||||||
|
2007 Red Hat, Inc.
|
||||||
|
|
||||||
Written by Marco Fuykschot <marco@ddi.nl>
|
Written by Marco Fuykschot <marco@ddi.nl>
|
||||||
|
|
||||||
|
@ -30,11 +31,6 @@ extern "C"
|
||||||
would normally be written to the passed parameter of pthread_cond_init(lvalue, NULL); */
|
would normally be written to the passed parameter of pthread_cond_init(lvalue, NULL); */
|
||||||
/* #define PTHREAD_COND_INITIALIZER 0 */
|
/* #define PTHREAD_COND_INITIALIZER 0 */
|
||||||
|
|
||||||
#define PTHREAD_DESTRUCTOR_ITERATIONS 1
|
|
||||||
/* Tls has 64 items for pre win2000 - and we don't want to use them all :]
|
|
||||||
* Before committing discuss this with the list
|
|
||||||
*/
|
|
||||||
#define PTHREAD_KEYS_MAX 32
|
|
||||||
/* the default : joinable */
|
/* the default : joinable */
|
||||||
|
|
||||||
#define PTHREAD_CANCEL_ASYNCHRONOUS 1
|
#define PTHREAD_CANCEL_ASYNCHRONOUS 1
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* semaphore.h: POSIX semaphore interface
|
/* semaphore.h: POSIX semaphore interface
|
||||||
|
|
||||||
Copyright 2001, 2003 Red Hat, Inc.
|
Copyright 2001, 2003, 2007 Red Hat, Inc.
|
||||||
|
|
||||||
Written by Robert Collins <rbtcollins@hotmail.com>
|
Written by Robert Collins <rbtcollins@hotmail.com>
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SEM_FAILED 0
|
#define SEM_FAILED 0
|
||||||
#define SEM_VALUE_MAX 1147483648
|
|
||||||
|
|
||||||
/* Semaphores */
|
/* Semaphores */
|
||||||
int sem_init (sem_t * sem, int pshared, unsigned int value);
|
int sem_init (sem_t * sem, int pshared, unsigned int value);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* sys/mman.h
|
/* sys/mman.h
|
||||||
|
|
||||||
Copyright 1996, 1997, 1998, 2000, 2001 Red Hat, Inc.
|
Copyright 1996, 1997, 1998, 2000, 2001, 2003, 2005, 2007 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -47,6 +47,15 @@ extern "C" {
|
||||||
#define MS_SYNC 2
|
#define MS_SYNC 2
|
||||||
#define MS_INVALIDATE 4
|
#define MS_INVALIDATE 4
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Flags for posix_madvise.
|
||||||
|
*/
|
||||||
|
#define POSIX_MADV_NORMAL 0
|
||||||
|
#define POSIX_MADV_SEQUENTIAL 1
|
||||||
|
#define POSIX_MADV_RANDOM 2
|
||||||
|
#define POSIX_MADV_WILLNEED 3
|
||||||
|
#define POSIX_MADV_DONTNEED 4
|
||||||
|
|
||||||
#ifndef __INSIDE_CYGWIN__
|
#ifndef __INSIDE_CYGWIN__
|
||||||
extern void *mmap (void *__addr, size_t __len, int __prot, int __flags, int __fd, off_t __off);
|
extern void *mmap (void *__addr, size_t __len, int __prot, int __flags, int __fd, off_t __off);
|
||||||
#endif
|
#endif
|
||||||
|
@ -56,6 +65,8 @@ extern int msync (void *__addr, size_t __len, int __flags);
|
||||||
extern int mlock (const void *__addr, size_t __len);
|
extern int mlock (const void *__addr, size_t __len);
|
||||||
extern int munlock (const void *__addr, size_t __len);
|
extern int munlock (const void *__addr, size_t __len);
|
||||||
|
|
||||||
|
extern int posix_madvise (void *__addr, size_t __len, int __advice);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* sys/termios.h
|
/* sys/termios.h
|
||||||
|
|
||||||
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 Red Hat, Inc.
|
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006,
|
||||||
|
2007 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -233,10 +234,6 @@ POSIX commands */
|
||||||
|
|
||||||
#define NCCS 18
|
#define NCCS 18
|
||||||
|
|
||||||
/* `c_cc' member of 'struct termios' structure can be disabled by
|
|
||||||
using the value _POSIX_VDISABLE. */
|
|
||||||
#define _POSIX_VDISABLE '\0'
|
|
||||||
|
|
||||||
/* Compare a character C to a value VAL from the `c_cc' array in a
|
/* Compare a character C to a value VAL from the `c_cc' array in a
|
||||||
`struct termios'. If VAL is _POSIX_VDISABLE, no character can match it. */
|
`struct termios'. If VAL is _POSIX_VDISABLE, no character can match it. */
|
||||||
#define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE)
|
#define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* malloc_wrapper.cc
|
/* malloc_wrapper.cc
|
||||||
|
|
||||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||||
Red Hat, Inc.
|
2006, 2007 Red Hat, Inc.
|
||||||
|
|
||||||
Originally written by Steve Chamberlain of Cygnus Support
|
Originally written by Steve Chamberlain of Cygnus Support
|
||||||
sac@cygnus.com
|
sac@cygnus.com
|
||||||
|
@ -70,6 +70,8 @@ malloc (size_t size)
|
||||||
__malloc_unlock ();
|
__malloc_unlock ();
|
||||||
}
|
}
|
||||||
malloc_printf ("(%d) = %x, called by %p", size, res, __builtin_return_address (0));
|
malloc_printf ("(%d) = %x, called by %p", size, res, __builtin_return_address (0));
|
||||||
|
if (!res)
|
||||||
|
set_errno (ENOMEM);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +88,8 @@ realloc (void *p, size_t size)
|
||||||
__malloc_unlock ();
|
__malloc_unlock ();
|
||||||
}
|
}
|
||||||
malloc_printf ("(%x, %d) = %x, called by %x", p, size, res, __builtin_return_address (0));
|
malloc_printf ("(%x, %d) = %x, called by %x", p, size, res, __builtin_return_address (0));
|
||||||
|
if (!res)
|
||||||
|
set_errno (ENOMEM);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,9 +106,29 @@ calloc (size_t nmemb, size_t size)
|
||||||
__malloc_unlock ();
|
__malloc_unlock ();
|
||||||
}
|
}
|
||||||
malloc_printf ("(%d, %d) = %x, called by %x", nmemb, size, res, __builtin_return_address (0));
|
malloc_printf ("(%d, %d) = %x, called by %x", nmemb, size, res, __builtin_return_address (0));
|
||||||
|
if (!res)
|
||||||
|
set_errno (ENOMEM);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" int
|
||||||
|
posix_memalign (void **memptr, size_t alignment, size_t bytes)
|
||||||
|
{
|
||||||
|
void *res;
|
||||||
|
if (!use_internal_malloc)
|
||||||
|
return ENOSYS;
|
||||||
|
if ((alignment & (alignment - 1)) != 0)
|
||||||
|
return EINVAL;
|
||||||
|
__malloc_lock ();
|
||||||
|
res = dlmemalign (alignment, bytes);
|
||||||
|
__malloc_unlock ();
|
||||||
|
if (!res)
|
||||||
|
return ENOMEM;
|
||||||
|
if (memptr)
|
||||||
|
*memptr = res;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void *
|
extern "C" void *
|
||||||
memalign (size_t alignment, size_t bytes)
|
memalign (size_t alignment, size_t bytes)
|
||||||
{
|
{
|
||||||
|
@ -119,6 +143,8 @@ memalign (size_t alignment, size_t bytes)
|
||||||
__malloc_lock ();
|
__malloc_lock ();
|
||||||
res = dlmemalign (alignment, bytes);
|
res = dlmemalign (alignment, bytes);
|
||||||
__malloc_unlock ();
|
__malloc_unlock ();
|
||||||
|
if (!res)
|
||||||
|
set_errno (ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
@ -138,6 +164,8 @@ valloc (size_t bytes)
|
||||||
__malloc_lock ();
|
__malloc_lock ();
|
||||||
res = dlvalloc (bytes);
|
res = dlvalloc (bytes);
|
||||||
__malloc_unlock ();
|
__malloc_unlock ();
|
||||||
|
if (!res)
|
||||||
|
set_errno (ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -1650,6 +1650,29 @@ munlock (const void *addr, size_t len)
|
||||||
return ret;
|
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:
|
* Base implementation:
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* sysconf.cc
|
/* sysconf.cc
|
||||||
|
|
||||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||||
2006 Red Hat, Inc.
|
2006, 2007 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -22,131 +22,248 @@ details. */
|
||||||
#include "cygheap.h"
|
#include "cygheap.h"
|
||||||
#include "ntdll.h"
|
#include "ntdll.h"
|
||||||
|
|
||||||
|
static long
|
||||||
|
get_open_max (int in)
|
||||||
|
{
|
||||||
|
long max = getdtablesize ();
|
||||||
|
if (max < OPEN_MAX)
|
||||||
|
max = OPEN_MAX;
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
|
static long
|
||||||
|
get_page_size (int in)
|
||||||
|
{
|
||||||
|
return getpagesize ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static long
|
||||||
|
get_nproc_values (int in)
|
||||||
|
{
|
||||||
|
switch (in)
|
||||||
|
{
|
||||||
|
case _SC_NPROCESSORS_CONF:
|
||||||
|
case _SC_NPROCESSORS_ONLN:
|
||||||
|
if (!wincap.supports_smp ())
|
||||||
|
return 1;
|
||||||
|
/*FALLTHRU*/
|
||||||
|
case _SC_PHYS_PAGES:
|
||||||
|
if (wincap.supports_smp ())
|
||||||
|
{
|
||||||
|
NTSTATUS ret;
|
||||||
|
SYSTEM_BASIC_INFORMATION sbi;
|
||||||
|
if ((ret = NtQuerySystemInformation (SystemBasicInformation,
|
||||||
|
(PVOID) &sbi,
|
||||||
|
sizeof sbi, NULL))
|
||||||
|
!= STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
__seterrno_from_nt_status (ret);
|
||||||
|
debug_printf ("NtQuerySystemInformation: ret %d, Dos(ret) %E",
|
||||||
|
ret);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
switch (in)
|
||||||
|
{
|
||||||
|
case _SC_NPROCESSORS_CONF:
|
||||||
|
return sbi.NumberProcessors;
|
||||||
|
case _SC_NPROCESSORS_ONLN:
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
do
|
||||||
|
if (sbi.ActiveProcessors & 1)
|
||||||
|
i++;
|
||||||
|
while (sbi.ActiveProcessors >>= 1);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
case _SC_PHYS_PAGES:
|
||||||
|
return sbi.NumberOfPhysicalPages
|
||||||
|
/ (getpagesize () / getsystempagesize ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static long
|
||||||
|
get_avphys (int in)
|
||||||
|
{
|
||||||
|
if (wincap.supports_smp ())
|
||||||
|
{
|
||||||
|
NTSTATUS ret;
|
||||||
|
SYSTEM_PERFORMANCE_INFORMATION spi;
|
||||||
|
if ((ret = NtQuerySystemInformation (SystemPerformanceInformation,
|
||||||
|
(PVOID) &spi,
|
||||||
|
sizeof spi, NULL))
|
||||||
|
!= STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
__seterrno_from_nt_status (ret);
|
||||||
|
debug_printf ("NtQuerySystemInformation: ret %d, Dos(ret) %E",
|
||||||
|
ret);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return spi.AvailablePages / (getpagesize () / getsystempagesize ());
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum sc_type { nsup, cons, func };
|
||||||
|
|
||||||
|
static struct
|
||||||
|
{
|
||||||
|
sc_type type;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
long c;
|
||||||
|
long (*f)(int);
|
||||||
|
};
|
||||||
|
} sca[] =
|
||||||
|
{
|
||||||
|
{cons, {c:ARG_MAX}}, /* 0, _SC_ARG_MAX */
|
||||||
|
{cons, {c:CHILD_MAX}}, /* 1, _SC_CHILD_MAX */
|
||||||
|
{cons, {c:CLOCKS_PER_SEC}}, /* 2, _SC_CLK_TCK */
|
||||||
|
{cons, {c:NGROUPS_MAX}}, /* 3, _SC_NGROUPS_MAX */
|
||||||
|
{func, {f:get_open_max}}, /* 4, _SC_OPEN_MAX */
|
||||||
|
{cons, {c:_POSIX_JOB_CONTROL}}, /* 5, _SC_JOB_CONTROL */
|
||||||
|
{cons, {c:_POSIX_SAVED_IDS}}, /* 6, _SC_SAVED_IDS */
|
||||||
|
{cons, {c:_POSIX_VERSION}}, /* 7, _SC_VERSION */
|
||||||
|
{func, {f:get_page_size}}, /* 8, _SC_PAGESIZE */
|
||||||
|
{func, {f:get_nproc_values}}, /* 9, _SC_NPROCESSORS_CONF */
|
||||||
|
{func, {f:get_nproc_values}}, /* 10, _SC_NPROCESSORS_ONLN */
|
||||||
|
{func, {f:get_nproc_values}}, /* 11, _SC_PHYS_PAGES */
|
||||||
|
{func, {f:get_avphys}}, /* 12, _SC_AVPHYS_PAGES */
|
||||||
|
{nsup, {c:0}}, /* 13, _SC_MQ_OPEN_MAX */
|
||||||
|
{nsup, {c:0}}, /* 14, _SC_MQ_PRIO_MAX */
|
||||||
|
{cons, {c:RTSIG_MAX}}, /* 15, _SC_RTSIG_MAX */
|
||||||
|
{cons, {c:-1L}}, /* 16, _SC_SEM_NSEMS_MAX */
|
||||||
|
{cons, {c:SEM_VALUE_MAX}}, /* 17, _SC_SEM_VALUE_MAX */
|
||||||
|
{cons, {c:SIGQUEUE_MAX}}, /* 18, _SC_SIGQUEUE_MAX */
|
||||||
|
{cons, {c:TIMER_MAX}}, /* 19, _SC_TIMER_MAX */
|
||||||
|
{nsup, {c:0}}, /* 20, _SC_TZNAME_MAX */
|
||||||
|
{cons, {c:-1L}}, /* 21, _SC_ASYNCHRONOUS_IO */
|
||||||
|
{cons, {c:_POSIX_FSYNC}}, /* 22, _SC_FSYNC */
|
||||||
|
{cons, {c:_POSIX_MAPPED_FILES}}, /* 23, _SC_MAPPED_FILES */
|
||||||
|
{cons, {c:-1L}}, /* 24, _SC_MEMLOCK */
|
||||||
|
{cons, {c:_POSIX_MEMLOCK_RANGE}}, /* 25, _SC_MEMLOCK_RANGE */
|
||||||
|
{cons, {c:_POSIX_MEMORY_PROTECTION}}, /* 26, _SC_MEMORY_PROTECTION */
|
||||||
|
{cons, {c:-1L}}, /* 27, _SC_MESSAGE_PASSING */
|
||||||
|
{cons, {c:-1L}}, /* 28, _SC_PRIORITIZED_IO */
|
||||||
|
{cons, {c:_POSIX_REALTIME_SIGNALS}}, /* 29, _SC_REALTIME_SIGNALS */
|
||||||
|
{cons, {c:_POSIX_SEMAPHORES}}, /* 30, _SC_SEMAPHORES */
|
||||||
|
{cons, {c:-1L}}, /* 31, _SC_SHARED_MEMORY_OBJECTS */
|
||||||
|
{cons, {c:_POSIX_SYNCHRONIZED_IO}}, /* 32, _SC_SYNCHRONIZED_IO */
|
||||||
|
{cons, {c:_POSIX_TIMERS}}, /* 33, _SC_TIMERS */
|
||||||
|
{nsup, {c:0}}, /* 34, _SC_AIO_LISTIO_MAX */
|
||||||
|
{nsup, {c:0}}, /* 35, _SC_AIO_MAX */
|
||||||
|
{nsup, {c:0}}, /* 36, _SC_AIO_PRIO_DELTA_MAX */
|
||||||
|
{nsup, {c:0}}, /* 37, _SC_DELAYTIMER_MAX */
|
||||||
|
{cons, {c:PTHREAD_KEYS_MAX}}, /* 38, _SC_THREAD_KEYS_MAX */
|
||||||
|
{cons, {c:PTHREAD_STACK_MIN}}, /* 39, _SC_THREAD_STACK_MIN */
|
||||||
|
{cons, {c:-1L}}, /* 40, _SC_THREAD_THREADS_MAX */
|
||||||
|
{cons, {c:TTY_NAME_MAX}}, /* 41, _SC_TTY_NAME_MAX */
|
||||||
|
{cons, {c:_POSIX_THREADS}}, /* 42, _SC_THREADS */
|
||||||
|
{cons, {c:-1L}}, /* 43, _SC_THREAD_ATTR_STACKADDR */
|
||||||
|
{cons, {c:_POSIX_THREAD_ATTR_STACKSIZE}}, /* 44, _SC_THREAD_ATTR_STACKSIZE */
|
||||||
|
{cons, {c:_POSIX_THREAD_PRIORITY_SCHEDULING}}, /* 45, _SC_THREAD_PRIORITY_SCHEDULING */
|
||||||
|
{cons, {c:-1L}}, /* 46, _SC_THREAD_PRIO_INHERIT */
|
||||||
|
{cons, {c:-1L}}, /* 47, _SC_THREAD_PRIO_PROTECT */
|
||||||
|
{cons, {c:_POSIX_THREAD_PROCESS_SHARED}}, /* 48, _SC_THREAD_PROCESS_SHARED */
|
||||||
|
{cons, {c:_POSIX_THREAD_SAFE_FUNCTIONS}}, /* 49, _SC_THREAD_SAFE_FUNCTIONS */
|
||||||
|
{cons, {c:16384L}}, /* 50, _SC_GETGR_R_SIZE_MAX */
|
||||||
|
{cons, {c:16384L}}, /* 51, _SC_GETPW_R_SIZE_MAX */
|
||||||
|
{cons, {c:LOGIN_NAME_MAX}}, /* 52, _SC_LOGIN_NAME_MAX */
|
||||||
|
{cons, {c:PTHREAD_DESTRUCTOR_ITERATIONS}}, /* 53, _SC_THREAD_DESTRUCTOR_ITERATIONS */
|
||||||
|
{cons, {c:_POSIX_ADVISORY_INFO}}, /* 54, _SC_ADVISORY_INFO */
|
||||||
|
{cons, {c:ATEXIT_MAX}}, /* 55, _SC_ATEXIT_MAX */
|
||||||
|
{cons, {c:-1L}}, /* 56, _SC_BARRIERS */
|
||||||
|
{cons, {c:BC_BASE_MAX}}, /* 57, _SC_BC_BASE_MAX */
|
||||||
|
{cons, {c:BC_DIM_MAX}}, /* 58, _SC_BC_DIM_MAX */
|
||||||
|
{cons, {c:BC_SCALE_MAX}}, /* 59, _SC_BC_SCALE_MAX */
|
||||||
|
{cons, {c:BC_STRING_MAX}}, /* 60, _SC_BC_STRING_MAX */
|
||||||
|
{cons, {c:-1L}}, /* 61, _SC_CLOCK_SELECTION */
|
||||||
|
{nsup, {c:0}}, /* 62, _SC_COLL_WEIGHTS_MAX */
|
||||||
|
{cons, {c:-1L}}, /* 63, _SC_CPUTIME */
|
||||||
|
{cons, {c:EXPR_NEST_MAX}}, /* 64, _SC_EXPR_NEST_MAX */
|
||||||
|
{cons, {c:HOST_NAME_MAX}}, /* 65, _SC_HOST_NAME_MAX */
|
||||||
|
{cons, {c:IOV_MAX}}, /* 66, _SC_IOV_MAX */
|
||||||
|
{cons, {c:_POSIX_IPV6}}, /* 67, _SC_IPV6 */
|
||||||
|
{cons, {c:LINE_MAX}}, /* 68, _SC_LINE_MAX */
|
||||||
|
{cons, {c:-1L}}, /* 69, _SC_MONOTONIC_CLOCK */
|
||||||
|
{cons, {c:_POSIX_RAW_SOCKETS}}, /* 70, _SC_RAW_SOCKETS */
|
||||||
|
{cons, {c:_POSIX_READER_WRITER_LOCKS}}, /* 71, _SC_READER_WRITER_LOCKS */
|
||||||
|
{cons, {c:_POSIX_REGEXP}}, /* 72, _SC_REGEXP */
|
||||||
|
{cons, {c:RE_DUP_MAX}}, /* 73, _SC_RE_DUP_MAX */
|
||||||
|
{cons, {c:_POSIX_SHELL}}, /* 74, _SC_SHELL */
|
||||||
|
{cons, {c:-1L}}, /* 75, _SC_SPAWN */
|
||||||
|
{cons, {c:-1L}}, /* 76, _SC_SPIN_LOCKS */
|
||||||
|
{cons, {c:-1L}}, /* 77, _SC_SPORADIC_SERVER */
|
||||||
|
{nsup, {c:0}}, /* 78, _SC_SS_REPL_MAX */
|
||||||
|
{cons, {c:SYMLOOP_MAX}}, /* 79, _SC_SYMLOOP_MAX */
|
||||||
|
{cons, {c:-1L}}, /* 80, _SC_THREAD_CPUTIME */
|
||||||
|
{cons, {c:-1L}}, /* 81, _SC_THREAD_SPORADIC_SERVER */
|
||||||
|
{cons, {c:-1L}}, /* 82, _SC_TIMEOUTS */
|
||||||
|
{cons, {c:-1L}}, /* 83, _SC_TRACE */
|
||||||
|
{cons, {c:-1L}}, /* 84, _SC_TRACE_EVENT_FILTER */
|
||||||
|
{nsup, {c:0}}, /* 85, _SC_TRACE_EVENT_NAME_MAX */
|
||||||
|
{cons, {c:-1L}}, /* 86, _SC_TRACE_INHERIT */
|
||||||
|
{cons, {c:-1L}}, /* 87, _SC_TRACE_LOG */
|
||||||
|
{nsup, {c:0}}, /* 88, _SC_TRACE_NAME_MAX */
|
||||||
|
{nsup, {c:0}}, /* 89, _SC_TRACE_SYS_MAX */
|
||||||
|
{nsup, {c:0}}, /* 90, _SC_TRACE_USER_EVENT_MAX */
|
||||||
|
{cons, {c:-1L}}, /* 91, _SC_TYPED_MEMORY_OBJECTS */
|
||||||
|
{cons, {c:-1L}}, /* 92, _SC_V6_ILP32_OFF32 */
|
||||||
|
{cons, {c:_POSIX_V6_ILP32_OFFBIG}}, /* 93, _SC_V6_ILP32_OFFBIG */
|
||||||
|
{cons, {c:-1L}}, /* 94, _SC_V6_LP64_OFF64 */
|
||||||
|
{cons, {c:-1L}}, /* 95, _SC_V6_LPBIG_OFFBIG */
|
||||||
|
{cons, {c:_XOPEN_CRYPT}}, /* 96, _SC_XOPEN_CRYPT */
|
||||||
|
{cons, {c:_XOPEN_ENH_I18N}}, /* 97, _SC_XOPEN_ENH_I18N */
|
||||||
|
{cons, {c:-1L}}, /* 98, _SC_XOPEN_LEGACY */
|
||||||
|
{cons, {c:-1L}}, /* 99, _SC_XOPEN_REALTIME */
|
||||||
|
{cons, {c:STREAM_MAX}}, /* 100, _SC_STREAM_MAX */
|
||||||
|
{cons, {c:_POSIX_PRIORITY_SCHEDULING}}, /* 101, _SC_PRIORITY_SCHEDULING */
|
||||||
|
{cons, {c:-1L}}, /* 102, _SC_XOPEN_REALTIME_THREADS */
|
||||||
|
{cons, {c:_XOPEN_SHM}}, /* 103, _SC_XOPEN_SHM */
|
||||||
|
{cons, {c:-1L}}, /* 104, _SC_XOPEN_STREAMS */
|
||||||
|
{cons, {c:-1L}}, /* 105, _SC_XOPEN_UNIX */
|
||||||
|
{cons, {c:_XOPEN_VERSION}}, /* 106, _SC_XOPEN_VERSION */
|
||||||
|
{cons, {c:_POSIX2_CHAR_TERM}}, /* 107, _SC_2_CHAR_TERM */
|
||||||
|
{cons, {c:_POSIX2_C_BIND}}, /* 108, _SC_2_C_BIND */
|
||||||
|
{cons, {c:_POSIX2_C_BIND}}, /* 109, _SC_2_C_DEV */
|
||||||
|
{cons, {c:-1L}}, /* 110, _SC_2_FORT_DEV */
|
||||||
|
{cons, {c:-1L}}, /* 111, _SC_2_FORT_RUN */
|
||||||
|
{cons, {c:-1L}}, /* 112, _SC_2_LOCALEDEF */
|
||||||
|
{cons, {c:-1L}}, /* 113, _SC_2_PBS */
|
||||||
|
{cons, {c:-1L}}, /* 114, _SC_2_PBS_ACCOUNTING */
|
||||||
|
{cons, {c:-1L}}, /* 115, _SC_2_PBS_CHECKPOINT */
|
||||||
|
{cons, {c:-1L}}, /* 116, _SC_2_PBS_LOCATE */
|
||||||
|
{cons, {c:-1L}}, /* 117, _SC_2_PBS_MESSAGE */
|
||||||
|
{cons, {c:-1L}}, /* 118, _SC_2_PBS_TRACK */
|
||||||
|
{cons, {c:_POSIX2_SW_DEV}}, /* 119, _SC_2_SW_DEV */
|
||||||
|
{cons, {c:_POSIX2_UPE}}, /* 120, _SC_2_UPE */
|
||||||
|
{cons, {c:_POSIX2_VERSION}}, /* 121, _SC_2_VERSION */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SC_MIN _SC_ARG_MAX
|
||||||
|
#define SC_MAX _SC_2_VERSION
|
||||||
|
|
||||||
/* sysconf: POSIX 4.8.1.1 */
|
/* sysconf: POSIX 4.8.1.1 */
|
||||||
/* Allows a portable app to determine quantities of resources or
|
/* Allows a portable app to determine quantities of resources or
|
||||||
presence of an option at execution time. */
|
presence of an option at execution time. */
|
||||||
long int
|
long int
|
||||||
sysconf (int in)
|
sysconf (int in)
|
||||||
{
|
{
|
||||||
switch (in)
|
if (in >= SC_MIN && in <= SC_MAX)
|
||||||
{
|
{
|
||||||
/* Keep order as in sys/unistd.h */
|
switch (sca[in].type)
|
||||||
case _SC_ARG_MAX:
|
|
||||||
/* FIXME: what's the right value? _POSIX_ARG_MAX is only 4K.
|
|
||||||
FIXME: Wouldn't it be more correct to return ARG_MAX here? */
|
|
||||||
return 1048576;
|
|
||||||
case _SC_CHILD_MAX:
|
|
||||||
return CHILD_MAX;
|
|
||||||
case _SC_CLK_TCK:
|
|
||||||
return CLOCKS_PER_SEC;
|
|
||||||
case _SC_NGROUPS_MAX:
|
|
||||||
return NGROUPS_MAX;
|
|
||||||
case _SC_OPEN_MAX:
|
|
||||||
{
|
{
|
||||||
long max = getdtablesize ();
|
case nsup:
|
||||||
if (max < OPEN_MAX)
|
break;
|
||||||
max = OPEN_MAX;
|
case cons:
|
||||||
return max;
|
return sca[in].c;
|
||||||
|
case func:
|
||||||
|
return sca[in].f (in);
|
||||||
}
|
}
|
||||||
case _SC_JOB_CONTROL:
|
|
||||||
return _POSIX_JOB_CONTROL;
|
|
||||||
case _SC_SAVED_IDS:
|
|
||||||
return _POSIX_SAVED_IDS;
|
|
||||||
case _SC_VERSION:
|
|
||||||
return _POSIX_VERSION;
|
|
||||||
case _SC_PAGESIZE:
|
|
||||||
return getpagesize ();
|
|
||||||
case _SC_NPROCESSORS_CONF:
|
|
||||||
case _SC_NPROCESSORS_ONLN:
|
|
||||||
if (!wincap.supports_smp ())
|
|
||||||
return 1;
|
|
||||||
/*FALLTHRU*/
|
|
||||||
case _SC_PHYS_PAGES:
|
|
||||||
if (wincap.supports_smp ())
|
|
||||||
{
|
|
||||||
NTSTATUS ret;
|
|
||||||
SYSTEM_BASIC_INFORMATION sbi;
|
|
||||||
if ((ret = NtQuerySystemInformation (SystemBasicInformation,
|
|
||||||
(PVOID) &sbi,
|
|
||||||
sizeof sbi, NULL))
|
|
||||||
!= STATUS_SUCCESS)
|
|
||||||
{
|
|
||||||
__seterrno_from_nt_status (ret);
|
|
||||||
debug_printf ("NtQuerySystemInformation: ret %d, Dos(ret) %E",
|
|
||||||
ret);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
switch (in)
|
|
||||||
{
|
|
||||||
case _SC_NPROCESSORS_CONF:
|
|
||||||
return sbi.NumberProcessors;
|
|
||||||
case _SC_NPROCESSORS_ONLN:
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
do
|
|
||||||
if (sbi.ActiveProcessors & 1)
|
|
||||||
i++;
|
|
||||||
while (sbi.ActiveProcessors >>= 1);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
case _SC_PHYS_PAGES:
|
|
||||||
return sbi.NumberOfPhysicalPages;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case _SC_AVPHYS_PAGES:
|
|
||||||
if (wincap.supports_smp ())
|
|
||||||
{
|
|
||||||
NTSTATUS ret;
|
|
||||||
SYSTEM_PERFORMANCE_INFORMATION spi;
|
|
||||||
if ((ret = NtQuerySystemInformation (SystemPerformanceInformation,
|
|
||||||
(PVOID) &spi,
|
|
||||||
sizeof spi, NULL))
|
|
||||||
!= STATUS_SUCCESS)
|
|
||||||
{
|
|
||||||
__seterrno_from_nt_status (ret);
|
|
||||||
debug_printf ("NtQuerySystemInformation: ret %d, Dos(ret) %E",
|
|
||||||
ret);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return spi.AvailablePages;
|
|
||||||
}
|
|
||||||
case _SC_RTSIG_MAX:
|
|
||||||
return RTSIG_MAX;
|
|
||||||
case _SC_TIMER_MAX:
|
|
||||||
return TIMER_MAX;
|
|
||||||
#if 0 /* FIXME -- unimplemented */
|
|
||||||
case _SC_TZNAME_MAX:
|
|
||||||
return _POSIX_TZNAME_MAX;
|
|
||||||
#endif
|
|
||||||
case _SC_MEMLOCK_RANGE:
|
|
||||||
return _POSIX_MEMLOCK_RANGE;
|
|
||||||
case _SC_SEMAPHORES:
|
|
||||||
return _POSIX_SEMAPHORES;
|
|
||||||
case _SC_TIMERS:
|
|
||||||
return _POSIX_TIMERS;
|
|
||||||
case _SC_TTY_NAME_MAX:
|
|
||||||
return TTY_NAME_MAX;
|
|
||||||
case _SC_THREADS:
|
|
||||||
return _POSIX_THREADS;
|
|
||||||
case _SC_THREAD_ATTR_STACKSIZE:
|
|
||||||
return _POSIX_THREAD_ATTR_STACKSIZE;
|
|
||||||
case _SC_THREAD_PRIORITY_SCHEDULING:
|
|
||||||
return _POSIX_THREAD_PRIORITY_SCHEDULING;
|
|
||||||
case _SC_THREAD_PROCESS_SHARED:
|
|
||||||
return _POSIX_THREAD_PROCESS_SHARED;
|
|
||||||
case _SC_THREAD_SAFE_FUNCTIONS:
|
|
||||||
return _POSIX_THREAD_SAFE_FUNCTIONS;
|
|
||||||
case _SC_GETPW_R_SIZE_MAX:
|
|
||||||
case _SC_GETGR_R_SIZE_MAX:
|
|
||||||
return 16*1024;
|
|
||||||
case _SC_LOGIN_NAME_MAX:
|
|
||||||
return LOGIN_NAME_MAX;
|
|
||||||
case _SC_STREAM_MAX:
|
|
||||||
return STREAM_MAX;
|
|
||||||
}
|
}
|
||||||
|
/* Unimplemented sysconf name or invalid option value. */
|
||||||
/* Invalid input or unimplemented sysconf name */
|
|
||||||
set_errno (EINVAL);
|
set_errno (EINVAL);
|
||||||
return -1;
|
return -1L;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue