⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 global.h

📁 OTP是开放电信平台的简称
💻 H
📖 第 1 页 / 共 4 页
字号:
ERTS_GLB_INLINE int next_time(void);ERTS_GLB_INLINE void bump_timer(long);#elseint next_time(void);void bump_timer(long);extern erts_smp_atomic_t do_time;	/* set at clock interrupt */ERTS_GLB_INLINE void do_time_add(long);#endif#if ERTS_GLB_INLINE_INCL_FUNC_DEF#ifdef ERTS_TIMER_THREADERTS_GLB_INLINE long do_time_read_and_reset(void) { return 0; }ERTS_GLB_INLINE int next_time(void) { return -1; }ERTS_GLB_INLINE void bump_timer(long ignore) { }#elseERTS_GLB_INLINE long do_time_read_and_reset(void){    return erts_smp_atomic_xchg(&do_time, 0L);}ERTS_GLB_INLINE void do_time_add(long elapsed){    erts_smp_atomic_add(&do_time, elapsed);}#endif#endif /* #if ERTS_GLB_INLINE_INCL_FUNC_DEF */void init_time(void);void erl_set_timer(ErlTimer*, ErlTimeoutProc, ErlCancelProc, void*, Uint);void erl_cancel_timer(ErlTimer*);Uint time_left(ErlTimer *);Uint erts_timer_wheel_memory_size(void);#if (defined(HAVE_GETHRVTIME) || defined(HAVE_CLOCK_GETTIME))#  ifndef HAVE_ERTS_NOW_CPU#    define HAVE_ERTS_NOW_CPU#    ifdef HAVE_GETHRVTIME#      define erts_start_now_cpu() sys_start_hrvtime()#      define erts_stop_now_cpu()  sys_stop_hrvtime()#    endif#  endifvoid erts_get_now_cpu(Uint* megasec, Uint* sec, Uint* microsec);#endif#if defined(ERTS_TIMER_THREAD)void erts_get_timeval(SysTimeval *tv);#endiflong erts_get_time(void);#ifdef DEBUGvoid p_slpq(_VOID_);#endif/* utils.c */void erts_cleanup_offheap(ErlOffHeap *offheap);void erts_cleanup_externals(ExternalThing *);Uint erts_fit_in_bits(Uint);int list_length(Eterm);Export* erts_find_function(Eterm, Eterm, unsigned int);int erts_is_builtin(Eterm, Eterm, int);Uint32 make_broken_hash(Eterm, Uint32);Uint32 block_hash(byte *, unsigned, Uint32);Uint32 make_hash2(Eterm);Uint32 make_hash(Eterm, Uint32);Eterm erts_bld_atom(Uint **hpp, Uint *szp, char *str);Eterm erts_bld_uint(Uint **hpp, Uint *szp, Uint ui);Eterm erts_bld_cons(Uint **hpp, Uint *szp, Eterm car, Eterm cdr);Eterm erts_bld_tuple(Uint **hpp, Uint *szp, Uint arity, ...);Eterm erts_bld_tuplev(Uint **hpp, Uint *szp, Uint arity, Eterm terms[]);Eterm erts_bld_string(Uint **hpp, Uint *szp, char *str);Eterm erts_bld_list(Uint **hpp, Uint *szp, Sint length, Eterm terms[]);Eterm erts_bld_2tup_list(Uint **hpp, Uint *szp,			 Sint length, Eterm terms1[], Uint terms2[]);Eterm store_external_or_ref_in_proc_(Process *, Eterm);Eterm store_external_or_ref_(Uint **, ExternalThing **, Eterm);#define NC_HEAP_SIZE(NC) \ (ASSERT_EXPR(is_node_container((NC))), \  IS_CONST((NC)) ? 0 : (thing_arityval(*boxed_val((NC))) + 1))#define STORE_NC(Hpp, ETpp, NC) \ (ASSERT_EXPR(is_node_container((NC))), \  IS_CONST((NC)) ? (NC) : store_external_or_ref_((Hpp), (ETpp), (NC)))#define STORE_NC_IN_PROC(Pp, NC) \ (ASSERT_EXPR(is_node_container((NC))), \  IS_CONST((NC)) ? (NC) : store_external_or_ref_in_proc_((Pp), (NC)))void erts_init_utils(void);void erts_init_utils_mem(void);erts_dsprintf_buf_t *erts_create_tmp_dsbuf(Uint);void erts_destroy_tmp_dsbuf(erts_dsprintf_buf_t *);int eq(Eterm, Eterm);#define EQ(x,y) (((x) == (y)) || (is_not_both_immed((x),(y)) && eq((x),(y))))Sint cmp(Eterm, Eterm);#define cmp_lt(a,b)	(cmp((a),(b)) < 0)#define cmp_le(a,b)	(cmp((a),(b)) <= 0)#define cmp_eq(a,b)	(cmp((a),(b)) == 0)#define cmp_ne(a,b)	(cmp((a),(b)) != 0)#define cmp_ge(a,b)	(cmp((a),(b)) >= 0)#define cmp_gt(a,b)	(cmp((a),(b)) > 0)#define CMP_LT(a,b)	((a) != (b) && cmp_lt((a),(b)))#define CMP_GE(a,b)	((a) == (b) || cmp_ge((a),(b)))#define CMP_EQ(a,b)	((a) == (b) || cmp_eq((a),(b)))#define CMP_NE(a,b)	((a) != (b) && cmp_ne((a),(b)))int term_to_Uint(Eterm term, Uint *up);#ifdef HAVE_ERTS_NOW_CPUextern int erts_cpu_timestamp;#endif/* erl_trace.c */void erts_init_trace(void);void erts_trace_check_exiting(Eterm exiting);Eterm erts_set_system_seq_tracer(Process *c_p, Uint32 c_p_locks, Eterm new);Eterm erts_get_system_seq_tracer(void);void erts_change_default_tracing(int setflags, Uint *flagsp, Eterm *tracerp);void erts_get_default_tracing(Uint *flagsp, Eterm *tracerp);void erts_set_system_monitor(Eterm monitor);Eterm erts_get_system_monitor(void);#ifdef ERTS_SMPvoid erts_check_my_tracer_proc(Process *);void erts_block_sys_msg_dispatcher(void);void erts_release_sys_msg_dispatcher(void);void erts_foreach_sys_msg_in_q(void (*func)(Eterm,					    Eterm,					    Eterm,					    ErlHeapFragment *));void erts_queue_error_logger_message(Eterm, Eterm, ErlHeapFragment *);#endifvoid erts_send_sys_msg_proc(Eterm, Eterm, Eterm, ErlHeapFragment *);void trace_send(Process*, Eterm, Eterm);void trace_receive(Process*, Eterm);Uint32 erts_call_trace(Process *p, Eterm mfa[], Binary *match_spec, Eterm* args,		       int local, Eterm *tracer_pid);void erts_trace_return(Process* p, Eterm* fi, Eterm retval, Eterm *tracer_pid);void erts_trace_exception(Process* p, Eterm mfa[], Eterm class, Eterm value, 			  Eterm *tracer);void erts_trace_return_to(Process *p, Uint *pc);void trace_sched(Process*, Eterm);void trace_proc(Process*, Process*, Eterm, Eterm);void trace_proc_spawn(Process*, Eterm pid, Eterm mod, Eterm func, Eterm args);void save_calls(Process *p, Export *);void trace_gc(Process *p, Eterm what);void monitor_long_gc(Process *p, Uint time);void monitor_large_heap(Process *p);void monitor_generic(Process *p, Eterm type, Eterm spec);Uint erts_trace_flag2bit(Eterm flag);int erts_trace_flags(Eterm List, 		 Uint *pMask, Eterm *pTracer, int *pCpuTimestamp);Eterm erts_bif_trace(int bif_index, Process* p, 		     Eterm arg1, Eterm arg2, Eterm arg3, Uint *I);#ifdef ERTS_SMPvoid erts_send_pending_trace_msgs(ErtsSchedulerData *esdp);#define ERTS_SMP_CHK_PEND_TRACE_MSGS(ESDP)				\do {									\    if ((ESDP)->pending_trace_msgs)					\	erts_send_pending_trace_msgs((ESDP));				\} while (0)#else#define ERTS_SMP_CHK_PEND_TRACE_MSGS(ESDP)#endifint member(Eterm, Eterm);void bin_write(int, void*, byte*, int);int intlist_to_buf(Eterm, char*, int); /* most callers pass plain char*'s */struct Sint_buf {#ifdef ARCH_64    char s[22];#else    char s[12];#endif};	char* Sint_to_buf(Sint, struct Sint_buf*);Eterm buf_to_intlist(Eterm**, char*, int, Eterm); /* most callers pass plain char*'s */int io_list_to_buf(Eterm, char*, int);int io_list_to_buf2(Eterm, char*, int);int io_list_len(Eterm);int is_string(Eterm);void erl_at_exit(FUNCTION(void,(*),(void*)), void*);Eterm collect_memory(Process *);void dump_memory_to_fd(int);int dump_memory_data(const char *);Eterm erts_mixed_plus(Process* p, Eterm arg1, Eterm arg2);Eterm erts_mixed_minus(Process* p, Eterm arg1, Eterm arg2);Eterm erts_mixed_times(Process* p, Eterm arg1, Eterm arg2);Eterm erts_mixed_div(Process* p, Eterm arg1, Eterm arg2);Eterm erts_int_div(Process* p, Eterm arg1, Eterm arg2);Eterm erts_int_rem(Process* p, Eterm arg1, Eterm arg2);Eterm erts_band(Process* p, Eterm arg1, Eterm arg2);Eterm erts_bor(Process* p, Eterm arg1, Eterm arg2);Eterm erts_bxor(Process* p, Eterm arg1, Eterm arg2);Eterm erts_bnot(Process* p, Eterm arg);#if defined(HEAP_FRAG_ELIM_TEST)Eterm erts_gc_mixed_plus(Process* p, Eterm* reg, Uint live);Eterm erts_gc_mixed_minus(Process* p, Eterm* reg, Uint live);Eterm erts_gc_mixed_times(Process* p, Eterm* reg, Uint live);Eterm erts_gc_mixed_div(Process* p, Eterm* reg, Uint live);Eterm erts_gc_int_div(Process* p, Eterm* reg, Uint live);Eterm erts_gc_int_rem(Process* p, Eterm* reg, Uint live);Eterm erts_gc_band(Process* p, Eterm* reg, Uint live);Eterm erts_gc_bor(Process* p, Eterm* reg, Uint live);Eterm erts_gc_bxor(Process* p, Eterm* reg, Uint live);Eterm erts_gc_bnot(Process* p, Eterm* reg, Uint live);Eterm erts_gc_length_1(Process* p, Eterm* reg, Uint live);Eterm erts_gc_size_1(Process* p, Eterm* reg, Uint live);Eterm erts_gc_bitsize_1(Process* p, Eterm* reg, Uint live);Eterm erts_gc_abs_1(Process* p, Eterm* reg, Uint live);Eterm erts_gc_float_1(Process* p, Eterm* reg, Uint live);Eterm erts_gc_round_1(Process* p, Eterm* reg, Uint live);Eterm erts_gc_trunc_1(Process* p, Eterm* reg, Uint live);#endifUint erts_current_reductions(Process* current, Process *p);int erts_print_system_version(int to, void *arg, Process *c_p);/* * Interface to erl_init */void erl_init(void);void erts_first_process(Eterm modname, void* code, unsigned size, int argc, char** argv);#define seq_trace_output(token, msg, type, receiver, process) \seq_trace_output_generic((token), (msg), (type), (receiver), (process), NIL)#define seq_trace_output_exit(token, msg, type, receiver, exitfrom) \seq_trace_output_generic((token), (msg), (type), (receiver), NULL, (exitfrom))void seq_trace_output_generic(Eterm token, Eterm msg, Uint type, 			      Eterm receiver, Process *process, Eterm exitfrom);int seq_trace_update_send(Process *process);Eterm erts_seq_trace(Process *process, 		     Eterm atom_type, Eterm atom_true_or_false, 		     int build_result);struct trace_pattern_flags {    unsigned int breakpoint : 1; /* Set if any other is set */    unsigned int local      : 1; /* Local call trace breakpoint */    unsigned int meta       : 1; /* Metadata trace breakpoint */    unsigned int call_count : 1; /* Fast call count breakpoint */};extern const struct trace_pattern_flags erts_trace_pattern_flags_off;int erts_set_trace_pattern(Eterm* mfa, int specified, 			   Binary* match_prog_set, Binary *meta_match_prog_set,			   int on, struct trace_pattern_flags,			   Eterm meta_tracer_pid);voiderts_get_default_trace_pattern(int *trace_pattern_is_on,			       Binary **match_spec,			       Binary **meta_match_spec,			       struct trace_pattern_flags *trace_pattern_flags,			       Eterm *meta_tracer_pid);void erts_bif_trace_init(void);/*** Call_trace uses this API for the parameter matching functions*/    struct erl_heap_fragment* saved_program_buf;#define MatchSetRef(MPSP) 			\do {						\    if ((MPSP) != NULL) {			\	erts_refc_inc(&(MPSP)->refc, 1);	\    }						\} while (0)#define MatchSetUnref(MPSP)					\do {								\    if (((MPSP) != NULL) && erts_refc_dectest(&(MPSP)->refc, 0) <= 0) { \	erts_match_set_free(MPSP);				\    }								\} while(0)#define MatchSetGetSource(MPSP) erts_match_set_get_source(MPSP)extern Binary *erts_match_set_compile(Process *p, Eterm matchexpr);Eterm erts_match_set_lint(Process *p, Eterm matchexpr); extern void erts_match_set_release_result(Process* p);extern Eterm erts_match_set_run(Process *p, Binary *mpsp, 				Eterm *args, int num_args,				Uint32 *return_flags);extern void erts_match_set_free(Binary *mpsp);extern Eterm erts_match_set_get_source(Binary *mpsp);extern void erts_match_prog_foreach_offheap(Binary *b,					    void (*)(ErlOffHeap *, void *),					    void *);#define MATCH_SET_RETURN_TRACE 0x1 /* return trace requested */#define MATCH_SET_RETURN_TO_TRACE 0x2 /* Misleading name, it is not actually					 set by the match program, but by the					 breakpoint functions */#define MATCH_SET_EXCEPTION_TRACE 0x4 /* exception trace requested */#define MATCH_SET_RX_TRACE (MATCH_SET_RETURN_TRACE|MATCH_SET_EXCEPTION_TRACE)/* * Flag values when tracing bif */#define BIF_TRACE_AS_LOCAL  0x1#define BIF_TRACE_AS_GLOBAL 0x2#define BIF_TRACE_AS_META   0x4/* Should maybe be placed in erl_message.h, but then we get an include mess. */ERTS_GLB_INLINE Eterm *erts_alloc_message_heap(Uint size,			ErlHeapFragment **bpp,			ErlOffHeap **ohpp,			Process *receiver,			Uint32 *receiver_locks);#if ERTS_GLB_INLINE_INCL_FUNC_DEFERTS_GLB_INLINE Eterm *erts_alloc_message_heap(Uint size,			ErlHeapFragment **bpp,			ErlOffHeap **ohpp,			Process *receiver,			Uint32 *receiver_locks){#if !defined(ERTS_SMP) && !defined(HEAP_FRAG_ELIM_TEST)    *bpp = NULL;    *ohpp = &MSO(receiver);    return HAlloc(receiver, size);#else /* defined(ERTS_SMP) || defined(HEAP_FRAG_ELIM_TEST) */    Eterm *hp;    if (#if defined(ERTS_SMP)	*receiver_locks & ERTS_PROC_LOCK_MAIN#elif defined(HEAP_FRAG_ELIM_TEST)	1#endif	) {#ifdef ERTS_SMP    try_allocate_on_heap:#endif#ifdef HEAP_FRAG_ELIM_TEST	if (HEAP_LIMIT(receiver) - HEAP_TOP(receiver) <= size)	    goto allocate_in_mbuf;	hp = HEAP_TOP(receiver);	HEAP_TOP(receiver) = hp + size;#else	hp = HAlloc(receiver, size);#endif	*bpp = NULL;	*ohpp = &MSO(receiver);    }#ifdef ERTS_SMP    else if (erts_proc_trylock(receiver, ERTS_PROC_LOCK_MAIN) == 0) {	*receiver_locks |= ERTS_PROC_LOCK_MAIN;	goto try_allocate_on_heap;    }#endif    else {	ErlHeapFragment *bp;#ifdef HEAP_FRAG_ELIM_TEST    allocate_in_mbuf:#endif	bp = new_message_buffer(size);	hp = bp->mem;	*bpp = bp;	*ohpp = &bp->off_heap;    }    return hp;#endif}#endif /* #if ERTS_GLB_INLINE_INCL_FUNC_DEF */#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -