Print this page
2976 remove useless offsetof() macros


  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ifndef _MISC_H
  28 #define _MISC_H
  29 
  30 #pragma ident   "%Z%%M% %I%     %E% SMI"
  31 
  32 #include <sys/types.h>
  33 #include <sys/time.h>
  34 #include <thread.h>
  35 #include <pthread.h>
  36 #include <stdarg.h>

  37 
  38 #ifdef  __cplusplus
  39 extern "C" {
  40 #endif
  41 
  42 extern uint_t umem_abort;               /* abort when errors occur */
  43 extern uint_t umem_output;              /* output error messages to stderr */
  44 extern caddr_t umem_min_stack;          /* max stack address for audit log */
  45 extern caddr_t umem_max_stack;          /* min stack address for audit log */
  46 
  47 /*
  48  * various utility functions
  49  * These are globally implemented.
  50  */
  51 
  52 #undef  offsetof
  53 #define offsetof(s, m)  ((size_t)(&(((s *)0)->m)))
  54 
  55 /*
  56  * a safe printf  -- do not use for error messages.
  57  */
  58 void debug_printf(const char *format, ...);
  59 
  60 /*
  61  * adds a message to the log without writing it out.
  62  */
  63 void log_message(const char *format, ...);
  64 
  65 /*
  66  * returns the index of the (high/low) bit + 1
  67  */
  68 int highbit(ulong_t);
  69 int lowbit(ulong_t);
  70 #pragma no_side_effect(highbit, lowbit)
  71 
  72 /*
  73  * Converts a hrtime_t to a timestruc_t
  74  */
  75 void hrt2ts(hrtime_t hrt, timestruc_t *tsp);




  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ifndef _MISC_H
  28 #define _MISC_H
  29 


  30 #include <sys/types.h>
  31 #include <sys/time.h>
  32 #include <thread.h>
  33 #include <pthread.h>
  34 #include <stdarg.h>
  35 #include <stddef.h>
  36 
  37 #ifdef  __cplusplus
  38 extern "C" {
  39 #endif
  40 
  41 extern uint_t umem_abort;               /* abort when errors occur */
  42 extern uint_t umem_output;              /* output error messages to stderr */
  43 extern caddr_t umem_min_stack;          /* max stack address for audit log */
  44 extern caddr_t umem_max_stack;          /* min stack address for audit log */
  45 
  46 /*








  47  * a safe printf  -- do not use for error messages.
  48  */
  49 void debug_printf(const char *format, ...);
  50 
  51 /*
  52  * adds a message to the log without writing it out.
  53  */
  54 void log_message(const char *format, ...);
  55 
  56 /*
  57  * returns the index of the (high/low) bit + 1
  58  */
  59 int highbit(ulong_t);
  60 int lowbit(ulong_t);
  61 #pragma no_side_effect(highbit, lowbit)
  62 
  63 /*
  64  * Converts a hrtime_t to a timestruc_t
  65  */
  66 void hrt2ts(hrtime_t hrt, timestruc_t *tsp);