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>

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libc/port/threads/thr.c
          +++ new/usr/src/lib/libc/port/threads/thr.c
↓ open down ↓ 117 lines elided ↑ open up ↑
 118  118          1,                      /* hash_size: size of the hash table */
 119  119          0,                      /* hash_mask: hash_size - 1 */
 120  120          NULL,                   /* ulwp_one */
 121  121          NULL,                   /* all_lwps */
 122  122          NULL,                   /* all_zombies */
 123  123          0,                      /* nthreads */
 124  124          0,                      /* nzombies */
 125  125          0,                      /* ndaemons */
 126  126          0,                      /* pid */
 127  127          sigacthandler,          /* sigacthandler */
      128 +        __setcontext,           /* setctxt */
 128  129          NULL,                   /* lwp_stacks */
 129  130          NULL,                   /* lwp_laststack */
 130  131          0,                      /* nfreestack */
 131  132          10,                     /* thread_stack_cache */
 132  133          NULL,                   /* ulwp_freelist */
 133  134          NULL,                   /* ulwp_lastfree */
 134  135          NULL,                   /* ulwp_replace_free */
 135  136          NULL,                   /* ulwp_replace_last */
 136  137          NULL,                   /* atforklist */
 137  138          NULL,                   /* robustlocks */
 138  139          NULL,                   /* robustlist */
 139  140          NULL,                   /* progname */
      141 +        NULL,                   /* ub_broot */
      142 +        NULL,                   /* ub_comm_page */
 140  143          NULL,                   /* __tdb_bootstrap */
 141  144          {                       /* tdb */
 142  145                  NULL,           /* tdb_sync_addr_hash */
 143  146                  0,              /* tdb_register_count */
 144  147                  0,              /* tdb_hash_alloc_failed */
 145  148                  NULL,           /* tdb_sync_addr_free */
 146  149                  NULL,           /* tdb_sync_addr_last */
 147  150                  0,              /* tdb_sync_alloc */
 148  151                  { 0, 0 },       /* tdb_ev_global_mask */
 149  152                  tdb_events,     /* tdb_events array */
↓ open down ↓ 1063 lines elided ↑ open up ↑
1213 1216  
1214 1217  /* same as _cleanup() but private to the library */
1215 1218  extern void __cleanup(void);
1216 1219  
1217 1220  extern void atfork_init(void);
1218 1221  
1219 1222  #ifdef __amd64
1220 1223  extern void __proc64id(void);
1221 1224  #endif
1222 1225  
     1226 +static void
     1227 +init_auxv_data(uberdata_t *udp)
     1228 +{
     1229 +        Dl_argsinfo_t args;
     1230 +
     1231 +        udp->ub_broot = NULL;
     1232 +        udp->ub_comm_page = NULL;
     1233 +        if (dlinfo(RTLD_SELF, RTLD_DI_ARGSINFO, &args) < 0)
     1234 +                return;
     1235 +
     1236 +        while (args.dla_auxv->a_type != AT_NULL) {
     1237 +                switch (args.dla_auxv->a_type) {
     1238 +                case AT_SUN_BRAND_NROOT:
     1239 +                        udp->ub_broot = args.dla_auxv->a_un.a_ptr;
     1240 +                        break;
     1241 +                case AT_SUN_COMMPAGE:
     1242 +                        udp->ub_comm_page = args.dla_auxv->a_un.a_ptr;
     1243 +                        break;
     1244 +                }
     1245 +                args.dla_auxv++;
     1246 +        }
     1247 +}
     1248 +
1223 1249  /*
1224 1250   * libc_init() is called by ld.so.1 for library initialization.
1225 1251   * We perform minimal initialization; enough to work with the main thread.
1226 1252   */
1227 1253  void
1228 1254  libc_init(void)
1229 1255  {
1230 1256          uberdata_t *udp = &__uberdata;
1231 1257          ulwp_t *oldself = __curthread();
1232 1258          ucontext_t uc;
↓ open down ↓ 16 lines elided ↑ open up ↑
1249 1275           */
1250 1276          __proc64id();
1251 1277  #endif
1252 1278  
1253 1279          /*
1254 1280           * Every libc, regardless of which link map, must register __cleanup().
1255 1281           */
1256 1282          (void) _atexit(__cleanup);
1257 1283  
1258 1284          /*
     1285 +         * Every libc, regardless of link map, needs to go through and check
     1286 +         * its aux vectors.  Doing so will indicate whether or not this has
     1287 +         * been given a brand root (used to qualify various other data) or a
     1288 +         * comm page (to optimize certain system actions).
     1289 +         */
     1290 +        init_auxv_data(udp);
     1291 +
     1292 +        /*
1259 1293           * We keep our uberdata on one of (a) the first alternate link map
1260 1294           * or (b) the primary link map.  We switch to the primary link map
1261 1295           * and stay there once we see it.  All intermediate link maps are
1262 1296           * subject to being unloaded at any time.
1263 1297           */
1264 1298          if (oldself != NULL && (oldself->ul_primarymap || !primary_link_map)) {
1265 1299                  __tdb_bootstrap = oldself->ul_uberdata->tdb_bootstrap;
1266 1300                  mutex_setup();
1267 1301                  atfork_init();  /* every link map needs atfork() processing */
1268 1302                  init_progname();
↓ open down ↓ 1575 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX