Motr  M0
misc.h File Reference

Go to the source code of this file.

Macros

#define __MOTR_LIB_USER_SPACE_MISC_H__
 
#define offsetof(typ, memb)   __builtin_offsetof(typ, memb)
 
#define container_of(ptr, type, member)   ((type *)((char *)(ptr)-(char *)(&((type *)0)->member)))
 
#define NULL   ((void *)0)
 
#define ARRAY_SIZE(a)   ((sizeof (a)) / (sizeof (a)[0]))
 

Functions

M0_INTERNAL int m0_host_resolve (const char *name, char *buf, size_t bufsiz)
 
M0_INTERNAL void m0_performance_counters (char *buf, size_t buf_len)
 

Macro Definition Documentation

◆ __MOTR_LIB_USER_SPACE_MISC_H__

#define __MOTR_LIB_USER_SPACE_MISC_H__

Definition at line 26 of file misc.h.

◆ ARRAY_SIZE

#define ARRAY_SIZE (   a)    ((sizeof (a)) / (sizeof (a)[0]))

size of array

Definition at line 45 of file misc.h.

◆ container_of

#define container_of (   ptr,
  type,
  member 
)    ((type *)((char *)(ptr)-(char *)(&((type *)0)->member)))

Definition at line 33 of file misc.h.

◆ NULL

#define NULL   ((void *)0)

Definition at line 38 of file misc.h.

◆ offsetof

#define offsetof (   typ,
  memb 
)    __builtin_offsetof(typ, memb)

Definition at line 29 of file misc.h.

Function Documentation

◆ m0_host_resolve()

M0_INTERNAL int m0_host_resolve ( const char *  name,
char *  buf,
size_t  bufsiz 
)

Resolve hostname.

Resolve a hostname to a stringified IP address

Definition at line 49 of file umisc.c.

Here is the call graph for this function:

◆ m0_performance_counters()

M0_INTERNAL void m0_performance_counters ( char *  buf,
size_t  buf_len 
)

Print performance counters: getrusage(), /proc/self/io.

All errors (can't open file etc.) are silently ignored.

Definition at line 82 of file umisc.c.

Here is the call graph for this function:
Here is the caller graph for this function: