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


  29 #include <strings.h>
  30 #include <stdio.h>
  31 #include <unistd.h>
  32 #include <sys/wait.h>
  33 #include <sys/stat.h>
  34 #include <fcntl.h>
  35 #include <fm/fmd_log.h>
  36 #include <sys/fm/protocol.h>
  37 #include <fm/libtopo.h>
  38 #include <fm/fmd_adm.h>
  39 #include <fm/fmd_msg.h>
  40 #include <dlfcn.h>
  41 #include <sys/systeminfo.h>
  42 #include <sys/utsname.h>
  43 #include <libintl.h>
  44 #include <locale.h>
  45 #include <sys/smbios.h>
  46 #include <libdevinfo.h>
  47 #include <stdlib.h>
  48 



  49 #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))

  50 
  51 /*
  52  * Fault records are added to catalog by calling add_fault_record_to_catalog()
  53  * records are stored in order of importance to the system.
  54  * If -g flag is set or not_suppressed is not set and the class fru, fault,
  55  * type are the same then details are merged into an existing record, with uuid
  56  * records are stored in time order.
  57  * For each record information is extracted from nvlist and merged into linked
  58  * list each is checked for identical records for which percentage certainty are
  59  * added together.
  60  * print_catalog() is called to print out catalog and release external resources
  61  *
  62  *                         /---------------\
  63  *      status_rec_list -> |               | -|
  64  *                         \---------------/
  65  *                                \/
  66  *                         /---------------\    /-------\    /-------\
  67  *      status_fru_list    | status_record | -> | uurec | -> | uurec | -|
  68  *            \/           |               | |- |       | <- |       |
  69  *      /-------------\    |               |    \-------/    \-------/




  29 #include <strings.h>
  30 #include <stdio.h>
  31 #include <unistd.h>
  32 #include <sys/wait.h>
  33 #include <sys/stat.h>
  34 #include <fcntl.h>
  35 #include <fm/fmd_log.h>
  36 #include <sys/fm/protocol.h>
  37 #include <fm/libtopo.h>
  38 #include <fm/fmd_adm.h>
  39 #include <fm/fmd_msg.h>
  40 #include <dlfcn.h>
  41 #include <sys/systeminfo.h>
  42 #include <sys/utsname.h>
  43 #include <libintl.h>
  44 #include <locale.h>
  45 #include <sys/smbios.h>
  46 #include <libdevinfo.h>
  47 #include <stdlib.h>
  48 
  49 #if defined(__GNUC__)
  50 #define offsetof(s, m)  __builtin_offsetof(s, m)
  51 #else
  52 #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))
  53 #endif
  54 
  55 /*
  56  * Fault records are added to catalog by calling add_fault_record_to_catalog()
  57  * records are stored in order of importance to the system.
  58  * If -g flag is set or not_suppressed is not set and the class fru, fault,
  59  * type are the same then details are merged into an existing record, with uuid
  60  * records are stored in time order.
  61  * For each record information is extracted from nvlist and merged into linked
  62  * list each is checked for identical records for which percentage certainty are
  63  * added together.
  64  * print_catalog() is called to print out catalog and release external resources
  65  *
  66  *                         /---------------\
  67  *      status_rec_list -> |               | -|
  68  *                         \---------------/
  69  *                                \/
  70  *                         /---------------\    /-------\    /-------\
  71  *      status_fru_list    | status_record | -> | uurec | -> | uurec | -|
  72  *            \/           |               | |- |       | <- |       |
  73  *      /-------------\    |               |    \-------/    \-------/