1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6#ifndef _UNISTD_H
7#define _UNISTD_H
8#define __UNISTD_H_SOURCED__ 1
9
10#include <io.h>
11#include <process.h>
12#include <getopt.h>
13
14/* These are also defined in stdio.h. */
15#ifndef SEEK_SET
16#define SEEK_SET 0
17#define SEEK_CUR 1
18#define SEEK_END 2
19#endif
20
21/* These are also defined in stdio.h. */
22#ifndef STDIN_FILENO
23#define STDIN_FILENO  0
24#define STDOUT_FILENO 1
25#define STDERR_FILENO 2
26#endif
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#pragma push_macro("sleep")
33#undef sleep
34unsigned int __cdecl sleep (unsigned int);
35#pragma pop_macro("sleep")
36
37#if !defined __NO_ISOCEXT
38#include <sys/types.h> /* For useconds_t. */
39
40int __cdecl __MINGW_NOTHROW usleep(useconds_t);
41#endif  /* Not __NO_ISOCEXT */
42
43#ifndef FTRUNCATE_DEFINED
44#define FTRUNCATE_DEFINED
45/* This is defined as a real library function to allow autoconf
46   to verify its existence. */
47#if !defined(NO_OLDNAMES) || defined(_POSIX)
48int ftruncate(int, off32_t);
49int ftruncate64(int, off64_t);
50int truncate(const char *, off32_t);
51int truncate64(const char *, off64_t);
52#ifndef __CRT__NO_INLINE
53__CRT_INLINE int ftruncate(int __fd, off32_t __length)
54{
55  return _chsize (__fd, __length);
56}
57#endif /* !__CRT__NO_INLINE */
58#else
59int ftruncate(int, _off_t);
60int ftruncate64(int, _off64_t);
61int truncate(const char *, _off_t);
62int truncate64(const char *, _off64_t);
63#ifndef __CRT__NO_INLINE
64__CRT_INLINE int ftruncate(int __fd, _off_t __length)
65{
66  return _chsize (__fd, __length);
67}
68#endif /* !__CRT__NO_INLINE */
69#endif
70#endif /* FTRUNCATE_DEFINED */
71
72#ifndef _FILE_OFFSET_BITS_SET_FTRUNCATE
73#define _FILE_OFFSET_BITS_SET_FTRUNCATE
74#if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64))
75#define ftruncate ftruncate64
76#endif /* _FILE_OFFSET_BITS_SET_FTRUNCATE */
77#endif /* _FILE_OFFSET_BITS_SET_FTRUNCATE */
78
79#ifndef _CRT_SWAB_DEFINED
80#define _CRT_SWAB_DEFINED /* Also in stdlib.h */
81  void __cdecl swab(char *_Buf1,char *_Buf2,int _SizeInBytes) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
82#endif
83
84#ifdef __cplusplus
85}
86#endif
87
88#include <pthread_unistd.h>
89
90#undef __UNISTD_H_SOURCED__
91#endif /* _UNISTD_H */
92
93