summaryrefslogtreecommitdiff
path: root/sysdeps/nacl/dl-sysdep.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2015-11-10 19:44:48 -0800
committerRoland McGrath <roland@hack.frob.com>2015-11-10 19:44:48 -0800
commitc0d6f2a33e1229a96d5d5064b9b04d7d3cd41d9d (patch)
tree76368887d991912b7942cf3aeb8fd1a2e2703373 /sysdeps/nacl/dl-sysdep.c
parent71d1b0166b4ace0d804af2993b3815758b852efc (diff)
NaCl: Use open_resource API for shared objects
Diffstat (limited to 'sysdeps/nacl/dl-sysdep.c')
-rw-r--r--sysdeps/nacl/dl-sysdep.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sysdeps/nacl/dl-sysdep.c b/sysdeps/nacl/dl-sysdep.c
index 3e902c2cae..3a04aa1176 100644
--- a/sysdeps/nacl/dl-sysdep.c
+++ b/sysdeps/nacl/dl-sysdep.c
@@ -87,3 +87,26 @@ _dl_start_user (void (*user_entry) (uint32_t info[]), uint32_t info[])
#endif /* SHARED */
#include <elf/dl-sysdep.c>
+
+#include <dl-sysdep-open.h>
+#include <nacl-interfaces.h>
+#include <assert.h>
+#include <string.h>
+#include <unistd.h>
+
+char *
+internal_function
+_dl_sysdep_open_object (const char *name, size_t namelen, int *fd)
+{
+ int error = __nacl_irt_resource_open.open_resource (name, fd);
+ if (error)
+ return NULL;
+ assert (*fd != -1);
+ char *realname = __strdup (name);
+ if (__glibc_unlikely (realname == NULL))
+ {
+ __close (*fd);
+ *fd = -1;
+ }
+ return realname;
+}