Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(477)

Unified Diff: src/untrusted/nacl/nacl_irt_init.c

Issue 25027006: Stackable IRT Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/untrusted/nacl/nacl_irt.c ('k') | src/untrusted/nacl/nacl_irt_module.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/untrusted/nacl/nacl_irt_init.c
diff --git a/src/untrusted/nacl/nacl_irt_init.c b/src/untrusted/nacl/nacl_irt_init.c
index f0f02c52a77316349c03088641da80d696af7de0..8b7abe65ed0de45eb66ded5b6ab17e5f30e0889e 100644
--- a/src/untrusted/nacl/nacl_irt_init.c
+++ b/src/untrusted/nacl/nacl_irt_init.c
@@ -12,6 +12,67 @@ static int __libnacl_irt_mprotect(void *addr, size_t len, int prot) {
return ENOSYS;
}
+#if 0
+void __libnacl_irt_init_module(void) {
+ size_t count;
+ size_t i;
+
+ count = 0;
+ while (NULL != nacl_irt_array[count].module_init) {
+ ++count;
+ }
+
+ for (i = 0; i < count; ++i) {
+ if (NULL != nacl_irt_array[i].module_init) {
+ nacl_irt_array[i].module_init();
+ }
+ }
+}
+
+void __libnacl_irt_fini_module(void) {
+ size_t count;
+ size_t i;
+
+ count = 0;
+ while (NULL != nacl_irt_array[count].module_init) {
+ ++count;
+ }
+
+ for (i = 0; i < count; ++i) {
+ if (NULL != nacl_irt_array[i].module_fini) {
+ nacl_irt_array[i].module_fini();
+ }
+ }
+}
+
+int nacl_irt_module_register(TYPE_nacl_irt_module_ctor ctor) {
+ TYPE_nacl_irt_query irt_query = NULL;
+ if ((irt_query = ctor(__nacl_irt_query)) != NULL) {
+ __nacl_irt_query = irt_query;
+ return 1;
+ }
+ return 0;
+}
+#endif
+
+#if 0
+extern void (*__libnacl_irt_init_array_start []) (void) __attribute__((weak));
+extern void (*__libnacl_irt_init_array_end []) (void) __attribute__((weak));
+
+/* Iterate over all the init routines. */
+void __libnacl_irt_init_array(void) {
+ size_t count;
+ size_t i;
+
+ _init();
+
+ count = __init_array_end - __init_array_start;
+ for (i = 0; i < count; i++) {
+ __init_array_start[i] ();
+ }
+}
+#endif
+
/*
* Scan the auxv for AT_SYSINFO, which is the pointer to the IRT query function.
* Stash that for later use.
@@ -33,9 +94,22 @@ static void grok_auxv(const Elf32_auxv_t *auxv) {
* Initialize all our IRT function tables using the query function.
* The query function's address is passed via AT_SYSINFO in auxv.
*/
-void __libnacl_irt_init(Elf32_auxv_t *auxv) {
+void __libnacl_irt_init(int argc, char **argv, Elf32_auxv_t *auxv) {
grok_auxv(auxv);
+#if 0
+ {
+ struct nacl_irt *irt = nacl_irt_new(NULL, __nacl_irt_query, NULL);
+ if (irt != NULL) {
+ nacl_irt_layer_init(irt->layer);
+ }
+ }
+ DO_QUERY(NACL_IRT_INSTANCE_v0_1, instance);
+
+ atexit(__libnacl_irt_instance.destroy);
+ __libnacl_irt_instance.init();
+#endif
+
/*
* The "fdio" interface doesn't do anything useful in Chromium (with the
* exception that write() sometimes produces useful debugging output for
« no previous file with comments | « src/untrusted/nacl/nacl_irt.c ('k') | src/untrusted/nacl/nacl_irt_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698