-#ifndef _UNISTD_H
/*
* unistd.h
*
* Ramiro Polla <ramiro@lisha.ufsc.br>
* Gregory McGarry <gregorymcgarry@users.sourceforge.net>
* Keith Marshall <keithmarshall@users.sourceforge.net>
- * Copyright (C) 1997, 1999, 2002-2004, 2007-2009, 2014-2015,
+ * Copyright (C) 1997, 1999, 2002-2004, 2007-2009, 2014-2016,
* MinGW.org Project.
*
*
* DEALINGS IN THE SOFTWARE.
*
*/
+#ifndef _UNISTD_H
#define _UNISTD_H 1
#pragma GCC system_header
*/
#include <_mingw.h>
-/* unistd.h maps (roughly) to io.h
- * Other headers included by unistd.h may be selectively processed;
+/* unistd.h maps (roughly) to Microsoft's <io.h>
+ * Other headers included by <unistd.h> may be selectively processed;
* __UNISTD_H_SOURCED__ enables such selective processing.
*/
#define __UNISTD_H_SOURCED__ 1
#define SEEK_END 2
#if _POSIX_C_SOURCE
-/*
- * POSIX process/thread suspension functions; all are supported by a
+/* POSIX process/thread suspension functions; all are supported by a
* common MinGW API in libmingwex.a, providing for suspension periods
- * ranging from mean values of ~7.5 milliseconds, (see comments below),
- * extending up to a maximum of ~136 years.
+ * ranging from mean values of ~7.5 milliseconds, (see the comments in
+ * <time.h>), extending up to a maximum of ~136 years.
*
* Note that, whereas POSIX supports early wake-up of any suspended
* process/thread, in response to a signal, this implementation makes
* argument, this implementation always returns an indication as if
* the sleeping period ran to completion.
*/
-_EXTERN_C __cdecl __MINGW_NOTHROW
-int __mingw_sleep( unsigned long, unsigned long );
-
-/* Structure timespec is mandated by POSIX, for specification of
- * intervals with the greatest precision supported by the OS kernel.
- * Although this allows for specification to nanosecond precision, do
- * not be deluded into any false expectation that such short intervals
- * can be realized on Windows; on Win9x derivatives, the metronome used
- * by the process scheduler has a period of ~55 milliseconds, while for
- * WinNT derivatives, the corresponding period is ~15 milliseconds; thus,
- * the shortest intervals which can be realistically timed will range
- * from 0..55 milliseconds on Win9x hosts, and from 0..15 ms on WinNT,
- * with period values normally distributed around means of ~27.5 ms
- * and ~7.5 ms, for the two system types respectively.
- */
-#define _FAKE_TIME_H_SOURCED 1
-#define __need_struct_timespec
-#include <parts/time.h>
-
_BEGIN_C_DECLS
-/* The nanosleep() function provides the most general purpose API for
- * process/thread suspension; it provides for specification of periods
- * ranging from ~7.5 ms mean, (on WinNT derivatives; ~27.5 ms on Win9x),
- * extending up to ~136 years, (effectively eternity).
- */
__cdecl __MINGW_NOTHROW
-int nanosleep( const struct timespec *, struct timespec * );
-
-#ifndef __NO_INLINE__
-__CRT_INLINE __LIBIMPL__(( FUNCTION = nanosleep ))
-int nanosleep( const struct timespec *period, struct timespec *residual )
-{
- if( residual != (void *)(0) )
- residual->tv_sec = (__time64_t)(residual->tv_nsec = 0);
- return __mingw_sleep((unsigned)(period->tv_sec), (period->tv_sec < 0LL)
- ? (unsigned)(-1) : (unsigned)(period->tv_nsec));
-}
-#endif
+int __mingw_sleep( unsigned long, unsigned long );
-/* The usleep() function, and its associated useconds_t type specifier
+/* The nanosleep() function provides the most general purpose API for
+ * process/thread suspension; it is declared in <time.h>, (where it is
+ * accompanied by an in-line implementation), rather than here, and it
+ * provides for specification of suspension periods in the range from
+ * ~7.5 ms mean, (on WinNT derivatives; ~27.5 ms on Win9x), extending
+ * up to ~136 years, (effectively eternity).
+ *
+ * The usleep() function, and its associated useconds_t type specifier
* were made obsolete in POSIX.1-2008; declared here, only for backward
* compatibility, its continued use is not recommended. (It is limited
* to specification of suspension periods ranging from ~7.5 ms mean up