Print this page
3373 gcc >= 4.5 concerns about offsetof()


2400                 sv_no_threads++;
2401         } else {
2402                 nlive = nst_nlive(sv_tset);
2403                 if (nlive > sv_max_nlive) {
2404                         if (sv_debug > 0) {
2405                                 cmn_err(CE_CONT,
2406                                     "!sv_lyr_strategy: "
2407                                     "new max nlive %d (nthread %d)\n",
2408                                     nlive, nst_nthread(sv_tset));
2409                         }
2410 
2411                         sv_max_nlive = nlive;
2412                 }
2413         }
2414 
2415         return (0);
2416 }
2417 
2418 
2419 #ifndef offsetof
2420 #define offsetof(s, m)  ((size_t)(&((s *)0)->m))




2421 #endif
2422 
2423 /*
2424  * re-write the size of the current partition
2425  */
2426 static int
2427 sv_fix_dkiocgvtoc(const intptr_t arg, const int mode, sv_dev_t *svp)
2428 {
2429         size_t offset;
2430         int ilp32;
2431         int pnum;
2432         int rc;
2433 
2434         ilp32 = (ddi_model_convert_from((mode & FMODELS)) == DDI_MODEL_ILP32);
2435 
2436         rc = nskern_partition(svp->sv_dev, &pnum);
2437         if (rc != 0) {
2438                 return (rc);
2439         }
2440 




2400                 sv_no_threads++;
2401         } else {
2402                 nlive = nst_nlive(sv_tset);
2403                 if (nlive > sv_max_nlive) {
2404                         if (sv_debug > 0) {
2405                                 cmn_err(CE_CONT,
2406                                     "!sv_lyr_strategy: "
2407                                     "new max nlive %d (nthread %d)\n",
2408                                     nlive, nst_nthread(sv_tset));
2409                         }
2410 
2411                         sv_max_nlive = nlive;
2412                 }
2413         }
2414 
2415         return (0);
2416 }
2417 
2418 
2419 #ifndef offsetof
2420 #if defined(__GNUC__)
2421 #define offsetof(s, m)  __builtin_offsetof(s, m)
2422 #else
2423 #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))
2424 #endif
2425 #endif
2426 
2427 /*
2428  * re-write the size of the current partition
2429  */
2430 static int
2431 sv_fix_dkiocgvtoc(const intptr_t arg, const int mode, sv_dev_t *svp)
2432 {
2433         size_t offset;
2434         int ilp32;
2435         int pnum;
2436         int rc;
2437 
2438         ilp32 = (ddi_model_convert_from((mode & FMODELS)) == DDI_MODEL_ILP32);
2439 
2440         rc = nskern_partition(svp->sv_dev, &pnum);
2441         if (rc != 0) {
2442                 return (rc);
2443         }
2444