open3.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* Defines for Sys V style 3-argument open call.
  2. Copyright (C) 1988 Free Software Foundation
  3. This file is part of GNU Tar.
  4. GNU Tar is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. GNU Tar is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Tar; see the file COPYING. If not, write to
  14. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
  15. /*
  16. * @(#)open3.h 1.4 87/11/11
  17. *
  18. * open3.h -- #defines for the various flags for the Sys V style 3-argument
  19. * open() call. On BSD or System 5, the system already has this in an
  20. * include file. This file is needed for V7 and MINIX systems for the
  21. * benefit of open3() in port.c, a routine that emulates the 3-argument
  22. * call using system calls available on V7/MINIX.
  23. *
  24. * This file is needed by PD tar even if we aren't using the
  25. * emulator, since the #defines for O_WRONLY, etc. are used in
  26. * a couple of places besides the open() calls, (e.g. in the assignment
  27. * to openflag in extract.c). We just #include this rather than
  28. * #ifdef them out.
  29. *
  30. * Written 6/10/87 by rmtodd@uokmax (Richard Todd).
  31. *
  32. * The names have been changed by John Gilmore, 31 July 1987, since
  33. * Richard called it "bsdopen", and really this change was introduced in
  34. * AT&T Unix systems before BSD picked it up.
  35. */
  36. /* Only one of the next three should be specified */
  37. #define O_RDONLY 0 /* only allow read */
  38. #define O_WRONLY 1 /* only allow write */
  39. #define O_RDWR 2 /* both are allowed */
  40. /* The rest of these can be OR-ed in to the above. */
  41. /*
  42. * O_NDELAY isn't implemented by the emulator. It's only useful (to tar) on
  43. * systems that have named pipes anyway; it prevents tar's hanging by
  44. * opening a named pipe. We #ifndef it because some systems already have
  45. * it defined.
  46. */
  47. #ifndef O_NDELAY
  48. #define O_NDELAY 4 /* don't block on opening devices that would
  49. * block on open -- ignored by emulator. */
  50. #endif
  51. #define O_CREAT 8 /* create file if needed */
  52. #define O_EXCL 16 /* file cannot already exist */
  53. #define O_TRUNC 32 /* truncate file on open */
  54. #define O_APPEND 64 /* always write at end of file -- ignored by emul */
  55. #ifdef EMUL_OPEN3
  56. /*
  57. * make emulation transparent to rest of file -- redirect all open() calls
  58. * to our routine
  59. */
  60. #define open open3
  61. #endif