text:
#ifndef _SYS_SYSCTL_H_
#define _SYS_SYSCTL_H_

#include <sys/queue.h>

// Extra include for compatibility
#include <sys/time.h>

struct thread;
/*
 * Definitions for sysctl call.  The sysctl call uses a hierarchical name
 * for objects that can be examined or modified.  The name is expressed as
 * a sequence of integers.  Like a file path name, the meaning of each
 * component depends on its place in the hierarchy.  The top-level and kern
 * identifiers are defined here, and other identifiers are defined in the
 * respective subsystem header files.
 */

#define CTL_MAXNAME 24  /* largest number of components supported */

/*
 * Each subsystem defined by sysctl defines a list of variables
 * for that subsystem. Each name is either a node with further
 * levels defined below it, or it is a leaf of some particular
 * type given below. Each sysctl level defines a set of name/type
 * pairs to be used by sysctl(8) in manipulating the subsystem.
 */
struct ctlname {
    char    *ctl_name;  /* subsystem name */
    int  ctl_type;  /* type of name */
};

#define CTLTYPE     0xf /* mask for the type */
#define CTLTYPE_NODE    1   /* name is a node */
#define CTLTYPE_INT 2   /* name describes an integer */
#define CTLTYPE_STRING  3   /* name describes a string */
#define CTLTYPE_S64 4   /* name describes a signed 64-bit number */
#define CTLTYPE_OPAQUE  5   /* name describes a structure */
#define CTLTYPE_STRUCT  CTLTYPE_OPAQUE  /* name describes a structure */
#define CTLTYPE_UINT    6   /* name describes an unsigned integer */
#define CTLTYPE_LONG    7   /* name describes a long */
#define CTLTYPE_ULONG   8   /* name describes an unsigned long */
#define CTLTYPE_U64 9   /* name describes an unsigned 64-bit number */

#define CTLFLAG_RD  0x80000000  /* Allow reads of variable */
#define CTLFLAG_WR  0x40000000  /* Allow writes to the variable */
#define CTLFLAG_RW  (CTLFLAG_RD|CTLFLAG_WR)
#define CTLFLAG_ANYBODY 0x10000000  /* All users can set this var */
#define CTLFLAG_SECURE  0x08000000  /* Permit set only if securelevel<=0 */
#define CTLFLAG_PRISON  0x04000000  /* Prisoned roots can fiddle */
#define CTLFLAG_DYN 0x02000000  /* Dynamic oid - can be freed */
#define CTLFLAG_SKIP    0x01000000  /* Skip this sysctl when listing */
#define CTLMASK_SECURE  0x00F00000  /* Secure level */
#define CTLFLAG_TUN 0x00080000  /* Default value is loaded from getenv() */
#define CTLFLAG_RDTUN   (CTLFLAG_RD|CTLFLAG_TUN)
#define CTLFLAG_RWTUN   (CTLFLAG_RW|CTLFLAG_TUN)
#define CTLFLAG_MPSAFE  0x00040000  /* Handler is MP safe */
#define CTLFLAG_VNET    0x00020000  /* Prisons with vnet can fiddle */
#define CTLFLAG_DYING   0x00010000  /* Oid is being removed */
#define CTLFLAG_CAPRD   0x00008000  /* Can be read in capability mode */
#define CTLFLAG_CAPWR   0x00004000  /* Can be written in capability mode */
#define CTLFLAG_STATS   0x00002000  /* Statistics, not a tuneable */
#define CTLFLAG_NOFETCH 0x00001000  /* Don't fetch tunable from getenv() */
#define CTLFLAG_CAPRW   (CTLFLAG_CAPRD|CTLFLAG_CAPWR)

/*
 * Secure level.   Note that CTLFLAG_SECURE == CTLFLAG_SECURE1.
 *
 * Secure when the securelevel is raised to at least N.
 */
#define CTLSHIFT_SECURE 20
#define CTLFLAG_SECURE1 (CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE))
#define CTLFLAG_SECURE2 (CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE))
#define CTLFLAG_SECURE3 (CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE))

/*
 * USE THIS instead of a hardwired number from the categories below
 * to get dynamically assigned sysctl entries using the linker-set
 * technology. This is the way nearly all new sysctl variables should
 * be implemented.
 * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
 */
#define OID_AUTO    (-1)

/*
 * The starting number for dynamically-assigned entries.  WARNING!
 * ALL static sysctl entries should have numbers LESS than this!
 */
#define CTL_AUTO_START  0x100

#ifdef _KERNEL
#include <sys/linker_set.h>

#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1,    \
    intptr_t arg2, struct sysctl_req *req

/* definitions for sysctl_req 'lock' member */
#define REQ_UNWIRED 1
#define REQ_WIRED   2

/* definitions for sysctl_req 'flags' member */
#if defined(__amd64__) || defined(__powerpc64__) ||\
    (defined(__mips__) && defined(__mips_n64))
#define SCTL_MASK32 1   /* 32 bit emulation */
#endif

/*
 * This describes the access space for a sysctl request.  This is needed
 * so that we can use the interface from the kernel or from user-space.
 */
struct sysctl_req {
    struct thread   *td;        /* used for access checking */
    int      lock;      /* wiring state */
    void        *oldptr;
    size_t       oldlen;
    size_t       oldidx;
    int     (*oldfunc)(struct sysctl_req *, const void *, size_t);
    void        *newptr;
    size_t       newlen;
    size_t       newidx;
    int     (*newfunc)(struct sysctl_req *, void *, size_t);
    size_t       validlen;
    int      flags;
};

SLIST_HEAD(sysctl_oid_list, sysctl_oid);

/*
 * This describes one "oid" in the MIB tree.  Potentially more nodes can
 * be hidden behind it, expanded by the handler.
 */
struct sysctl_oid {
    struct sysctl_oid_list oid_children;
    struct sysctl_oid_list *oid_parent;
    SLIST_ENTRY(sysctl_oid) oid_link;
    int      oid_number;
    u_int        oid_kind;
    void        *oid_arg1;
    intptr_t     oid_arg2;
    const char  *oid_name;
    int     (*oid_handler)(SYSCTL_HANDLER_ARGS);
    const char  *oid_fmt;
    int      oid_refcnt;
    u_int        oid_running;
    const char  *oid_descr;
};

#define SYSCTL_IN(r, p, l)  (r->newfunc)(r, p, l)
#define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l)

int sysctl_handle_int(SYSCTL_HANDLER_ARGS);
int sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS);
int sysctl_handle_long(SYSCTL_HANDLER_ARGS);
int sysctl_handle_64(SYSCTL_HANDLER_ARGS);
int sysctl_handle_string(SYSCTL_HANDLER_ARGS);
int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS);
int sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS);

int sysctl_handle_uma_zone_max(SYSCTL_HANDLER_ARGS);
int sysctl_handle_uma_zone_cur(SYSCTL_HANDLER_ARGS);

int sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS);
int sysctl_dpcpu_long(SYSCTL_HANDLER_ARGS);
int sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS);

/*
 * These functions are used to add/remove an oid from the mib.
 */
void sysctl_register_oid(struct sysctl_oid *oidp);
void sysctl_unregister_oid(struct sysctl_oid *oidp);

/* Declare a static oid to allow child oids to be added to it. */
#define SYSCTL_DECL(name)           \
    extern struct sysctl_oid sysctl__##name

/* Hide these in macros. */
#define SYSCTL_CHILDREN(oid_ptr)        (&(oid_ptr)->oid_children)
#define SYSCTL_PARENT(oid_ptr)                  \
    (((oid_ptr)->oid_parent != &sysctl__children) ?     \
    __containerof((oid_ptr)->oid_parent, struct sysctl_oid, \
    oid_children) : (struct sysctl_oid *)NULL)
#define SYSCTL_STATIC_CHILDREN(oid_name)    (&sysctl__##oid_name.oid_children)

/* === Structs and macros related to context handling. === */

/* All dynamically created sysctls can be tracked in a context list. */
struct sysctl_ctx_entry {
    struct sysctl_oid *entry;
    TAILQ_ENTRY(sysctl_ctx_entry) link;
};

TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);

#define SYSCTL_NODE_CHILDREN(parent, name) \
    sysctl__##parent##_##name.oid_children

/*
 * These macros provide type safety for sysctls.  SYSCTL_ALLOWED_TYPES()
 * defines a transparent union of the allowed types.  SYSCTL_ASSERT_TYPE()
 * and SYSCTL_ADD_ASSERT_TYPE() use the transparent union to assert that
 * the pointer matches the allowed types.
 *
 * The allow_0 member allows a literal 0 to be passed for ptr.
 */
#define SYSCTL_ALLOWED_TYPES(type, decls)           \
    union sysctl_##type {                   \
        long allow_0;                   \
        decls                       \
    } __attribute__((__transparent_union__));       \
                                \
    static inline void *                    \
    __sysctl_assert_##type(union sysctl_##type ptr)     \
    {                           \
        return (ptr.a);                 \
    }                           \
    struct __hack

SYSCTL_ALLOWED_TYPES(INT, int *a; );
SYSCTL_ALLOWED_TYPES(UINT, unsigned int *a; );
SYSCTL_ALLOWED_TYPES(LONG, long *a; );
SYSCTL_ALLOWED_TYPES(ULONG, unsigned long *a; );
SYSCTL_ALLOWED_TYPES(INT64, int64_t *a; long long *b; );
SYSCTL_ALLOWED_TYPES(UINT64, uint64_t *a; unsigned long long *b; );

#ifdef notyet
#define SYSCTL_ADD_ASSERT_TYPE(type, ptr)   \
    __sysctl_assert_ ## type (ptr)
#define SYSCTL_ASSERT_TYPE(type, ptr, parent, name) \
    _SYSCTL_ASSERT_TYPE(type, ptr, __LINE__, parent##_##name)
#else
#define SYSCTL_ADD_ASSERT_TYPE(type, ptr)   ptr
#define SYSCTL_ASSERT_TYPE(type, ptr, parent, name)
#endif
#define _SYSCTL_ASSERT_TYPE(t, p, l, id)        \
    __SYSCTL_ASSERT_TYPE(t, p, l, id)
#define __SYSCTL_ASSERT_TYPE(type, ptr, line, id)           \
    static inline void                      \
    sysctl_assert_##line##_##id(void)               \
    {                               \
        (void)__sysctl_assert_##type(ptr);          \
    }                               \
    struct __hack

#ifndef NO_SYSCTL_DESCR
#define __DESCR(d) d
#else
#define __DESCR(d) ""
#endif

/* This macro is only for internal use */
#define SYSCTL_OID_RAW(id, parent_child_head, nbr, name, kind, a1, a2, handler, fmt, descr) \
    struct sysctl_oid id = {                    \
        .oid_parent = (parent_child_head),          \
        .oid_children = SLIST_HEAD_INITIALIZER(&id.oid_children), \
        .oid_number = (nbr),                    \
        .oid_kind = (kind),                 \
        .oid_arg1 = (a1),                   \
        .oid_arg2 = (a2),                   \
        .oid_name = (name),                 \
        .oid_handler = (handler),               \
        .oid_fmt = (fmt),                   \
        .oid_descr = __DESCR(descr)             \
    };                              \
    DATA_SET(sysctl_set, id)

/* This constructs a static "raw" MIB oid. */
#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
    static SYSCTL_OID_RAW(sysctl__##parent##_##name, \
    SYSCTL_CHILDREN(&sysctl__##parent), \
    nbr, #name, kind, a1, a2, handler, fmt, descr)

/* This constructs a global "raw" MIB oid. */
#define SYSCTL_OID_GLOBAL(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
    SYSCTL_OID_RAW(sysctl__##parent##_##name, \
    SYSCTL_CHILDREN(&sysctl__##parent), \
    nbr, #name, kind, a1, a2, handler, fmt, descr)

#define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
    sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, __DESCR(descr))

/* This constructs a root node from which other nodes can hang. */
#define SYSCTL_ROOT_NODE(nbr, name, access, handler, descr) \
    SYSCTL_OID_RAW(sysctl___##name, &sysctl__children,  \
        nbr, #name, CTLTYPE_NODE|(access), NULL, 0, \
        handler, "N", descr)

/* This constructs a node from which other oids can hang. */
#define SYSCTL_NODE(parent, nbr, name, access, handler, descr)          \
    SYSCTL_OID_GLOBAL(parent, nbr, name, CTLTYPE_NODE|(access),     \
        NULL, 0, handler, "N", descr)

#define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr)     \
    sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access),       \
    NULL, 0, handler, "N", __DESCR(descr))

#define SYSCTL_ADD_ROOT_NODE(ctx, nbr, name, access, handler, descr)    \
    sysctl_add_oid(ctx, &sysctl__children, nbr, name,       \
        CTLTYPE_NODE|(access), NULL, 0, handler, "N", __DESCR(descr))

/* Oid for a string.  len can be 0 to indicate '\0' termination. */
#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \
    SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \
        arg, len, sysctl_handle_string, "A", descr)

#define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr)  \
    sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access),     \
    arg, len, sysctl_handle_string, "A", __DESCR(descr))

/* Oid for an int.  If ptr is NULL, val is returned. */
#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr)      \
    SYSCTL_ASSERT_TYPE(INT, ptr, parent, name);         \
    SYSCTL_OID(parent, nbr, name,                   \
        CTLTYPE_INT | CTLFLAG_MPSAFE | (access),            \
        ptr, val, sysctl_handle_int, "I", descr)

#define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr) \
    sysctl_add_oid(ctx, parent, nbr, name,              \
        CTLTYPE_INT | CTLFLAG_MPSAFE | (access),            \
        SYSCTL_ADD_ASSERT_TYPE(INT, ptr), val,          \
        sysctl_handle_int, "I", __DESCR(descr))

/* Oid for an unsigned int.  If ptr is NULL, val is returned. */
#define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr)     \
    SYSCTL_ASSERT_TYPE(UINT, ptr, parent, name);            \
    SYSCTL_OID(parent, nbr, name,                   \
        CTLTYPE_UINT | CTLFLAG_MPSAFE | (access),           \
        ptr, val, sysctl_handle_int, "IU", descr)

#define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \
    sysctl_add_oid(ctx, parent, nbr, name,              \
        CTLTYPE_UINT | CTLFLAG_MPSAFE | (access),           \
        SYSCTL_ADD_ASSERT_TYPE(UINT, ptr), val,         \
        sysctl_handle_int, "IU", __DESCR(descr))

/* Oid for a long.  The pointer must be non NULL. */
#define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr)     \
    SYSCTL_ASSERT_TYPE(LONG, ptr, parent, name);            \
    SYSCTL_OID(parent, nbr, name,                   \
        CTLTYPE_LONG | CTLFLAG_MPSAFE | (access),           \
        ptr, val, sysctl_handle_long, "L", descr)

#define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr) \
    sysctl_add_oid(ctx, parent, nbr, name,              \
        CTLTYPE_LONG | CTLFLAG_MPSAFE | (access),           \
        SYSCTL_ADD_ASSERT_TYPE(LONG, ptr), 0,           \
        sysctl_handle_long, "L", __DESCR(descr))

/* Oid for an unsigned long.  The pointer must be non NULL. */
#define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr)    \
    SYSCTL_ASSERT_TYPE(ULONG, ptr, parent, name);           \
    SYSCTL_OID(parent, nbr, name,                   \
        CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access),          \
        ptr, val, sysctl_handle_long, "LU", descr)

#define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr)    \
    sysctl_add_oid(ctx, parent, nbr, name,              \
        CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access),          \
        SYSCTL_ADD_ASSERT_TYPE(ULONG, ptr), 0,          \
        sysctl_handle_long, "LU", __DESCR(descr))

/* Oid for a quad.  The pointer must be non NULL. */
#define SYSCTL_QUAD(parent, nbr, name, access, ptr, val, descr)     \
    SYSCTL_ASSERT_TYPE(INT64, ptr, parent, name);           \
    SYSCTL_OID(parent, nbr, name,                   \
        CTLTYPE_S64 | CTLFLAG_MPSAFE | (access),            \
        ptr, val, sysctl_handle_64, "Q", descr)

#define SYSCTL_ADD_QUAD(ctx, parent, nbr, name, access, ptr, descr) \
    sysctl_add_oid(ctx, parent, nbr, name,              \
        CTLTYPE_S64 | CTLFLAG_MPSAFE | (access),            \
        SYSCTL_ADD_ASSERT_TYPE(INT64, ptr), 0,          \
        sysctl_handle_64, "Q", __DESCR(descr))

#define SYSCTL_UQUAD(parent, nbr, name, access, ptr, val, descr)    \
    SYSCTL_ASSERT_TYPE(UINT64, ptr, parent, name);          \
    SYSCTL_OID(parent, nbr, name,                   \
        CTLTYPE_U64 | CTLFLAG_MPSAFE | (access),            \
        ptr, val, sysctl_handle_64, "QU", descr)

#define SYSCTL_ADD_UQUAD(ctx, parent, nbr, name, access, ptr, descr)    \
    sysctl_add_oid(ctx, parent, nbr, name,              \
        CTLTYPE_U64 | CTLFLAG_MPSAFE | (access),            \
        SYSCTL_ADD_ASSERT_TYPE(UINT64, ptr), 0,         \
        sysctl_handle_64, "QU", __DESCR(descr))

/* Oid for a 64-bit unsigned counter(9).  The pointer must be non NULL. */
#define SYSCTL_COUNTER_U64(parent, nbr, name, access, ptr, descr)   \
    SYSCTL_ASSERT_TYPE(UINT64, ptr, parent, name);          \
    SYSCTL_OID(parent, nbr, name,                   \
        CTLTYPE_U64 | CTLFLAG_MPSAFE | (access),            \
        ptr, 0, sysctl_handle_counter_u64, "QU", descr)

#define SYSCTL_ADD_COUNTER_U64(ctx, parent, nbr, name, access, ptr, descr)\
    sysctl_add_oid(ctx, parent, nbr, name,              \
        CTLTYPE_U64 | CTLFLAG_MPSAFE | (access),            \
        SYSCTL_ADD_ASSERT_TYPE(UINT64, ptr), 0,         \
        sysctl_handle_counter_u64, "QU", __DESCR(descr))

/* Oid for an opaque object.  Specified by a pointer and a length. */
#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
    SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
        ptr, len, sysctl_handle_opaque, fmt, descr)

#define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr)\
    sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access),     \
    ptr, len, sysctl_handle_opaque, fmt, __DESCR(descr))

/* Oid for a struct.  Specified by a pointer and a type. */
#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \
    SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
        ptr, sizeof(struct type), sysctl_handle_opaque, \
        "S," #type, descr)

#define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \
    sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access),     \
    ptr, sizeof(struct type), sysctl_handle_opaque, "S," #type, __DESCR(descr))

/* Oid for a procedure.  Specified by a pointer and an arg. */
#define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
    CTASSERT(((access) & CTLTYPE) != 0);                \
    SYSCTL_OID(parent, nbr, name, (access), \
        ptr, arg, handler, fmt, descr)

#define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
    sysctl_add_oid(ctx, parent, nbr, name, (access),                \
    ptr, arg, handler, fmt, __DESCR(descr))

/* Oid to handle limits on uma(9) zone specified by pointer. */
#define SYSCTL_UMA_MAX(parent, nbr, name, access, ptr, descr)       \
    SYSCTL_ASSERT_TYPE(INT, ptr, parent, name);         \
    SYSCTL_OID(parent, nbr, name,                   \
        CTLTYPE_INT | CTLFLAG_MPSAFE | (access),            \
        ptr, 0, sysctl_handle_uma_zone_max, "I", descr)
#define SYSCTL_ADD_UMA_MAX(ctx, parent, nbr, name, access, ptr, descr)\
    sysctl_add_oid(ctx, parent, nbr, name,              \
        CTLTYPE_INT | CTLFLAG_MPSAFE | (access),            \
        SYSCTL_ADD_ASSERT_TYPE(INT, ptr), 0,            \
        sysctl_handle_uma_zone_max, "I", __DESCR(descr))

/* Oid to obtain current use of uma(9) zone specified by pointer. */
#define SYSCTL_UMA_CUR(parent, nbr, name, access, ptr, descr)       \
    SYSCTL_ASSERT_TYPE(INT, ptr, parent, name);         \
    SYSCTL_OID(parent, nbr, name,                   \
        CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access),   \
        ptr, 0, sysctl_handle_uma_zone_cur, "I", descr)
#define SYSCTL_ADD_UMA_CUR(ctx, parent, nbr, name, access, ptr, descr)  \
    sysctl_add_oid(ctx, parent, nbr, name,              \
        CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access),   \
        SYSCTL_ADD_ASSERT_TYPE(INT, ptr), 0,            \
        sysctl_handle_uma_zone_cur, "I", __DESCR(descr))

/*
 * A macro to generate a read-only sysctl to indicate the presense of optional
 * kernel features.
 */
#define FEATURE(name, desc)                     \
    SYSCTL_INT(_kern_features, OID_AUTO, name, CTLFLAG_RD | CTLFLAG_CAPRD, \
        NULL, 1, desc)

#endif /* _KERNEL */

/*
 * Top-level identifiers
 */
#define CTL_UNSPEC  0       /* unused */
#define CTL_KERN    1       /* "high kernel": proc, limits */
#define CTL_VM      2       /* virtual memory */
#define CTL_VFS     3       /* filesystem, mount type is next */
#define CTL_NET     4       /* network, see socket.h */
#define CTL_DEBUG   5       /* debugging parameters */
#define CTL_HW      6       /* generic cpu/io */
#define CTL_MACHDEP 7       /* machine dependent */
#define CTL_USER    8       /* user-level */
#define CTL_P1003_1B    9       /* POSIX 1003.1B */

/*
 * CTL_KERN identifiers
 */
#define KERN_OSTYPE      1  /* string: system version */
#define KERN_OSRELEASE       2  /* string: system release */
#define KERN_OSREV       3  /* int: system revision */
#define KERN_VERSION         4  /* string: compile time info */
#define KERN_MAXVNODES       5  /* int: max vnodes */
#define KERN_MAXPROC         6  /* int: max processes */
#define KERN_MAXFILES        7  /* int: max open files */
#define KERN_ARGMAX      8  /* int: max arguments to exec */
#define KERN_SECURELVL       9  /* int: system security level */
#define KERN_HOSTNAME       10  /* string: hostname */
#define KERN_HOSTID     11  /* int: host identifier */
#define KERN_CLOCKRATE      12  /* struct: struct clockrate */
#define KERN_VNODE      13  /* struct: vnode structures */
#define KERN_PROC       14  /* struct: process entries */
#define KERN_FILE       15  /* struct: file entries */
#define KERN_PROF       16  /* node: kernel profiling info */
#define KERN_POSIX1     17  /* int: POSIX.1 version */
#define KERN_NGROUPS        18  /* int: # of supplemental group ids */
#define KERN_JOB_CONTROL    19  /* int: is job control available */
#define KERN_SAVED_IDS      20  /* int: saved set-user/group-ID */
#define KERN_BOOTTIME       21  /* struct: time kernel was booted */
#define KERN_NISDOMAINNAME  22  /* string: YP domain name */
#define KERN_UPDATEINTERVAL 23  /* int: update process sleep time */
#define KERN_OSRELDATE      24  /* int: kernel release date */
#define KERN_NTP_PLL        25  /* node: NTP PLL control */
#define KERN_BOOTFILE       26  /* string: name of booted kernel */
#define KERN_MAXFILESPERPROC    27  /* int: max open files per proc */
#define KERN_MAXPROCPERUID  28  /* int: max processes per uid */
#define KERN_DUMPDEV        29  /* struct cdev *: device to dump on */
#define KERN_IPC        30  /* node: anything related to IPC */
#define KERN_DUMMY      31  /* unused */
#define KERN_PS_STRINGS     32  /* int: address of PS_STRINGS */
#define KERN_USRSTACK       33  /* int: address of USRSTACK */
#define KERN_LOGSIGEXIT     34  /* int: do we log sigexit procs? */
#define KERN_IOV_MAX        35  /* int: value of UIO_MAXIOV */
#define KERN_HOSTUUID       36  /* string: host UUID identifier */
#define KERN_ARND       37  /* int: from arc4rand() */
/*
 * KERN_PROC subtypes
 */
#define KERN_PROC_ALL       0   /* everything */
#define KERN_PROC_PID       1   /* by process id */
#define KERN_PROC_PGRP      2   /* by process group id */
#define KERN_PROC_SESSION   3   /* by session of pid */
#define KERN_PROC_TTY       4   /* by controlling tty */
#define KERN_PROC_UID       5   /* by effective uid */
#define KERN_PROC_RUID      6   /* by real uid */
#define KERN_PROC_ARGS      7   /* get/set arguments/proctitle */
#define KERN_PROC_PROC      8   /* only return procs */
#define KERN_PROC_SV_NAME   9   /* get syscall vector name */
#define KERN_PROC_RGID      10  /* by real group id */
#define KERN_PROC_GID       11  /* by effective group id */
#define KERN_PROC_PATHNAME  12  /* path to executable */
#define KERN_PROC_OVMMAP    13  /* Old VM map entries for process */
#define KERN_PROC_OFILEDESC 14  /* Old file descriptors for process */
#define KERN_PROC_KSTACK    15  /* Kernel stacks for process */
#define KERN_PROC_INC_THREAD    0x10    /*
                     * modifier for pid, pgrp, tty,
                     * uid, ruid, gid, rgid and proc
                     * This effectively uses 16-31
                     */
#define KERN_PROC_VMMAP     32  /* VM map entries for process */
#define KERN_PROC_FILEDESC  33  /* File descriptors for process */
#define KERN_PROC_GROUPS    34  /* process groups */
#define KERN_PROC_ENV       35  /* get environment */
#define KERN_PROC_AUXV      36  /* get ELF auxiliary vector */
#define KERN_PROC_RLIMIT    37  /* process resource limits */
#define KERN_PROC_PS_STRINGS    38  /* get ps_strings location */
#define KERN_PROC_UMASK     39  /* process umask */
#define KERN_PROC_OSREL     40  /* osreldate for process binary */
#define KERN_PROC_SIGTRAMP  41  /* signal trampoline location */

/*
 * KERN_IPC identifiers
 */
#define KIPC_MAXSOCKBUF     1   /* int: max size of a socket buffer */
#define KIPC_SOCKBUF_WASTE  2   /* int: wastage factor in sockbuf */
#define KIPC_SOMAXCONN      3   /* int: max length of connection q */
#define KIPC_MAX_LINKHDR    4   /* int: max length of link header */
#define KIPC_MAX_PROTOHDR   5   /* int: max length of network header */
#define KIPC_MAX_HDR        6   /* int: max total length of headers */
#define KIPC_MAX_DATALEN    7   /* int: max length of data? */

/*
 * CTL_HW identifiers
 */
#define HW_MACHINE   1      /* string: machine class */
#define HW_MODEL     2      /* string: specific machine model */
#define HW_NCPU      3      /* int: number of cpus */
#define HW_BYTEORDER     4      /* int: machine byte order */
#define HW_PHYSMEM   5      /* int: total memory */
#define HW_USERMEM   6      /* int: non-kernel memory */
#define HW_PAGESIZE  7      /* int: software page size */
#define HW_DISKNAMES     8      /* strings: disk drive names */
#define HW_DISKSTATS     9      /* struct: diskstats[] */
#define HW_FLOATINGPT   10      /* int: has HW floating point? */
#define HW_MACHINE_ARCH 11      /* string: machine architecture */
#define HW_REALMEM  12      /* int: 'real' memory */

/*
 * CTL_USER definitions
 */
#define USER_CS_PATH         1  /* string: _CS_PATH */
#define USER_BC_BASE_MAX     2  /* int: BC_BASE_MAX */
#define USER_BC_DIM_MAX      3  /* int: BC_DIM_MAX */
#define USER_BC_SCALE_MAX    4  /* int: BC_SCALE_MAX */
#define USER_BC_STRING_MAX   5  /* int: BC_STRING_MAX */
#define USER_COLL_WEIGHTS_MAX    6  /* int: COLL_WEIGHTS_MAX */
#define USER_EXPR_NEST_MAX   7  /* int: EXPR_NEST_MAX */
#define USER_LINE_MAX        8  /* int: LINE_MAX */
#define USER_RE_DUP_MAX      9  /* int: RE_DUP_MAX */
#define USER_POSIX2_VERSION 10  /* int: POSIX2_VERSION */
#define USER_POSIX2_C_BIND  11  /* int: POSIX2_C_BIND */
#define USER_POSIX2_C_DEV   12  /* int: POSIX2_C_DEV */
#define USER_POSIX2_CHAR_TERM   13  /* int: POSIX2_CHAR_TERM */
#define USER_POSIX2_FORT_DEV    14  /* int: POSIX2_FORT_DEV */
#define USER_POSIX2_FORT_RUN    15  /* int: POSIX2_FORT_RUN */
#define USER_POSIX2_LOCALEDEF   16  /* int: POSIX2_LOCALEDEF */
#define USER_POSIX2_SW_DEV  17  /* int: POSIX2_SW_DEV */
#define USER_POSIX2_UPE     18  /* int: POSIX2_UPE */
#define USER_STREAM_MAX     19  /* int: POSIX2_STREAM_MAX */
#define USER_TZNAME_MAX     20  /* int: POSIX2_TZNAME_MAX */

#define CTL_P1003_1B_ASYNCHRONOUS_IO        1   /* boolean */
#define CTL_P1003_1B_MAPPED_FILES       2   /* boolean */
#define CTL_P1003_1B_MEMLOCK            3   /* boolean */
#define CTL_P1003_1B_MEMLOCK_RANGE      4   /* boolean */
#define CTL_P1003_1B_MEMORY_PROTECTION      5   /* boolean */
#define CTL_P1003_1B_MESSAGE_PASSING        6   /* boolean */
#define CTL_P1003_1B_PRIORITIZED_IO     7   /* boolean */
#define CTL_P1003_1B_PRIORITY_SCHEDULING    8   /* boolean */
#define CTL_P1003_1B_REALTIME_SIGNALS       9   /* boolean */
#define CTL_P1003_1B_SEMAPHORES         10  /* boolean */
#define CTL_P1003_1B_FSYNC          11  /* boolean */
#define CTL_P1003_1B_SHARED_MEMORY_OBJECTS  12  /* boolean */
#define CTL_P1003_1B_SYNCHRONIZED_IO        13  /* boolean */
#define CTL_P1003_1B_TIMERS         14  /* boolean */
#define CTL_P1003_1B_AIO_LISTIO_MAX     15  /* int */
#define CTL_P1003_1B_AIO_MAX            16  /* int */
#define CTL_P1003_1B_AIO_PRIO_DELTA_MAX     17  /* int */
#define CTL_P1003_1B_DELAYTIMER_MAX     18  /* int */
#define CTL_P1003_1B_MQ_OPEN_MAX        19  /* int */
#define CTL_P1003_1B_PAGESIZE           20  /* int */
#define CTL_P1003_1B_RTSIG_MAX          21  /* int */
#define CTL_P1003_1B_SEM_NSEMS_MAX      22  /* int */
#define CTL_P1003_1B_SEM_VALUE_MAX      23  /* int */
#define CTL_P1003_1B_SIGQUEUE_MAX       24  /* int */
#define CTL_P1003_1B_TIMER_MAX          25  /* int */

#define CTL_P1003_1B_MAXID      26

#ifdef _KERNEL

/*
 * Declare some common oids.
 */
extern struct sysctl_oid_list sysctl__children;
SYSCTL_DECL(_kern);
SYSCTL_DECL(_kern_features);
SYSCTL_DECL(_kern_ipc);
SYSCTL_DECL(_kern_proc);
SYSCTL_DECL(_kern_sched);
SYSCTL_DECL(_kern_sched_stats);
SYSCTL_DECL(_sysctl);
SYSCTL_DECL(_vm);
SYSCTL_DECL(_vm_stats);
SYSCTL_DECL(_vm_stats_misc);
SYSCTL_DECL(_vfs);
SYSCTL_DECL(_net);
SYSCTL_DECL(_debug);
SYSCTL_DECL(_debug_sizeof);
SYSCTL_DECL(_dev);
SYSCTL_DECL(_hw);
SYSCTL_DECL(_hw_bus);
SYSCTL_DECL(_hw_bus_devices);
SYSCTL_DECL(_hw_bus_info);
SYSCTL_DECL(_machdep);
SYSCTL_DECL(_user);
SYSCTL_DECL(_compat);
SYSCTL_DECL(_regression);
SYSCTL_DECL(_security);
SYSCTL_DECL(_security_bsd);

extern char machine[];
extern char osrelease[];
extern char ostype[];
extern char kern_ident[];

/* Dynamic oid handling */
struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist,
        struct sysctl_oid_list *parent, int nbr, const char *name, int kind,
        void *arg1, intptr_t arg2, int (*handler)(SYSCTL_HANDLER_ARGS),
        const char *fmt, const char *descr);
int sysctl_remove_name(struct sysctl_oid *parent, const char *name, int del,
        int recurse);
void    sysctl_rename_oid(struct sysctl_oid *oidp, const char *name);
int sysctl_move_oid(struct sysctl_oid *oidp,
        struct sysctl_oid_list *parent);
int sysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse);
int sysctl_ctx_init(struct sysctl_ctx_list *clist);
int sysctl_ctx_free(struct sysctl_ctx_list *clist);
struct  sysctl_ctx_entry *sysctl_ctx_entry_add(struct sysctl_ctx_list *clist,
        struct sysctl_oid *oidp);
struct  sysctl_ctx_entry *sysctl_ctx_entry_find(struct sysctl_ctx_list *clist,
        struct sysctl_oid *oidp);
int sysctl_ctx_entry_del(struct sysctl_ctx_list *clist,
        struct sysctl_oid *oidp);

int kernel_sysctl(struct thread *td, int *name, u_int namelen, void *old,
        size_t *oldlenp, void *new, size_t newlen, size_t *retval,
        int flags);
int kernel_sysctlbyname(struct thread *td, char *name, void *old,
        size_t *oldlenp, void *new, size_t newlen, size_t *retval,
        int flags);
int userland_sysctl(struct thread *td, int *name, u_int namelen, void *old,
        size_t *oldlenp, int inkernel, void *new, size_t newlen,
        size_t *retval, int flags);
int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid,
        int *nindx, struct sysctl_req *req);
void    sysctl_lock(void);
void    sysctl_unlock(void);
int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len);

struct sbuf;
struct sbuf *sbuf_new_for_sysctl(struct sbuf *, char *, int,
        struct sysctl_req *);
#else   /* !_KERNEL */
#include <sys/cdefs.h>

__BEGIN_DECLS
int sysctl(const int *, u_int, void *, size_t *, const void *, size_t);
int sysctlbyname(const char *, void *, size_t *, const void *, size_t);
int sysctlnametomib(const char *, int *, size_t *);
__END_DECLS
#endif  /* _KERNEL */

#endif  /* !_SYS_SYSCTL_H_ */


text:
using namespace mlir;
using llvm::SMLoc;
using llvm::SMRange;

SMLoc Token::getLoc() const { return SMLoc::getFromPointer(spelling.data()); }

SMLoc Token::getEndLoc() const {
  return SMLoc::getFromPointer(spelling.data() + spelling.size());
}

SMRange Token::getLocRange() const { return SMRange(getLoc(), getEndLoc()); }

/// For an integer token, return its value as an unsigned.  If it doesn't fit,
/// return None.
Optional<unsigned> Token::getUnsignedIntegerValue() const {
  bool isHex = spelling.size() > 1 && spelling[1] == 'x';

  unsigned result = 0;
  if (spelling.getAsInteger(isHex ? 0 : 10, result))
    return None;
  return result;
}

/// For an integer token, return its value as a uint64_t.  If it doesn't fit,
/// return None.
Optional<uint64_t> Token::getUInt64IntegerValue() const {
  bool isHex = spelling.size() > 1 && spelling[1] == 'x';

  uint64_t result = 0;
  if (spelling.getAsInteger(isHex ? 0 : 10, result))
    return None;
  return result;
}

/// For a floatliteral, return its value as a double. Return None if the value
/// underflows or overflows.
Optional<double> Token::getFloatingPointValue() const {
  double result = 0;
  if (spelling.getAsDouble(result))
    return None;
  return result;
}

/// For an inttype token, return its bitwidth.
Optional<unsigned> Token::getIntTypeBitwidth() const {
  unsigned result = 0;
  if (spelling[1] == '0' || spelling.drop_front().getAsInteger(10, result) ||
      result == 0)
    return None;
  return result;
}

/// Given a 'string' token, return its value, including removing the quote
/// characters and unescaping the contents of the string.  The lexer has already
/// verified that this token is valid.
std::string Token::getStringValue() const {
  assert(getKind() == string);
  // Start by dropping the quotes.
  StringRef bytes = getSpelling().drop_front().drop_back();

  std::string result;
  result.reserve(bytes.size());
  for (unsigned i = 0, e = bytes.size(); i != e;) {
    auto c = bytes[i++];
    if (c != '\\') {
      result.push_back(c);
      continue;
    }

    assert(i + 1 <= e && "invalid string should be caught by lexer");
    auto c1 = bytes[i++];
    switch (c1) {
    case '"':
    case '\\':
      result.push_back(c1);
      continue;
    case 'n':
      result.push_back('\n');
      continue;
    case 't':
      result.push_back('\t');
      continue;
    default:
      break;
    }

    assert(i + 1 <= e && "invalid string should be caught by lexer");
    auto c2 = bytes[i++];

    assert(llvm::isHexDigit(c1) && llvm::isHexDigit(c2) && "invalid escape");
    result.push_back((llvm::hexDigitValue(c1) << 4) | llvm::hexDigitValue(c2));
  }

  return result;
}

/// Given a hash_identifier token like #123, try to parse the number out of
/// the identifier, returning None if it is a named identifier like #x or
/// if the integer doesn't fit.
Optional<unsigned> Token::getHashIdentifierNumber() const {
  assert(getKind() == hash_identifier);
  unsigned result = 0;
  if (spelling.drop_front().getAsInteger(10, result))
    return None;
  return result;
}

/// Given a punctuation or keyword token kind, return the spelling of the
/// token as a string.  Warning: This will abort on markers, identifiers and
/// literal tokens since they have no fixed spelling.
StringRef Token::getTokenSpelling(Kind kind) {
  switch (kind) {
  default:
    llvm_unreachable("This token kind has no fixed spelling");
#define TOK_PUNCTUATION(NAME, SPELLING)                                        \
  case NAME:                                                                   \
    return SPELLING;
#define TOK_OPERATOR(NAME, SPELLING)                                           \
  case NAME:                                                                   \
    return SPELLING;
#define TOK_KEYWORD(SPELLING)                                                  \
  case kw_##SPELLING:                                                          \
    return #SPELLING;
#include "TokenKinds.def"
  }
}

/// Return true if this is one of the keyword token kinds (e.g. kw_if).
bool Token::isKeyword() const {
  switch (kind) {
  default:
    return false;
#define TOK_KEYWORD(SPELLING)                                                  \
  case kw_##SPELLING:                                                          \
    return true;
#include "TokenKinds.def"
  }
}

redpajama_set_name: RedPajamaGithub


text:
namespace dbus {
class Bus;
}  // namespace dbus

namespace chromeos {

// DebugDaemonClient is used to communicate with the debug daemon.
class CHROMEOS_EXPORT DebugDaemonClient {
 public:
  virtual ~DebugDaemonClient();

  // Called once GetDebugLogs() is complete. Takes one parameter:
  // - succeeded: was the logs stored successfully.
  typedef base::Callback<void(bool succeeded)> GetDebugLogsCallback;

  // Requests to store debug logs into |file| and calls |callback|
  // when completed. Debug logs will be stored in the .tgz format.
  virtual void GetDebugLogs(base::PlatformFile file,
                            const GetDebugLogsCallback& callback) = 0;

  // Called once SetDebugMode() is complete. Takes one parameter:
  // - succeeded: debug mode was changed successfully.
  typedef base::Callback<void(bool succeeded)> SetDebugModeCallback;

  // Requests to change debug mode to given |subsystem| and calls
  // |callback| when completed. |subsystem| should be one of the
  // following: "wifi", "ethernet", "cellular" or "none".
  virtual void SetDebugMode(const std::string& subsystem,
                            const SetDebugModeCallback& callback) = 0;

  // Requests to start system/kernel tracing.
  virtual void StartSystemTracing() = 0;

  // Called once RequestStopSystemTracing() is complete. Takes one parameter:
  // - result: the data collected while tracing was active
  typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&
      result)> StopSystemTracingCallback;

  // Requests to stop system tracing and calls |callback| when completed.
  virtual bool RequestStopSystemTracing(const StopSystemTracingCallback&
      callback) = 0;

  // Returns an empty SystemTracingCallback that does nothing.
  static StopSystemTracingCallback EmptyStopSystemTracingCallback();

  // Factory function, creates a new instance and returns ownership.
  // For normal usage, access the singleton via DBusThreadManager::Get().
  static DebugDaemonClient* Create(DBusClientImplementationType type,
                                   dbus::Bus* bus);
 protected:
  // Create() should be used instead.
  DebugDaemonClient();

 private:
  DISALLOW_COPY_AND_ASSIGN(DebugDaemonClient);
};

}  // namespace chromeos

#endif  // CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_


text:
<form id="import_form" method="post" enctype="multipart/form-data">
	<input type="file" name="file" id="import_file" style="visibility:hidden;position:absolute;top:0;left:0">
	<input type="text" style="visibility:hidden;position:absolute;top:0;left:0" name="url" id="url">
</form>

<form data-input-class="col-sm-offset-3 col-sm-6" data-ajax-url="admin/alerts/template/connected" class="form-signin form-horizontal list-input-form" role="form" data-array-name="list" data-placeholder-text="<?= $this->lang->line("admin_hidden_word"); ?>" data-item-endpoint="admin/hidden/word/" data-save-endpoint="admin/hidden/words/save">

<?= $this->lang->line("alert_hidden_connected_words"); ?> <?= $this->lang->line("alert_hidden_connected_words_description"); ?>

				<button type="button" class="btn btn-primary"><?= $this->lang->line("admin_export"); ?></button>
				<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">

					<?= $this->lang->line("admin_export"); ?>
			  	</button>

<?= $this->lang->line("admin_as_csv"); ?>

<?= $this->lang->line("admin_as_json"); ?>

<?= $this->lang->line("admin_as_xml"); ?>

<?= $this->lang->line("admin_as_txt"); ?>

				<button type="button" class="btn btn-primary"><?= $this->lang->line("admin_import"); ?></button>
				<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">

					<?= $this->lang->line("admin_export"); ?>
			  	</button>

<?= $this->lang->line("admin_from_csv"); ?>

<?= $this->lang->line("admin_from_txt"); ?>

			<button class="btn btn-success" id="import_upload"><?= $this->lang->line("admin_upload"); ?></button>

	<?php foreach ( $hidden_words as $object ) : ?>

					<input data-id="<?= $object->id; ?>" data-value="<?= $object->value ?>" type="text" class="form-control list-input" value="<?= $object->value ?>">

							<button class="btn btn-lg btn-danger button-addon remove-input" type="button"><?= $this->lang->line("admin_remove_string"); ?></button>

	<?php endforeach; ?>

				<input type="text" class="form-control list-input" placeholder="<?= $this->lang->line("admin_hidden_word"); ?>">

						<button class="btn btn-lg btn-danger button-addon remove-input" type="button"><?= $this->lang->line("admin_remove_string"); ?></button>

			<button class="btn btn-lg btn-primary btn-block" type="submit"><?= $this->lang->line("admin_save"); ?></button>

</form>


text:
#!/bin/bash

# Copyright 2020 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -euo pipefail

# Usage: assert_unpacked_archive_contains_symbols_directory <archive> <paths...>
#
# Asserts that the unpacked application (.ipa/.zip) archive at `archive`
# contains a Symbols directory with a `.symbols` file for each platform of each
# binary inside the unpacked archive matching the UUID of that binary.
#
# This exists separately from `archive_contents_test.sh` since the names of the
# `*.symbols` file(s) depend on the UUIDs of the binaries in the unpacked
# archive.
function assert_unpacked_archive_contains_symbols_directory() {
  local archive="$1" ; shift

  # Get the list of UUIDs and platforms present in all the `$UUID.symbols`
  # files in the archive under `Symbols/*.symbols`.
  local symbols_uuid_output="${TEST_TMPDIR}/symbols_uuid_output"
  xcrun symbols -noDaemon -uuid "${archive}/Symbols" > "${symbols_uuid_output}"

  for binary in "$@"; do
    # Each binary can contain one or more architectures, each with its own UUID.
    dwarfdump -u "${archive}/${binary}" | while read line ; do
      local -a uuid_and_platform=(
        $(echo "${line}" | sed -e 's/UUID: \([^ ]*\) (\([^)]*\)).*/\1 \2/') )
      local uuid="${uuid_and_platform[0]}"
      local platform="${uuid_and_platform[1]}"
      assert_contains "${uuid}[[:space:]]\{1,\}${platform}" \
        "${symbols_uuid_output}"
    done
  done

  rm -f "${symbols_uuid_output}"
}

assert_unpacked_archive_contains_symbols_directory "${ARCHIVE_ROOT}" \
  "${BINARY_PATHS}"


text:
var fs = require('fs');
var Promise = require('promise');

// var Functions = function(){
//
// };
//load library promise. lib_path: full path.
exports.loadlibrary = function(lib_path){
    return new Promise(function(resolve, reject) {
        if (lib_path.endsWith('.js')) lib_path = lib_path.substring(0, lib_path.length - 3);
        fs.access(lib_path + '.js', fs.constants.R_OK, function(err){
            if (err){
                resolve({'error': err, 'code': -1});
            }else{
                try {
                    var lib = require(lib_path);
                    resolve(lib);
                } catch (e) {
                    resolve({'error': e, 'code': -1});
                }
            }
        });
    });
}

exports.listfile = function(path, filter){
    return new Promise(function(resolve, reject){
        fs.readdir(path, function(error, files){
            if (error){
                reject(error);
            }else{

                var result = [];
                for (var key in files) {
                    if (files.hasOwnProperty(key)) {
                        if (filter){
                            var matchs = filter.match(files[key]);
                            if (matchs){
                                result.push(files[key]);
                            }
                        }else {
                            result.push(files[key]);
                        }
                    }
                }
                resolve(result);
            }
        });
    });
}

// exports = module.exports = Functions;


text:
layout: page
sidebar: right
subheadline:
title:  "Numb - Drum"
teaser: "Drum version by Matt McGuire"
breadcrumb: true
tags:
    - numb
categories:
    - instrumental
    - drums
thumbnail: /images/numb-drum.jpg

music_performer: Matt McGuire
music_title: Numb
music_release: 2012-11-05
---


text:
"""
Banner reader.
"""
from __future__ import print_function
import  re

class VulnDetection(object):
	def __init__(self):
		self.db = None
		self.result = None

	def os_detect(self):
		try:
			os = self.result['osclass']
			print("OS detection accuracy %s%" % os['accuracy'])
			print("Vendor :", os['vendor'], os['osfamily'], os['osgen'])
		except KeyError:
			print("For OS detection pvascan need root privillage")

	def port_info(self):
		found_ports = self.result['tcp']
		print("Discovered host ports : %s" % len(found_ports))
		for (number, port) in found_ports.items():
			banner = port['product'] + ' ' + port['version']
			if (port['state'] == 'open'):
				print("[+] PORT %s [%s] %s" % (number, port['name'], banner))
				if len(banner) > 3:
					self.loop_db(banner)
			else:
				print("[-] PORT %s [STATE:%s]" % (number, port['state']))

	def loop_db(self, banner):
		found = {}
		for row in self.db:
			if self.vulner_search(banner, row['description']):
				found.update({row['id'] : row['description']})

		if found:
			print ("| VULNERABILITY DETECTED!")
			print ("|- Description : ")
			for num, id in enumerate(found):
				print("|    %d. %s" % (num + 1, found[id]))
				print("|    | For more information please visit url below")
				print("|    |_ https://www.exploit-db.com/exploits/%s/" % id)
			print("|-", len(found), "exploits found,")
			print("|__ Please contact the aplication's vendor to patch the vulnerability\n")

	def vulner_search(self, banner, string):
		s = re.compile(banner, flags=re.IGNORECASE)
		if s.match(string):
			return True
		else:
			return False


text:
package com.dgrlucky.extend.z;

import android.os.SystemClock;
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;

import com.dgrlucky.extend.App;
import com.dgrlucky.extend.ui.mvp.model.data.DataLayer;
import com.google.gson.Gson;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;

import javax.inject.Inject;

import rx.Observable;
import rx.Observer;
import rx.Subscriber;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.schedulers.Schedulers;
import rx.subjects.BehaviorSubject;

/**
 * @author dgrlucky
 * @date 2016/4/22 13:35
 * @company dgrlucky
 * @desc
 */
public abstract class ZBench<T> {
    @Inject
    Gson mGson;
    private int mDataSource;
    private static ZBench mInstance;
    private static final int DATA_SOURCE_MEMORY = 1;
    private static final int DATA_SOURCE_DISK = 2;
    private static final int DATA_SOURCE_NETWORK = 3;

    private ZActor mZActor;
    BehaviorSubject<T> cache;
    private Subscription mSubscription;

    File dataFile = new File(App.getContext().getFilesDir(), "subscription.db");

    @IntDef({DATA_SOURCE_MEMORY, DATA_SOURCE_DISK, DATA_SOURCE_NETWORK})
    @interface DataSource {

    }

    private ZBench() {
    }

    public ZBench(DataLayer dataLayer, ZActor ZActor, Subscription subscription) {
        this.mZActor = ZActor;
        this.mSubscription = subscription;
    }

    public void loadData() {
        unsubscribe();
        mSubscription = subscribeData(new Observer<T>() {
            @Override
            public void onCompleted() {
                mZActor.onFinish();
            }

            @Override
            public void onError(Throwable e) {
                mZActor.onError();
            }

            @Override
            public void onNext(T t) {
                mZActor.onSuccess(null);
            }
        });
    }

    public void loadFromNetwork() {
        observableData().subscribeOn(Schedulers.io())
                .doOnNext(new Action1<T>() {
                    @Override
                    public void call(T data) {
                        writeCache(data);
                    }
                }).subscribe(new Action1<T>() {
            @Override
            public void call(T data) {
                cache.onNext(data);
            }
        }, new Action1<Throwable>() {
            @Override
            public void call(Throwable throwable) {
                throwable.printStackTrace();
                mZActor.onEmpty();
            }
        });
    }

    protected abstract T readLocal(Reader reader);

    protected abstract Observable<T> observableData();

    public Subscription subscribeData(@NonNull Observer<T> observer) {
        if (cache == null) {
            cache = BehaviorSubject.create();
            Observable.create(new Observable.OnSubscribe<T>() {
                @Override
                public void call(Subscriber<? super T> subscriber) {
                    T data = readCache();
                    if (data == null) {
                        setDataSource(DATA_SOURCE_NETWORK);
                        loadFromNetwork();
                    } else {
                        setDataSource(DATA_SOURCE_DISK);
                        subscriber.onNext(data);
                    }
                }
            })
                    .subscribeOn(Schedulers.io())
                    .subscribe(cache);
        } else {
            setDataSource(DATA_SOURCE_MEMORY);
        }
        return cache.observeOn(AndroidSchedulers.mainThread()).subscribe(observer);
    }

    public T readCache() {
        SystemClock.sleep(1000);
        try {
            Reader reader = new FileReader(dataFile);
            return readLocal(reader);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            return null;
        }
    }

    public void writeCache(T data) {
        String json = mGson.toJson(data);
        try {
            if (!dataFile.exists()) {
                try {
                    dataFile.createNewFile();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            Writer writer = new FileWriter(dataFile);
            writer.write(json);
            writer.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void delete() {
        dataFile.delete();
    }

    private void setDataSource(@DataSource int dataSource) {
        this.mDataSource = dataSource;
    }

    private void unsubscribe() {
        if (mSubscription != null && !mSubscription.isUnsubscribed()) {
            mSubscription.unsubscribe();
        }
    }
}


text:
package org.hawkular.alerts.engine.impl;

import java.io.File;
import java.util.List;

import org.hawkular.alerts.api.model.action.ActionDefinition;
import org.hawkular.alerts.api.model.export.Definitions;
import org.hawkular.alerts.api.model.trigger.FullTrigger;
import org.hawkular.commons.log.MsgLogger;
import org.hawkular.commons.log.MsgLogging;

import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * Read a json file with a list of full triggers and actions definitions.
 *
 * @author Jay Shaughnessy
 * @author Lucas Ponce
 */
public class AlertsImportManager {
    private static final MsgLogger log = MsgLogging.getMsgLogger(AlertsImportManager.class);
    private ObjectMapper objectMapper = new ObjectMapper();
    private Definitions definitions;

    /**
     * Read a json file and initialize the AlertsImportManager instance
     *
     * @param fAlerts json file to read
     * @throws Exception on any problem
     */
    public AlertsImportManager(File fAlerts) throws Exception {
        if (fAlerts == null) {
            throw new IllegalArgumentException("fAlerts must be not null");
        }
        if (!fAlerts.exists() || !fAlerts.isFile()) {
            throw new IllegalArgumentException(fAlerts.getName() + " file must exist");
        }

        definitions = objectMapper.readValue(fAlerts, Definitions.class);
        if (definitions != null) {
            log.debugf("File: %s imported in %s", fAlerts.toString(), definitions.toString());
        } else {
            log.debugf("File: %s imported is null", fAlerts.toString());
        }
    }

    public List<FullTrigger> getFullTriggers() {
        return (definitions != null ? definitions.getTriggers() : null);
    }

    public List<ActionDefinition> getActionDefinitions() {
        return (definitions != null ? definitions.getActions() : null);
    }

}


text:
#include <ored/marketdata/capfloorvolcurve.hpp>
#include <ored/utilities/log.hpp>

#include <qle/termstructures/datedstrippedoptionlet.hpp>
#include <qle/termstructures/datedstrippedoptionletadapter.hpp>
#include <qle/termstructures/optionletstripper1.hpp>
#include <qle/termstructures/optionletstripper2.hpp>

#include <ql/math/comparison.hpp>
#include <ql/math/matrix.hpp>
#include <ql/termstructures/volatility/capfloor/capfloortermvolcurve.hpp>
#include <ql/termstructures/volatility/capfloor/capfloortermvolsurface.hpp>
#include <ql/termstructures/volatility/optionlet/strippedoptionletadapter.hpp>

using namespace QuantLib;
using QuantExt::DatedStrippedOptionlet;
using QuantExt::DatedStrippedOptionletAdapter;
using QuantExt::OptionletStripper1;
using QuantExt::OptionletStripper2;
using namespace std;

namespace ore {
namespace data {

CapFloorVolCurve::CapFloorVolCurve(Date asof, CapFloorVolatilityCurveSpec spec, const Loader& loader,
                                   const CurveConfigurations& curveConfigs, boost::shared_ptr<IborIndex> iborIndex,
                                   Handle<YieldTermStructure> discountCurve) {
    try {

        const boost::shared_ptr<CapFloorVolatilityCurveConfig>& config =
            curveConfigs.capFloorVolCurveConfig(spec.curveConfigID());

        // Volatility type
        MarketDatum::QuoteType volatilityType;
        VolatilityType quoteVolatilityType;

        switch (config->volatilityType()) {
        case CapFloorVolatilityCurveConfig::VolatilityType::Lognormal:
            volatilityType = MarketDatum::QuoteType::RATE_LNVOL;
            quoteVolatilityType = ShiftedLognormal;
            break;
        case CapFloorVolatilityCurveConfig::VolatilityType::Normal:
            volatilityType = MarketDatum::QuoteType::RATE_NVOL;
            quoteVolatilityType = Normal;
            break;
        case CapFloorVolatilityCurveConfig::VolatilityType::ShiftedLognormal:
            volatilityType = MarketDatum::QuoteType::RATE_SLNVOL;
            quoteVolatilityType = ShiftedLognormal;
            break;
        default:
            QL_FAIL("unexpected volatility type");
        }

        // Read in quotes matrix. If we hit any ATM quotes that match one of the tenors, store those also.
        vector<Period> tenors = config->tenors();
        vector<double> strikes = config->strikes();
        QL_REQUIRE(!strikes.empty(), "Strikes should not be empty - expect a cap matrix");
        Matrix vols(tenors.size(), strikes.size());
        map<Period, Volatility> atmVolCurve;
        vector<vector<bool>> found(tenors.size(), vector<bool>(strikes.size()));
        Size remainingQuotes = tenors.size() * strikes.size();
        Size quotesRead = 0;

        // We take the first capfloor shift quote that we find in the file matching the
        // currency and index tenor
        bool isSln = volatilityType == MarketDatum::QuoteType::RATE_SLNVOL;
        bool haveShiftQuote = false;
        Real shift = 0.0;

        for (auto& md : loader.loadQuotes(asof)) {
            if (md->asofDate() == asof && md->instrumentType() == MarketDatum::InstrumentType::CAPFLOOR) {

                boost::shared_ptr<CapFloorQuote> q = boost::dynamic_pointer_cast<CapFloorQuote>(md);
                boost::shared_ptr<CapFloorShiftQuote> qs = boost::dynamic_pointer_cast<CapFloorShiftQuote>(md);

                if (q != NULL && q->ccy() == spec.ccy() && q->underlying() == iborIndex->tenor() &&
                    q->quoteType() == volatilityType) {

                    quotesRead++;

                    if (!q->atm()) {
                        Size i = std::find(tenors.begin(), tenors.end(), q->term()) - tenors.begin();
                        Size j = std::find_if(strikes.begin(), strikes.end(), [&q](const double& s) {
                            return close_enough(s, q->strike());
                        }) - strikes.begin();

                        if (i < tenors.size() && j < strikes.size()) {
                            vols[i][j] = q->quote()->value();

                            if (!found[i][j]) {
                                found[i][j] = true;
                                --remainingQuotes;
                            }
                        }
                    } else if (config->includeAtm()) {
                        // This forces us to read all cap/floor quotes
                        atmVolCurve.emplace(q->term(), q->quote()->value());
                    }
                } else if (isSln && !haveShiftQuote && qs && qs->ccy() == spec.ccy() &&
                           qs->indexTenor() == iborIndex->tenor() && qs->quoteType() == MarketDatum::QuoteType::SHIFT) {
                    // Shift quote for shifted lognormal capfloor volatility
                    shift = qs->quote()->value();
                    haveShiftQuote = true;
                }
            }
        }

        LOG("CapFloorVolCurve: read " << quotesRead << " vols");

        // Check that we have all the data we need
        if (remainingQuotes != 0) {
            ostringstream m;
            m << "Not all quotes found for spec " << spec << endl;
            if (remainingQuotes != 0) {
                m << "Found vol data (*) and missing data (.):" << std::endl;
                for (Size i = 0; i < tenors.size(); ++i) {
                    for (Size j = 0; j < strikes.size(); ++j) {
                        m << (found[i][j] ? "*" : ".");
                    }
                    if (i < tenors.size() - 1)
                        m << endl;
                }
            }
            LOG(m.str());
            QL_FAIL("could not build cap/floor vol curve");
        }

        // Non-ATM cap/floor volatility surface
        boost::shared_ptr<CapFloorTermVolSurface> capVol = boost::make_shared<CapFloorTermVolSurface>(
            0, config->calendar(), config->businessDayConvention(), tenors, strikes, vols, config->dayCounter());

        // Build the stripped caplet/floorlet surface
        // Hardcoded target volatility type to Normal - decision made to always work with a Normal optionlet surface
        boost::shared_ptr<OptionletStripper1> optionletStripper = boost::make_shared<OptionletStripper1>(
            capVol, iborIndex, Null<Rate>(), 1.0e-6, 100, discountCurve, quoteVolatilityType, shift, true, Normal, 0.0);
        boost::shared_ptr<DatedStrippedOptionlet> datedOptionletStripper =
            boost::make_shared<DatedStrippedOptionlet>(asof, optionletStripper);
        capletVol_ = boost::make_shared<DatedStrippedOptionletAdapter>(datedOptionletStripper);
        capletVol_->enableExtrapolation(config->extrapolate());

        // If given, add the ATM cap/floor volatility curve
        if (!atmVolCurve.empty()) {
            // Ordered list of ATM tenors and corresponding values
            vector<Period> atmTenors;
            vector<Volatility> atmVols;
            for (const auto& kv : atmVolCurve) {
                atmTenors.push_back(kv.first);
                atmVols.push_back(kv.second);
            }

            boost::shared_ptr<CapFloorTermVolCurve> atmCapVol = boost::make_shared<CapFloorTermVolCurve>(
                0, config->calendar(), config->businessDayConvention(), atmTenors, atmVols, config->dayCounter());
            Handle<CapFloorTermVolCurve> hAtmCapVol(atmCapVol);
            boost::shared_ptr<OptionletStripper> atmOptionletStripper =
                boost::make_shared<OptionletStripper2>(optionletStripper, hAtmCapVol, quoteVolatilityType, shift);
            datedOptionletStripper = boost::make_shared<DatedStrippedOptionlet>(asof, atmOptionletStripper);
            capletVol_ = boost::make_shared<DatedStrippedOptionletAdapter>(datedOptionletStripper);
            capletVol_->enableExtrapolation(config->extrapolate());
        }
    } catch (std::exception& e) {
        QL_FAIL("cap/floor vol curve building failed :" << e.what());
    } catch (...) {
        QL_FAIL("cap/floor vol curve building failed: unknown error");
    }
}
}
}


text:
Date: Mon, 02 Dec 1996 15:02:00 GMT
Server: NCSA/1.4.2
Content-type: text/html

<title>CSE477 Announcements</title>

CSE477: Digital Systems Design

Steve Burns, Spring 1996

April 3

If you are interested in obtaining your own evaluation module for
the 68HC11, you can purchase one directly from Motorola with a heavy student
discount. Send a copy of your student ID and a check from $68.11 to

Motorola University Support
Suite 100
505 Barton Springs Road
Austin, TX 78704

to receive a S68HC11EVBU. Allow 2 to 3 weeks for delivery. (Note that
this board is *not* the same as the one we use in the lab.)

<address>

burns@cs.washington.edu
</address>


text:
namespace performance_manager {
namespace policies {

class MockWorkingSetTrimmerPolicyChromeOS
    : public WorkingSetTrimmerPolicyChromeOS {
 public:
  MockWorkingSetTrimmerPolicyChromeOS() {
    trim_on_memory_pressure_enabled_ = true;
    trim_on_freeze_enabled_ = true;

    // Setup parameters for trimming on memory pressure.
    trim_on_memory_pressure_params_.graph_walk_backoff_time =
        base::TimeDelta::FromSeconds(30);

    trim_on_memory_pressure_params_.node_invisible_time =
        base::TimeDelta::FromSeconds(30);

    trim_on_memory_pressure_params_.node_trim_backoff_time =
        base::TimeDelta::FromSeconds(30);
  }

  ~MockWorkingSetTrimmerPolicyChromeOS() override {}

  base::MemoryPressureListener& listener() {
    return memory_pressure_listener_.value();
  }

  base::TimeTicks get_last_graph_walk() { return last_graph_walk_; }

  MOCK_METHOD1(TrimWorkingSet, bool(const ProcessNode*));

 private:
  DISALLOW_COPY_AND_ASSIGN(MockWorkingSetTrimmerPolicyChromeOS);
};

class WorkingSetTrimmerPolicyChromeOSTest : public GraphTestHarness {
 public:
  WorkingSetTrimmerPolicyChromeOSTest()
      : GraphTestHarness(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {}
  ~WorkingSetTrimmerPolicyChromeOSTest() override {}

  void SetUp() override {
    GraphTestHarness::SetUp();

    // Add our mock policy to the graph.
    std::unique_ptr<MockWorkingSetTrimmerPolicyChromeOS> mock_policy(
        new MockWorkingSetTrimmerPolicyChromeOS);
    policy_ = mock_policy.get();
    graph()->PassToGraph(std::move(mock_policy));
  }

  void TearDown() override {
    policy_ = nullptr;
    GraphTestHarness::TearDown();
  }

  MockWorkingSetTrimmerPolicyChromeOS* policy() { return policy_; }

  base::TimeTicks NowTicks() { return task_env().NowTicks(); }

  base::TimeTicks FastForwardBy(base::TimeDelta delta) {
    task_env().FastForwardBy(delta);
    return NowTicks();
  }

 private:
  MockWorkingSetTrimmerPolicyChromeOS* policy_ = nullptr;  // Not owned.

  DISALLOW_COPY_AND_ASSIGN(WorkingSetTrimmerPolicyChromeOSTest);
};

// Validate that we don't walk again before the backoff period has expired.
// TODO(crbug.com/1051006): Test is flaky
TEST_F(WorkingSetTrimmerPolicyChromeOSTest, DISABLED_GraphWalkBackoffPeriod) {
  // Since we've never walked the graph we should do so now.
  const base::TimeTicks initial_walk_time = policy()->get_last_graph_walk();
  ASSERT_EQ(initial_walk_time, base::TimeTicks());

  policy()->listener().SimulatePressureNotification(
      base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE);

  FastForwardBy(base::TimeDelta::FromSeconds(1));

  // Since we have never walked we expect that we walked it now, we confirm by
  // checking the last walk time against the known clock.
  const base::TimeTicks last_walk_time = policy()->get_last_graph_walk();
  EXPECT_LT(initial_walk_time, last_walk_time);

  policy()->listener().SimulatePressureNotification(
      base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE);

  FastForwardBy(base::TimeDelta::FromSeconds(1));

  // We will not have caused a walk as the clock has not advanced beyond the
  // backoff period.
  EXPECT_EQ(last_walk_time, policy()->get_last_graph_walk());
}

// Validate that we will walk the graph again after the backoff period is
// expired.
// TODO(crbug.com/1051006): Test is flaky
TEST_F(WorkingSetTrimmerPolicyChromeOSTest,
       DISABLED_GraphWalkAfterBackoffPeriod) {
  // Since we've never walked the graph we should do so now.
  const base::TimeTicks initial_walk_time = policy()->get_last_graph_walk();
  ASSERT_EQ(initial_walk_time, base::TimeTicks());

  policy()->listener().SimulatePressureNotification(
      base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE);

  FastForwardBy(base::TimeDelta::FromSeconds(1));

  // Since we have never walked we expect that we walked it now, we confirm by
  // checking the last walk time against the known clock.
  const base::TimeTicks last_walk_time = policy()->get_last_graph_walk();
  EXPECT_LT(initial_walk_time, last_walk_time);

  FastForwardBy(base::TimeDelta::FromDays(1));

  policy()->listener().SimulatePressureNotification(
      base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE);

  // Finally advance the clock beyond the backoff period and it should allow it
  // to walk again.
  FastForwardBy(base::TimeDelta::FromSeconds(1));

  const base::TimeTicks final_walk_time = policy()->get_last_graph_walk();
  EXPECT_GT(final_walk_time, last_walk_time);
}

// This test will validate that we will NOT try to trim a node if it has not
// been invisible for long enough.
// TODO(crbug.com/1051006): Test is flaky
TEST_F(WorkingSetTrimmerPolicyChromeOSTest,
       DISABLED_DontTrimIfNotInvisibleLongEnough) {
  // Create a simple graph
  auto process_node = CreateNode<ProcessNodeImpl>();
  auto page_node = CreateNode<PageNodeImpl>();
  auto parent_frame =
      CreateFrameNodeAutoId(process_node.get(), page_node.get());

  // Since we've never walked the graph we should do so now.
  const base::TimeTicks clock_time = NowTicks();
  const base::TimeTicks initial_walk_time = policy()->get_last_graph_walk();

  // Set the PageNode to invisible but the state change time to now, since it
  // will not have been invisible long enough it will NOT trigger a call to
  // TrimWorkingSet.
  page_node->SetIsVisible(true);   // Reset visibility and set invisible Now.
  page_node->SetIsVisible(false);  // Uses the testing clock.
  EXPECT_CALL(*policy(), TrimWorkingSet(testing::_)).Times(0);

  // Triger memory pressure and we should observe the walk.
  policy()->listener().SimulatePressureNotification(
      base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE);

  FastForwardBy(base::TimeDelta::FromSeconds(1));

  const base::TimeTicks current_walk_time = policy()->get_last_graph_walk();
  EXPECT_EQ(clock_time, current_walk_time);
  EXPECT_NE(current_walk_time, initial_walk_time);
}

// This test will validate that we skip a page node that doesn't have a main
// frame node.
TEST_F(WorkingSetTrimmerPolicyChromeOSTest, DontTrimIfNoMainFrame) {
  // Create a lone page node.
  auto page_node = CreateNode<PageNodeImpl>();

  // Make sure the node is not visible for 1 day.
  page_node->SetIsVisible(true);   // Reset visibility and set invisible Now.
  page_node->SetIsVisible(false);  // Uses the testing clock.
  FastForwardBy(base::TimeDelta::FromDays(1));

  // We should not be called because we don't have a frame node or process node.
  EXPECT_CALL(*policy(), TrimWorkingSet(testing::_)).Times(0);

  // Triger memory pressure and we should observe the walk.
  policy()->listener().SimulatePressureNotification(
      base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE);

  FastForwardBy(base::TimeDelta::FromDays(1));
}

// This test will validate that we WILL trim the working set if it has been
// invisible long enough.
TEST_F(WorkingSetTrimmerPolicyChromeOSTest, TrimIfInvisibleLongEnough) {
  // Create a simple graph
  auto process_node = CreateNode<ProcessNodeImpl>();
  auto page_node = CreateNode<PageNodeImpl>();
  auto parent_frame =
      CreateFrameNodeAutoId(process_node.get(), page_node.get());

  ASSERT_EQ(1u, graph()->GetAllPageNodes().size());

  // Create a Process so this process node doesn't bail on Process.IsValid();
  const base::Process self = base::Process::Current();
  auto duplicate = self.Duplicate();
  ASSERT_TRUE(duplicate.IsValid());
  process_node->SetProcess(std::move(duplicate), base::Time::Now());

  // Set it invisible using the current clock, then we will advance the clock
  // and it should result in a TrimWorkingSet since it's been invisible long
  // enough.
  page_node->SetIsVisible(true);   // Reset visibility and then set invisible.
  page_node->SetIsVisible(false);  // Uses the testing clock.
  const base::TimeTicks cur_time =
      FastForwardBy(base::TimeDelta::FromDays(365));

  // We will attempt to trim to corresponding ProcessNode since we've been
  // invisible long enough.
  EXPECT_CALL(*policy(), TrimWorkingSet(process_node.get())).Times(1);

  // Triger memory pressure and we should observe the walk since we've never
  // walked before.
  policy()->listener().SimulatePressureNotification(
      base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE);

  FastForwardBy(base::TimeDelta::FromSeconds(1));

  // We should have triggered the walk and it should have trimmed.
  EXPECT_EQ(cur_time, policy()->get_last_graph_walk());
}

}  // namespace policies
}  // namespace performance_manager


text:
module.exports = {
  name: 'prism',

  'should add the langauge class to the pre element': function(test) {
    test.open('http://localhost:3000/home')
    .wait(500)
      .assert.exists('pre.language-css', 'pre element and language class one it')
    .done();
  }
}


text:
<?xml version="1.0" encoding="utf-8" ?>
<INTERACTIONS>
<INTERACTION>
<SOURCE>
<CLINICAL_SOURCE>ANSM</CLINICAL_SOURCE>
<SOURCE_FILE>249-GLIPTINS.html
</SOURCE_FILE>
</SOURCE>
<DRUG1>
<CLASS name="GLIPTINS" code="A10B-001" /></DRUG1>
<DRUG2>
<CLASS name="BETA BLOCKING AGENTS (EXCEPT ESMOLOL)" code="C07AB-002" /></DRUG2>
<DESCRIPTION>All the beta-blocking agents can mask certain symptoms of hypoglycemia: palpitations and tachycardia</DESCRIPTION>
<SEVERITY>Precaution for use</SEVERITY>
<COMMENT>Inform the patient and, especially at the beginning of treatment, reinforce self-monitoring of blood glucose</COMMENT>
</INTERACTION>
<INTERACTION>
<SOURCE>
<CLINICAL_SOURCE>ANSM</CLINICAL_SOURCE>
<SOURCE_FILE>249-GLIPTINS.html
</SOURCE_FILE>
</SOURCE>
<DRUG1>
<CLASS name="GLIPTINS" code="A10B-001" /></DRUG1>
<DRUG2>
<CLASS name="ANGIOTENSIN CONVERTING ENZYME INHIBITORS (ACE INHIBITORS)" code="C09AA" /></DRUG2>
<DESCRIPTION>Increase of the risk of the onset of angioedema, due to the reduction of the activity of the enzyme dipetidyl peptidase-4 (DDP-4) by the gliptin, in patients treated with the angiotensin converting enzyme inhibitor</DESCRIPTION>
<SEVERITY>Take into account</SEVERITY>
</INTERACTION>
</INTERACTIONS>


text:
ganeti-rapi(8) Ganeti | Version @GANETI_VERSION@
================================================

Name
----

ganeti-rapi - Ganeti remote API daemon

Synopsis
--------

| **ganeti-rapi** [-d] [-f] [-p *PORT*] [-b *ADDRESS*] [-i *INTERFACE*]
| [\--no-ssl] [-K *SSL_KEY_FILE*] [-C *SSL_CERT_FILE*]
| [\--require-authentication]

DESCRIPTION
-----------

**ganeti-rapi** is the daemon providing a remote API for Ganeti
clusters.

It is automatically started on the master node, and by default it
uses SSL encryption. This can be disabled by passing the
``--no-ssl`` option, or alternatively the certificate used can be
changed via the ``-C`` option and the key via the ``-K`` option.

The daemon will listen to the "ganeti-rapi" TCP port, as listed in the
system services database, or if not defined, to port 5080 by default.
The port can be overridded by passing the ``-p`` option. The ``-b``
option can be used to specify the address to bind to (defaults to
``0.0.0.0``). Note that if you specify the address, the watcher
needs to be informed about it using its option ``--rapi-ip``, otherwise
it will not be able to reach the RAPI interface and will attempt to
restart it all the time. Alternatively to setting the IP with ``--b``,
the ``-i`` option can be used to specify the interface to bind do.

See the *Ganeti remote API* documentation for further information.

Requests are logged to ``@LOCALSTATEDIR@/log/ganeti/rapi-daemon.log``,
in the same format as for the node and master daemon.

ACCESS CONTROLS
---------------

Most query operations are allowed without authentication. Only the
modification operations require authentication, in the form of basic
authentication. Specify the ``--require-authentication`` command line
flag to always require authentication.

The users and their rights are defined in the
``@LOCALSTATEDIR@/lib/ganeti/rapi/users`` file. The format of this file
is described in the Ganeti documentation (``rapi.html``).

.. vim: set textwidth=72 :
.. Local Variables:
.. mode: rst
.. fill-column: 72
.. End:


text:
      document.addEventListener('HTMLImportsLoaded', function() {
        var baseURI = location.href.replace('base/load-base.html', '').replace(location.search, '');
        chai.assert.equal(document.baseURI, baseURI, 'document.baseURI is correctly modified by base element');
        //
        chai.assert.equal(loadEvents, 3, 'expected # of load events');
        var test1 = getComputedStyle(document.querySelector('#test1')).backgroundColor;
        chai.assert.equal(test1, 'rgb(255, 0, 0)');
        var test2 = getComputedStyle(document.querySelector('#test2')).backgroundColor;
        chai.assert.equal(test2, 'rgb(0, 0, 255)');
        done();
      });


text:
// Copyright 2021 The Oppia Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * @fileoverview Component for the misconception editor.
 */

import { ChangeDetectorRef, Component, Input, OnInit } from '@angular/core';
import { downgradeComponent } from '@angular/upgrade/static';
import cloneDeep from 'lodash/cloneDeep';
import { AppConstants } from 'app.constants';
import { SkillUpdateService } from 'domain/skill/skill-update.service';
import { SkillEditorStateService } from 'pages/skill-editor-page/services/skill-editor-state.service';
import { Skill } from 'domain/skill/SkillObjectFactory';

interface MisconceptionFormSchema {
  type: 'html';
  'ui_config': object;
}

interface Container {
  'misconceptionName': string;
  'misconceptionNotes': string;
  'misconceptionFeedback': string;
  'misconceptionMustBeAddressed': boolean;
}

@Component({
  selector: 'oppia-misconception-editor',
  templateUrl: './misconception-editor.component.html'
})
export class MisconceptionEditorComponent implements OnInit {
  @Input() getIndex: string;
  @Input() isEditable: boolean;
  @Input() misconception;
  nameMemento: string;
  notesMemento: string;
  feedbackMemento: string;
  container: Container;
  skill: Skill;
  MAX_CHARS_IN_MISCONCEPTION_NAME: number;
  nameEditorIsOpen: boolean;
  notesEditorIsOpen: boolean;
  feedbackEditorIsOpen: boolean;
  NOTES_FORM_SCHEMA: MisconceptionFormSchema = {
    type: 'html',
    ui_config: {}
  };

  FEEDBACK_FORM_SCHEMA: MisconceptionFormSchema = {
    type: 'html',
    ui_config: {
      hide_complex_extensions: 'true'
    }
  };

  constructor(
    private changeDetectorRef: ChangeDetectorRef,
    private skillEditorStateService: SkillEditorStateService,
    private skillUpdateService: SkillUpdateService,
  ) {}

  ngOnInit(): void {
    this.skill = this.skillEditorStateService.getSkill();
    this.MAX_CHARS_IN_MISCONCEPTION_NAME = (
      AppConstants.MAX_CHARS_IN_MISCONCEPTION_NAME);
    this.nameEditorIsOpen = false;
    this.notesEditorIsOpen = false;
    this.feedbackEditorIsOpen = false;

    this.container = {
      misconceptionName: this.misconception.getName(),
      misconceptionNotes: this.misconception.getNotes(),
      misconceptionFeedback: this.misconception.getFeedback(),
      misconceptionMustBeAddressed: this.misconception.isMandatory()
    };
  }

  // Remove these function when the schema-based editor
  // is migrated to Angular 2+.
  getSchemaNotes(): MisconceptionFormSchema {
    return this.NOTES_FORM_SCHEMA;
  }

  getSchemaFeedback(): MisconceptionFormSchema {
    return this.FEEDBACK_FORM_SCHEMA;
  }

  updateLocalNotes($event: string): void {
    if (this.container.misconceptionNotes !== $event) {
      this.container.misconceptionNotes = $event;
      this.changeDetectorRef.detectChanges();
    }
  }

  updateLocalFeedback($event: string): void {
    if (this.container.misconceptionFeedback !== $event) {
      this.container.misconceptionFeedback = $event;
      this.changeDetectorRef.detectChanges();
    }
  }

  openNameEditor(): void {
    if (this.isEditable) {
      this.nameMemento = cloneDeep(
        this.container.misconceptionName);
      this.nameEditorIsOpen = true;
    }
  }

  openNotesEditor(): void {
    if (this.isEditable) {
      this.notesMemento = cloneDeep(
        this.container.misconceptionNotes);
      this.notesEditorIsOpen = true;
    }
  }

  openFeedbackEditor(): void {
    if (this.isEditable) {
      this.feedbackMemento = cloneDeep(
        this.container.misconceptionFeedback);
      this.feedbackEditorIsOpen = true;
    }
  }

  saveName(): void {
    this.nameEditorIsOpen = false;
    let nameHasChanged = (
      this.nameMemento !==
      this.container.misconceptionName);

    if (nameHasChanged) {
      this.skillUpdateService.updateMisconceptionName(
        this.skill,
        this.misconception.getId(),
        this.nameMemento,
        this.container.misconceptionName);
      this.nameMemento = null;
    }
  }

  saveNotes(): void {
    this.notesEditorIsOpen = false;
    let notesHasChanged = (
      this.notesMemento !==
      this.container.misconceptionNotes);

    if (notesHasChanged) {
      this.skillUpdateService.updateMisconceptionNotes(
        this.skill,
        this.misconception.getId(),
        this.notesMemento,
        this.container.misconceptionNotes);
      this.notesMemento = null;
    }
  }

  updateMustBeAddressed(): void {
    this.skillUpdateService.updateMisconceptionMustBeAddressed(
      this.skill,
      this.misconception.getId(),
      !this.container.misconceptionMustBeAddressed,
      this.container.misconceptionMustBeAddressed);
  }

  saveFeedback(): void {
    this.feedbackEditorIsOpen = false;
    var feedbackHasChanged = (
      this.feedbackMemento !==
      this.container.misconceptionFeedback);

    if (feedbackHasChanged) {
      this.skillUpdateService.updateMisconceptionFeedback(
        this.skill,
        this.misconception.getId(),
        this.feedbackMemento,
        this.container.misconceptionFeedback);
      this.feedbackMemento = null;
    }
  }

  cancelEditName(): void {
    this.container.misconceptionName = this.nameMemento;
    this.nameMemento = null;
    this.nameEditorIsOpen = false;
  }

  cancelEditNotes(): void {
    this.container.misconceptionNotes = this.notesMemento;
    this.notesMemento = null;
    this.notesEditorIsOpen = false;
  }

  cancelEditFeedback(): void {
    this.container.misconceptionFeedback = this.feedbackMemento;
    this.feedbackMemento = null;
    this.feedbackEditorIsOpen = false;
  }
}

angular.module('oppia').directive('oppiaMisconceptionEditor',
  downgradeComponent({component: MisconceptionEditorComponent}));


text:
// The MIT License (MIT)
//
// Copyright (c) 2018 Robert C. Seacord
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

using System;

namespace DerivedDisposable
{
  internal class BaseDisposable : IDisposable
  {
    // Flag: Has Dispose already been called?
    private bool _disposed = false;

    // Public implementation of Dispose pattern callable by consumers.
    public void Dispose()
    {
      Dispose(true);
      GC.SuppressFinalize(this);
    }

    // Protected implementation of Dispose pattern.
    protected virtual void Dispose(bool disposing)
    {
      Console.WriteLine("BaseDisposable:Dispose disposing = {0}", disposing);
      if (_disposed)
        return;

      if (disposing)
      {
        // Free any other managed objects here.
      }

      // Free any unmanaged objects here.
      _disposed = true;
    }

    ~BaseDisposable()
    {
      Console.WriteLine("~BaseDisposable");
      Dispose(false);
    }
  }

  internal class DerivedDisposable : BaseDisposable
  {
    // Flag: Has Dispose already been called?
    private bool _disposed = false;

    // Protected implementation of Dispose pattern.
    protected override void Dispose(bool disposing)
    {
      Console.WriteLine("DerivedDisposable:Dispose disposing = {0}", disposing);
      if (_disposed)
        return;

      if (disposing)
      {
        // Free any other managed objects here.
      }

      // Free any unmanaged objects here.
      _disposed = true;

      // Call the base class implementation.
      base.Dispose(disposing);
    }

    ~DerivedDisposable()
    {
      Console.WriteLine("~DerivedDisposable");
      Dispose(false);
    }
  }

  public class Program
  {
    private static void F()
    {
      DerivedDisposable dd = new DerivedDisposable();
    }
    private static void Main()
    {
      F();
      GC.Collect();
      GC.WaitForPendingFinalizers();

      // Keep the console window open in debug mode.
      Console.WriteLine("Press any key to exit.");
      Console.ReadKey();
    }

  }  // end class FileStreamHolder

}