pt-fcntl.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* ABI compatibility for 'fcntl' symbol in libpthread ABI.
  2. Copyright (C) 2018-2019 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. <http://www.gnu.org/licenses/>. */
  15. #include <fcntl.h>
  16. #include <stdarg.h>
  17. #include <shlib-compat.h>
  18. /* libpthread once had its own fcntl, though there was no apparent reason
  19. for it. There is no use in having a separate symbol in libpthread, but
  20. the historical ABI requires it. For static linking, there is no need to
  21. provide anything here--the libc version will be linked in. For shared
  22. library ABI compatibility, there must be __fcntl and fcntl symbols in
  23. libpthread.so. */
  24. #if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_28)
  25. static int
  26. fcntl_compat (int fd, int cmd, ...)
  27. {
  28. void *arg;
  29. va_list ap;
  30. va_start (ap, cmd);
  31. arg = va_arg (ap, void *);
  32. va_end (ap);
  33. return __libc_fcntl64 (fd, cmd, arg);
  34. }
  35. weak_alias (fcntl_compat, fcntl_alias)
  36. compat_symbol (libpthread, fcntl_alias, fcntl, GLIBC_2_0);
  37. weak_alias (fcntl_compat, __fcntl_alias)
  38. compat_symbol (libpthread, __fcntl_alias, __fcntl, GLIBC_2_0);
  39. #endif