Print this page
2976 remove useless offsetof() macros


  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /*
  27  * poolstat - report active pool statistics
  28  */
  29 #include <stdio.h>
  30 #include <unistd.h>
  31 #include <stdlib.h>
  32 #include <unistd.h>
  33 #include <locale.h>
  34 #include <string.h>
  35 #include <ctype.h>
  36 #include <limits.h>
  37 #include <errno.h>

  38 
  39 #include <pool.h>
  40 #include "utils.h"
  41 #include "poolstat.h"
  42 #include "poolstat_utils.h"
  43 #include "statcommon.h"
  44 
  45 #ifndef TEXT_DOMAIN
  46 #define TEXT_DOMAIN     "SYS_TEST"
  47 #endif
  48 
  49 /* calculate offset of a particular element in a structure      */
  50 #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))
  51 #define addrof(s)  ((char **)&(s))
  52 
  53 /* verify if a field is printable in respect of the current option flags */
  54 #define PRINTABLE(i)    ((lf->plf_ffs[(i)].pff_prt & D_FIELD) || \
  55         (lf->plf_ffs[(i)].pff_prt & X_FIELD))
  56 
  57 typedef int (* formatter) (char *, int, int, poolstat_field_format_t *, char *);
  58 
  59 static uint_t timestamp_fmt = NODATE;
  60 
  61 /* available field formatters   */
  62 static int default_f(char *, int, int, poolstat_field_format_t *, char *);
  63 static int bigno_f(char *, int, int, poolstat_field_format_t *, char *);
  64 static int used_stat_f(char *, int, int, poolstat_field_format_t *, char *);
  65 static int header_f(char *, int, int, poolstat_field_format_t *, char *);
  66 
  67 /* statistics bags used to collect data from various provider   */
  68 static statistic_bag_t  pool_sbag_s;
  69 static statistic_bag_t  pset_sbag_s;
  70 static statistic_bag_t  *pool_sbag = &pool_sbag_s;




  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /*
  27  * poolstat - report active pool statistics
  28  */
  29 #include <stdio.h>
  30 #include <unistd.h>
  31 #include <stdlib.h>
  32 #include <unistd.h>
  33 #include <locale.h>
  34 #include <string.h>
  35 #include <ctype.h>
  36 #include <limits.h>
  37 #include <errno.h>
  38 #include <stddef.h>
  39 
  40 #include <pool.h>
  41 #include "utils.h"
  42 #include "poolstat.h"
  43 #include "poolstat_utils.h"
  44 #include "statcommon.h"
  45 
  46 #ifndef TEXT_DOMAIN
  47 #define TEXT_DOMAIN     "SYS_TEST"
  48 #endif
  49 


  50 #define addrof(s)  ((char **)&(s))
  51 
  52 /* verify if a field is printable in respect of the current option flags */
  53 #define PRINTABLE(i)    ((lf->plf_ffs[(i)].pff_prt & D_FIELD) || \
  54         (lf->plf_ffs[(i)].pff_prt & X_FIELD))
  55 
  56 typedef int (* formatter) (char *, int, int, poolstat_field_format_t *, char *);
  57 
  58 static uint_t timestamp_fmt = NODATE;
  59 
  60 /* available field formatters   */
  61 static int default_f(char *, int, int, poolstat_field_format_t *, char *);
  62 static int bigno_f(char *, int, int, poolstat_field_format_t *, char *);
  63 static int used_stat_f(char *, int, int, poolstat_field_format_t *, char *);
  64 static int header_f(char *, int, int, poolstat_field_format_t *, char *);
  65 
  66 /* statistics bags used to collect data from various provider   */
  67 static statistic_bag_t  pool_sbag_s;
  68 static statistic_bag_t  pset_sbag_s;
  69 static statistic_bag_t  *pool_sbag = &pool_sbag_s;