]>
Commit | Line | Data |
---|---|---|
da7f049c | 1 | /* Interface for the user to replace NaCl IRT interface functions. |
f7a9f785 | 2 | Copyright (C) 2015-2016 Free Software Foundation, Inc. |
da7f049c RM |
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 | <http://www.gnu.org/licenses/>. */ | |
18 | ||
19 | #include <nacl-interfaces.h> | |
20 | #include <string.h> | |
21 | ||
22 | size_t | |
23 | nacl_interface_ext_supply (const char *interface_ident, | |
24 | const void *table, size_t tablesize) | |
25 | { | |
26 | const size_t ident_len = strlen (interface_ident) + 1; | |
27 | ||
28 | /* Most interfaces are in rtld, so try there first. If other | |
29 | libraries ever get their own tables not used in libc, then we | |
30 | will need some dynamic registration mechanism here to iterate | |
31 | over all libraries' __nacl_supply_interface_libfoo calls. */ | |
32 | if (0 | |
33 | #ifdef SHARED | |
34 | || __nacl_supply_interface_rtld (interface_ident, ident_len, | |
35 | table, tablesize) | |
36 | #endif | |
37 | || __nacl_supply_interface_libc (interface_ident, ident_len, | |
38 | table, tablesize)) | |
39 | return tablesize; | |
40 | ||
41 | return 0; | |
42 | } |