unistd.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. #include <io.h>
  10. #include <process.h>
  11. #include <getopt.h>
  12. /* These are also defined in stdio.h. */
  13. #ifndef SEEK_SET
  14. #define SEEK_SET 0
  15. #define SEEK_CUR 1
  16. #define SEEK_END 2
  17. #endif
  18. /* These are also defined in stdio.h. */
  19. #ifndef STDIN_FILENO
  20. #define STDIN_FILENO 0
  21. #define STDOUT_FILENO 1
  22. #define STDERR_FILENO 2
  23. #endif
  24. /* Used by shutdown(2). */
  25. #ifdef _POSIX_SOURCE
  26. /* MySql connector already defined SHUT_RDWR. */
  27. #ifndef SHUT_RDWR
  28. #define SHUT_RD 0x00
  29. #define SHUT_WR 0x01
  30. #define SHUT_RDWR 0x02
  31. #endif
  32. #endif
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. #pragma push_macro("sleep")
  37. #undef sleep
  38. unsigned int __cdecl sleep (unsigned int);
  39. #pragma pop_macro("sleep")
  40. #if !defined __NO_ISOCEXT
  41. #include <sys/types.h> /* For useconds_t. */
  42. int __cdecl __MINGW_NOTHROW usleep(useconds_t);
  43. #endif /* Not __NO_ISOCEXT */
  44. #ifndef FTRUNCATE_DEFINED
  45. #define FTRUNCATE_DEFINED
  46. /* This is defined as a real library function to allow autoconf
  47. to verify its existence. */
  48. #if !defined(NO_OLDNAMES) || defined(_POSIX)
  49. int ftruncate(int, off32_t);
  50. int ftruncate64(int, off64_t);
  51. int truncate(const char *, off32_t);
  52. int truncate64(const char *, off64_t);
  53. #ifndef __CRT__NO_INLINE
  54. __CRT_INLINE int ftruncate(int __fd, off32_t __length)
  55. {
  56. return _chsize (__fd, __length);
  57. }
  58. #endif /* !__CRT__NO_INLINE */
  59. #else
  60. int ftruncate(int, _off_t);
  61. int ftruncate64(int, _off64_t);
  62. int truncate(const char *, _off_t);
  63. int truncate64(const char *, _off64_t);
  64. #ifndef __CRT__NO_INLINE
  65. __CRT_INLINE int ftruncate(int __fd, _off_t __length)
  66. {
  67. return _chsize (__fd, __length);
  68. }
  69. #endif /* !__CRT__NO_INLINE */
  70. #endif
  71. #endif /* FTRUNCATE_DEFINED */
  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. #ifndef _CRT_SWAB_DEFINED
  79. #define _CRT_SWAB_DEFINED /* Also in stdlib.h */
  80. void __cdecl swab(char *_Buf1,char *_Buf2,int _SizeInBytes) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
  81. #endif
  82. #if defined(_CRT_USE_WINAPI_FAMILY_DESKTOP_APP) || defined(WINSTORECOMPAT)
  83. #ifndef _CRT_GETPID_DEFINED
  84. #define _CRT_GETPID_DEFINED /* Also in process.h */
  85. int __cdecl getpid(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
  86. #endif
  87. #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP || WINSTORECOMPAT */
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #include <pthread_unistd.h>
  92. #undef __UNISTD_H_SOURCED__
  93. #endif /* _UNISTD_H */