aio_write.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Asynchronous write.
  2. Copyright (C) 1997-2026 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library 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 GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #include <bits/wordsize.h>
  16. #if __WORDSIZE == 64
  17. # define aio_write64 XXX
  18. # include <aio.h>
  19. /* And undo the hack. */
  20. # undef aio_write64
  21. #else
  22. # include <aio.h>
  23. #endif
  24. #include <aio_misc.h>
  25. #include <shlib-compat.h>
  26. int
  27. __aio_write (struct aiocb *aiocbp)
  28. {
  29. return (__aio_enqueue_request ((aiocb_union *) aiocbp, LIO_WRITE) == NULL
  30. ? -1 : 0);
  31. }
  32. #if PTHREAD_IN_LIBC
  33. versioned_symbol (libc, __aio_write, aio_write, GLIBC_2_34);
  34. # if __WORDSIZE == 64
  35. versioned_symbol (libc, __aio_write, aio_write64, GLIBC_2_34);
  36. # endif
  37. # if OTHER_SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_34)
  38. compat_symbol (librt, __aio_write, aio_write, GLIBC_2_1);
  39. # if __WORDSIZE == 64
  40. compat_symbol (librt, __aio_write, aio_write64, GLIBC_2_1);
  41. # endif
  42. # endif
  43. #else /* !PTHREAD_IN_LIBC */
  44. strong_alias (__aio_write, aio_write)
  45. # if __WORDSIZE == 64
  46. weak_alias (__aio_write, aio_write64)
  47. #endif
  48. #endif /* !PTHREAD_IN_LIBC */