not-cancel.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Uncancelable versions of cancelable interfaces. Linux version.
  2. Copyright (C) 2003 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, write to the Free
  15. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  16. 02111-1307 USA. */
  17. #include <sysdep.h>
  18. /* Uncancelable open. */
  19. #define open_not_cancel(name, flags, mode) \
  20. INLINE_SYSCALL (open, 3, (const char *) (name), (flags), (mode))
  21. #define open_not_cancel_2(name, flags) \
  22. INLINE_SYSCALL (open, 2, (const char *) (name), (flags))
  23. /* Uncancelable close. */
  24. #define close_not_cancel(fd) \
  25. INLINE_SYSCALL (close, 1, fd)
  26. #define close_not_cancel_no_status(fd) \
  27. (void) ({ INTERNAL_SYSCALL_DECL (err); \
  28. INTERNAL_SYSCALL (close, err, 1, (fd)); })
  29. /* Uncancelable read. */
  30. #define read_not_cancel(fd, buf, n) \
  31. INLINE_SYSCALL (read, 3, (fd), (buf), (n))
  32. /* Uncancelable write. */
  33. #define write_not_cancel(fd, buf, n) \
  34. INLINE_SYSCALL (write, 3, (fd), (buf), (n))
  35. /* Uncancelable writev. */
  36. #define writev_not_cancel_no_status(fd, iov, n) \
  37. (void) ({ INTERNAL_SYSCALL_DECL (err); \
  38. INTERNAL_SYSCALL (writev, err, 3, (fd), (iov), (n)); })
  39. /* Uncancelable fcntl. */
  40. #define fcntl_not_cancel(fd, cmd, val) \
  41. __fcntl_nocancel (fd, cmd, val)
  42. /* Uncancelable waitpid. */
  43. #ifdef __NR_waitpid
  44. # define waitpid_not_cancel(pid, stat_loc, options) \
  45. INLINE_SYSCALL (waitpid, 3, pid, stat_loc, options)
  46. #else
  47. # define waitpid_not_cancel(pid, stat_loc, options) \
  48. INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL)
  49. #endif