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 /* Used by shutdown(2). */ 29 #ifdef _POSIX_SOURCE 30 31 /* MySql connector already defined SHUT_RDWR. */ 32 #ifndef SHUT_RDWR 33 #define SHUT_RD 0x00 34 #define SHUT_WR 0x01 35 #define SHUT_RDWR 0x02 36 #endif 37 38 #endif 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 #pragma push_macro("sleep") 45 #undef sleep 46 unsigned int __cdecl sleep (unsigned int); 47 #pragma pop_macro("sleep") 48 49 #if !defined __NO_ISOCEXT 50 #include <sys/types.h> /* For useconds_t. */ 51 52 int __cdecl __MINGW_NOTHROW usleep(useconds_t); 53 #endif /* Not __NO_ISOCEXT */ 54 55 #ifndef FTRUNCATE_DEFINED 56 #define FTRUNCATE_DEFINED 57 /* This is defined as a real library function to allow autoconf 58 to verify its existence. */ 59 #if !defined(NO_OLDNAMES) || defined(_POSIX) 60 int ftruncate(int, off32_t); 61 int ftruncate64(int, off64_t); 62 int truncate(const char *, off32_t); 63 int truncate64(const char *, off64_t); 64 #ifndef __CRT__NO_INLINE 65 __CRT_INLINE int ftruncate(int __fd, off32_t __length) 66 { 67 return _chsize (__fd, __length); 68 } 69 #endif /* !__CRT__NO_INLINE */ 70 #else 71 int ftruncate(int, _off_t); 72 int ftruncate64(int, _off64_t); 73 int truncate(const char *, _off_t); 74 int truncate64(const char *, _off64_t); 75 #ifndef __CRT__NO_INLINE 76 __CRT_INLINE int ftruncate(int __fd, _off_t __length) 77 { 78 return _chsize (__fd, __length); 79 } 80 #endif /* !__CRT__NO_INLINE */ 81 #endif 82 #endif /* FTRUNCATE_DEFINED */ 83 84 #ifndef _FILE_OFFSET_BITS_SET_FTRUNCATE 85 #define _FILE_OFFSET_BITS_SET_FTRUNCATE 86 #if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) 87 #define ftruncate ftruncate64 88 #endif /* _FILE_OFFSET_BITS_SET_FTRUNCATE */ 89 #endif /* _FILE_OFFSET_BITS_SET_FTRUNCATE */ 90 91 #ifndef _CRT_SWAB_DEFINED 92 #define _CRT_SWAB_DEFINED /* Also in stdlib.h */ 93 void __cdecl swab(char *_Buf1,char *_Buf2,int _SizeInBytes) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 94 #endif 95 96 #ifndef _CRT_GETPID_DEFINED 97 #define _CRT_GETPID_DEFINED /* Also in process.h */ 98 int __cdecl getpid(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 99 #endif 100 101 #ifdef __cplusplus 102 } 103 #endif 104 105 #include <pthread_unistd.h> 106 107 #undef __UNISTD_H_SOURCED__ 108 #endif /* _UNISTD_H */ 109 110