Print this page
OS-5192 need faster clock_gettime
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
Reviewed by: Ryan Zezeski <ryan@zinascii.com>
OS-2844 lx brand should support 64-bit user-land
OS-3280 need a way to specify the root of a native system in the lx brand
OS-3279 lx brand should allow delegated datasets
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>

@@ -123,10 +123,11 @@
         0,                      /* nthreads */
         0,                      /* nzombies */
         0,                      /* ndaemons */
         0,                      /* pid */
         sigacthandler,          /* sigacthandler */
+        __setcontext,           /* setctxt */
         NULL,                   /* lwp_stacks */
         NULL,                   /* lwp_laststack */
         0,                      /* nfreestack */
         10,                     /* thread_stack_cache */
         NULL,                   /* ulwp_freelist */

@@ -135,10 +136,12 @@
         NULL,                   /* ulwp_replace_last */
         NULL,                   /* atforklist */
         NULL,                   /* robustlocks */
         NULL,                   /* robustlist */
         NULL,                   /* progname */
+        NULL,                   /* ub_broot */
+        NULL,                   /* ub_comm_page */
         NULL,                   /* __tdb_bootstrap */
         {                       /* tdb */
                 NULL,           /* tdb_sync_addr_hash */
                 0,              /* tdb_register_count */
                 0,              /* tdb_hash_alloc_failed */

@@ -1218,10 +1221,33 @@
 
 #ifdef __amd64
 extern void __proc64id(void);
 #endif
 
+static void
+init_auxv_data(uberdata_t *udp)
+{
+        Dl_argsinfo_t args;
+
+        udp->ub_broot = NULL;
+        udp->ub_comm_page = NULL;
+        if (dlinfo(RTLD_SELF, RTLD_DI_ARGSINFO, &args) < 0)
+                return;
+
+        while (args.dla_auxv->a_type != AT_NULL) {
+                switch (args.dla_auxv->a_type) {
+                case AT_SUN_BRAND_NROOT:
+                        udp->ub_broot = args.dla_auxv->a_un.a_ptr;
+                        break;
+                case AT_SUN_COMMPAGE:
+                        udp->ub_comm_page = args.dla_auxv->a_un.a_ptr;
+                        break;
+                }
+                args.dla_auxv++;
+        }
+}
+
 /*
  * libc_init() is called by ld.so.1 for library initialization.
  * We perform minimal initialization; enough to work with the main thread.
  */
 void

@@ -1254,10 +1280,18 @@
          * Every libc, regardless of which link map, must register __cleanup().
          */
         (void) _atexit(__cleanup);
 
         /*
+         * Every libc, regardless of link map, needs to go through and check
+         * its aux vectors.  Doing so will indicate whether or not this has
+         * been given a brand root (used to qualify various other data) or a
+         * comm page (to optimize certain system actions).
+         */
+        init_auxv_data(udp);
+
+        /*
          * We keep our uberdata on one of (a) the first alternate link map
          * or (b) the primary link map.  We switch to the primary link map
          * and stay there once we see it.  All intermediate link maps are
          * subject to being unloaded at any time.
          */