unistd.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright (C) 2004-2005 by egnite Software GmbH. All rights reserved.
  3. *
  4. * Copyright (c) 1991 The Regents of the University of California.
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the University nor the names of its contributors
  16. * may be used to endorse or promote products derived from this software
  17. * without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  23. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  25. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  26. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  27. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  28. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  29. * SUCH DAMAGE.
  30. *
  31. * For additional information see http://www.ethernut.de/
  32. *
  33. */
  34. /*!
  35. * \file unistd.h
  36. * \brief Miscellaneous function declarations.
  37. *
  38. * \verbatim
  39. *
  40. * $Log: unistd.h,v $
  41. * Revision 1.5 2005/04/19 15:46:45 freckle
  42. * added #include <compiler.h> as the implicit ordering is not sufficient
  43. * on our red hat machines and the cruisecontrol build fails
  44. *
  45. * Revision 1.4 2005/03/24 14:32:02 freckle
  46. * added creation of include/unistd_orig.h to configure
  47. * Added NUT_ wrapper for nut's unistd.h functions. Use <unistd_orig.h>
  48. * instead of "/usr/include/unistd.h". Relevant for unix emulation only.
  49. *
  50. * Revision 1.3 2005/02/23 13:42:28 freckle
  51. * Correctly include /usr/include/unistd.h for unix emulation
  52. *
  53. * Revision 1.2 2005/02/21 11:08:45 olereinhardt
  54. * For unix plattforms I added #include "/usr/include/unistd.h" since some
  55. * functions needed for unix_nutinit.c are missing in this file...
  56. *
  57. * Revision 1.1 2005/02/05 20:37:17 haraldkipp
  58. * Peanut added
  59. *
  60. *
  61. * \endverbatim
  62. */
  63. #ifndef _UNISTD_H_
  64. #include <compiler.h> // required e.g. for CONST
  65. #ifndef _UNISTD_VIRTUAL_H_
  66. #define _UNISTD_VIRTUAL_H_
  67. /* use native version on unix emulation */
  68. #if defined(__linux__) || defined(__APPLE__)
  69. #include "unistd_orig.h"
  70. // prefix all unistd calls with NUT_
  71. #define access(...) NUT_access(__VA_ARGS__)
  72. #define lseek(...) NUT_lseek(__VA_ARGS__)
  73. #define rmdir(...) NUT_rmdir(__VA_ARGS__)
  74. #define unlink(...) NUT_unlink(__VA_ARGS__)
  75. /* assure _UNISTD_H_ is set */
  76. #undef _UNISTD_H_
  77. #define _UNISTD_H_
  78. #define _UNISTD_H_
  79. #endif /* unix emulation */
  80. __BEGIN_DECLS
  81. /* */
  82. extern int access(CONST char *path, int what);
  83. extern long lseek(int fh, long pos, int whence);
  84. extern int rmdir(CONST char *path);
  85. extern int unlink(CONST char *path);
  86. __END_DECLS
  87. /* */
  88. #endif /* _UNISTD_VIRTUAL_H_ */
  89. #endif /* _UNISTD_H */