FreeBSD kernel kern code
#include <sys/cdefs.h>
#include <sys/ctype.h>
#include <sys/errno.h>
#include <sys/fail.h>
#include <sys/kernel.h>
#include <sys/libkern.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/sbuf.h>
#include <machine/stdarg.h>
Include dependency graph for kern_fail.c:

Go to the source code of this file.

Data Structures

struct  fail_point_entry
 

Macros

#define fp_free(ptr)   free(ptr, M_FAIL_POINT)
 
#define fp_malloc(size, flags)   malloc((size), M_FAIL_POINT, (flags))
 
#define FP_LOCK()   mtx_lock(&g_fp_mtx)
 
#define FP_UNLOCK()   mtx_unlock(&g_fp_mtx)
 
#define FP_TYPE_NM_LEN(s)   { s, sizeof(s) - 1 }
 
#define MAX_FAIL_POINT_BUF   1023
 
#define PID_STRING   "[pid "
 

Enumerations

enum  fail_point_t {
  FAIL_POINT_OFF, FAIL_POINT_PANIC, FAIL_POINT_RETURN, FAIL_POINT_BREAK,
  FAIL_POINT_PRINT, FAIL_POINT_SLEEP, FAIL_POINT_NUMTYPES
}
 
enum  { PROB_MAX = 1000000, PROB_DIGITS = 6 }
 

Functions

 __FBSDID ("$BSDSUniX$")
 
static MALLOC_DEFINE (M_FAIL_POINT,"Fail Points","fail points system")
 
 MTX_SYSINIT (g_fp_mtx,&g_fp_mtx,"fail point mtx", MTX_DEF)
 
static void fail_point_sleep (struct fail_point *fp, struct fail_point_entry *ent, int msecs, enum fail_point_return_code *pret)
 
static char * parse_fail_point (struct fail_point_entries *, char *)
 
static char * parse_term (struct fail_point_entries *, char *)
 
static char * parse_number (int *out_units, int *out_decimal, char *)
 
static char * parse_type (struct fail_point_entry *, char *)
 
static void free_entry (struct fail_point_entries *, struct fail_point_entry *)
 
static void clear_entries (struct fail_point_entries *)
 
void fail_point_init (struct fail_point *fp, const char *fmt,...)
 
void fail_point_destroy (struct fail_point *fp)
 
enum fail_point_return_code fail_point_eval_nontrivial (struct fail_point *fp, int *return_value)
 
static void fail_point_get (struct fail_point *fp, struct sbuf *sb)
 
static int fail_point_set (struct fail_point *fp, char *buf)
 
int fail_point_sysctl (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_NODE (_debug, OID_AUTO, fail_point, CTLFLAG_RW, 0,"fail points")
 

Variables

static struct mtx g_fp_mtx
 
struct {
   const char *   name
 
   int   nmlen
 
fail_type_strings []
 

Detailed Description

fail(9) Facility.

Definition in file kern_fail.c.

Macro Definition Documentation

#define FP_TYPE_NM_LEN (   s)    { s, sizeof(s) - 1 }
#define PID_STRING   "[pid "

Referenced by parse_term().