| 1 | /* ABI compatibility for 'fcntl' symbol in libpthread ABI. |
| 2 | Copyright (C) 2018-2020 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | |
| 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 | |
| 10 | The GNU C Library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with the GNU C Library; if not, see |
| 17 | <https://www.gnu.org/licenses/>. */ |
| 18 | |
| 19 | #include <fcntl.h> |
| 20 | #include <stdarg.h> |
| 21 | #include <shlib-compat.h> |
| 22 | |
| 23 | /* libpthread once had its own fcntl, though there was no apparent reason |
| 24 | for it. There is no use in having a separate symbol in libpthread, but |
| 25 | the historical ABI requires it. For static linking, there is no need to |
| 26 | provide anything here--the libc version will be linked in. For shared |
| 27 | library ABI compatibility, there must be __fcntl and fcntl symbols in |
| 28 | libpthread.so. */ |
| 29 | |
| 30 | #if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_28) |
| 31 | |
| 32 | static int |
| 33 | fcntl_compat (int fd, int cmd, ...) |
| 34 | { |
| 35 | void *arg; |
| 36 | va_list ap; |
| 37 | va_start (ap, cmd); |
| 38 | arg = va_arg (ap, void *); |
| 39 | va_end (ap); |
| 40 | return __libc_fcntl64 (fd, cmd, arg); |
| 41 | } |
| 42 | |
| 43 | weak_alias (fcntl_compat, fcntl_alias) |
| 44 | compat_symbol (libpthread, fcntl_alias, fcntl, GLIBC_2_0); |
| 45 | |
| 46 | weak_alias (fcntl_compat, __fcntl_alias) |
| 47 | compat_symbol (libpthread, __fcntl_alias, __fcntl, GLIBC_2_0); |
| 48 | |
| 49 | #endif |
| 50 | |