diff options
Diffstat (limited to 'erts/lib_src')
-rw-r--r-- | erts/lib_src/Makefile.in | 109 | ||||
-rw-r--r-- | erts/lib_src/common/erl_misc_utils.c | 13 | ||||
-rw-r--r-- | erts/lib_src/common/erl_printf_format.c | 88 | ||||
-rw-r--r-- | erts/lib_src/common/ethr_mutex.c | 10 |
4 files changed, 118 insertions, 102 deletions
diff --git a/erts/lib_src/Makefile.in b/erts/lib_src/Makefile.in index aed889eaef..0fc3ac6efc 100644 --- a/erts/lib_src/Makefile.in +++ b/erts/lib_src/Makefile.in @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2004-2012. All Rights Reserved. +# Copyright Ericsson AB 2004-2013. All Rights Reserved. # # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in @@ -17,6 +17,7 @@ # %CopyrightEnd% # +include $(ERL_TOP)/make/output.mk include $(ERL_TOP)/make/target.mk include ../include/internal/$(TARGET)/ethread.mk @@ -326,6 +327,7 @@ _create_dirs := $(shell mkdir -p $(CREATE_DIRS)) all: $(OBJ_DIR)/MADE $(OBJ_DIR)/MADE: $(ETHREAD_LIB) $(ERTS_LIBS) $(ERTS_INTERNAL_LIBS) + $(gen_verbose) ifeq ($(OMIT_OMIT_FP),yes) @echo '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *' @echo '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *' @@ -335,7 +337,7 @@ ifeq ($(OMIT_OMIT_FP),yes) @echo '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *' @echo '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *' endif - echo $? > $(OBJ_DIR)/MADE + $(V_at)echo $? > $(OBJ_DIR)/MADE # # The libs ... @@ -345,93 +347,97 @@ AR_OUT=-out: AR_FLAGS= else AR_OUT= +ifeq ($(V),0) +AR_FLAGS=rc +else AR_FLAGS=rcv endif +endif ifndef RANLIB RANLIB=true endif $(ETHREAD_LIB): $(ETHREAD_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ETHREAD_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ETHREAD_LIB_OBJS) + $(V_RANLIB) $@ $(ERTS_INTERNAL_LIB): $(ERTS_INTERNAL_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_INTERNAL_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_INTERNAL_LIB_OBJS) + $(V_RANLIB) $@ $(ERTS_INTERNAL_r_LIB): $(ERTS_INTERNAL_r_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_INTERNAL_r_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_INTERNAL_r_LIB_OBJS) + $(V_RANLIB) $@ $(ERTS_MD_LIB): $(ERTS_MD_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MD_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MD_LIB_OBJS) + $(V_RANLIB) $@ $(ERTS_MDd_LIB): $(ERTS_MDd_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MDd_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MDd_LIB_OBJS) + $(V_RANLIB) $@ $(ERTS_MT_LIB): $(ERTS_MT_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MT_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MT_LIB_OBJS) + $(V_RANLIB) $@ $(ERTS_MTd_LIB): $(ERTS_MTd_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MTd_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_MTd_LIB_OBJS) + $(V_RANLIB) $@ $(ERTS_r_LIB): $(ERTS_r_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_r_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_r_LIB_OBJS) + $(V_RANLIB) $@ $(ERTS_LIB): $(ERTS_LIB_OBJS) - $(AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_LIB_OBJS) - $(RANLIB) $@ + $(V_AR) $(AR_FLAGS) $(AR_OUT)$@ $(ERTS_LIB_OBJS) + $(V_RANLIB) $@ # # Object files # $(r_OBJ_DIR)/ethr_x86_sse2_asm.o: pthread/ethr_x86_sse2_asm.c - $(CC) -msse2 $(THR_DEFS) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(V_CC) -msse2 $(THR_DEFS) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(r_OBJ_DIR)/%.o: common/%.c - $(CC) $(THR_DEFS) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(r_OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c - $(CC) $(THR_DEFS) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(OBJ_DIR)/%.o: common/%.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(V_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(V_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ # Win32 specific $(MD_OBJ_DIR)/%.o: common/%.c - $(CC) $(THR_DEFS) $(CFLAGS) -MD $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) -MD $(INCLUDES) -c $< -o $@ $(MD_OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c - $(CC) $(THR_DEFS) $(CFLAGS) -MD $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) -MD $(INCLUDES) -c $< -o $@ $(MDd_OBJ_DIR)/%.o: common/%.c - $(CC) $(THR_DEFS) $(CFLAGS) -MDd $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) -MDd $(INCLUDES) -c $< -o $@ $(MDd_OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c - $(CC) $(THR_DEFS) $(CFLAGS) -MDd $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) -MDd $(INCLUDES) -c $< -o $@ $(MT_OBJ_DIR)/%.o: common/%.c - $(CC) $(THR_DEFS) $(CFLAGS) -MT $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) -MT $(INCLUDES) -c $< -o $@ $(MT_OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c - $(CC) $(THR_DEFS) $(CFLAGS) -MT $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) -MT $(INCLUDES) -c $< -o $@ $(MTd_OBJ_DIR)/%.o: common/%.c - $(CC) $(THR_DEFS) $(CFLAGS) -MTd $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) -MTd $(INCLUDES) -c $< -o $@ $(MTd_OBJ_DIR)/%.o: $(ETHR_THR_LIB_BASE_DIR)/%.c - $(CC) $(THR_DEFS) $(CFLAGS) -MTd $(INCLUDES) -c $< -o $@ + $(V_CC) $(THR_DEFS) $(CFLAGS) -MTd $(INCLUDES) -c $< -o $@ # # Install @@ -560,18 +566,19 @@ DEPEND_MK=$(OBJ_DIR)/depend.mk .PHONY: depend depend: $(DEPEND_MK) $(DEPEND_MK): - @echo "Generating dependency file $(DEPEND_MK)..." + $(gen_verbose) + $(V_colon)@echo "Generating dependency file $(DEPEND_MK)..." @echo "# Generated dependency rules" > $(DEPEND_MK); @echo "# " >> $(DEPEND_MK); ifneq ($(strip $(ETHREAD_LIB_SRC)),) @echo "# ethread lib objects..." >> $(DEPEND_MK); ifeq ($(USING_VC),yes) - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ETHREAD_LIB_SRC) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ETHREAD_LIB_SRC) \ | $(SED_MD_DEPEND) >> $(DEPEND_MK) - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ETHREAD_LIB_SRC) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ETHREAD_LIB_SRC) \ | $(SED_MDd_DEPEND) >> $(DEPEND_MK) else - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ETHREAD_LIB_SRC) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ETHREAD_LIB_SRC) \ | $(SED_r_DEPEND) >> $(DEPEND_MK) endif endif @@ -579,54 +586,54 @@ ifneq ($(strip $(ERTS_INTERNAL_LIB_SRCS)),) ifneq ($(strip $(ETHREAD_LIB_SRC)),) @echo "# erts_internal_r lib objects..." >> $(DEPEND_MK); ifeq ($(USING_VC),yes) - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ | $(SED_MD_DEPEND) >> $(DEPEND_MK) - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ | $(SED_MDd_DEPEND) >> $(DEPEND_MK) else - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ | $(SED_r_DEPEND) >> $(DEPEND_MK) endif endif @echo "# erts_internal lib objects..." >> $(DEPEND_MK); ifeq ($(USING_VC),yes) - $(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ | $(SED_MD_DEPEND) >> $(DEPEND_MK) - $(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ | $(SED_MDd_DEPEND) >> $(DEPEND_MK) else - $(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ | $(SED_DEPEND) >> $(DEPEND_MK) endif endif ifneq ($(strip $(ERTS_LIB_SRCS)),) ifeq ($(USING_VC),yes) @echo "# erts_MD lib objects..." >> $(DEPEND_MK); - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ | $(SED_MD_DEPEND) >> $(DEPEND_MK) @echo "# erts_MDd lib objects..." >> $(DEPEND_MK); - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ | $(SED_MDd_DEPEND) >> $(DEPEND_MK) @echo "# erts_MT lib objects..." >> $(DEPEND_MK); - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ | $(SED_MT_DEPEND) >> $(DEPEND_MK) @echo "# erts_MTd lib objects..." >> $(DEPEND_MK); - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ | $(SED_MTd_DEPEND) >> $(DEPEND_MK) @echo "# erts_internal_r lib objects..." >> $(DEPEND_MK); - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ | $(SED_MD_DEPEND) >> $(DEPEND_MK) @echo "# erts_internal_r.debug lib objects..." >> $(DEPEND_MK); - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_INTERNAL_LIB_SRCS) \ | $(SED_MDd_DEPEND) >> $(DEPEND_MK) else ifneq ($(strip $(ETHREAD_LIB_SRC)),) @echo "# erts_r lib objects..." >> $(DEPEND_MK); - $(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(THR_DEFS) $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ | $(SED_r_DEPEND) >> $(DEPEND_MK) endif @echo "# erts lib objects..." >> $(DEPEND_MK); - $(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ + $(V_at)$(DEP_CC) -MM $(DEP_FLAGS) $(ERTS_LIB_SRCS) \ | $(SED_DEPEND) >> $(DEPEND_MK) endif endif diff --git a/erts/lib_src/common/erl_misc_utils.c b/erts/lib_src/common/erl_misc_utils.c index 3b123063fa..b32681f40e 100644 --- a/erts/lib_src/common/erl_misc_utils.c +++ b/erts/lib_src/common/erl_misc_utils.c @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2006-2012. All Rights Reserved. + * Copyright Ericsson AB 2006-2013. All Rights Reserved. * * The contents of this file are subject to the Erlang Public License, * Version 1.1, (the "License"); you may not use this file except in @@ -124,6 +124,12 @@ #include <sys/sysctl.h> #endif +/* Simplify include for static functions */ + +#if defined(__linux__) || defined(HAVE_KSTAT) || defined(__WIN32__) || defined(__FreeBSD__) +# define ERTS_CPU_TOPOLOGY_ENABLED (1) +#endif + static int read_topology(erts_cpu_info_t *cpuinfo); #if defined(ERTS_HAVE_MISC_UTIL_AFFINITY_MASK__) @@ -186,7 +192,8 @@ struct erts_cpu_info_t_ { static __forceinline int get_proc_affinity(erts_cpu_info_t *cpuinfo, cpu_set_t *cpuset) { - DWORD pamask, samask; + DWORD_PTR pamask; + DWORD_PTR samask; if (GetProcessAffinityMask(GetCurrentProcess(), &pamask, &samask)) { *cpuset = (cpu_set_t) pamask; return 0; @@ -669,6 +676,7 @@ erts_unbind_from_cpu_str(char *str) } +#if defined(ERTS_CPU_TOPOLOGY_ENABLED) static int pn_cmp(const void *vx, const void *vy) { @@ -759,6 +767,7 @@ adjust_processor_nodes(erts_cpu_info_t *cpuinfo, int no_nodes) } } } +#endif #ifdef __linux__ diff --git a/erts/lib_src/common/erl_printf_format.c b/erts/lib_src/common/erl_printf_format.c index fd25cce7ed..d6ae76f14c 100644 --- a/erts/lib_src/common/erl_printf_format.c +++ b/erts/lib_src/common/erl_printf_format.c @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2005-2012. All Rights Reserved. + * Copyright Ericsson AB 2005-2013. All Rights Reserved. * * The contents of this file are subject to the Erlang Public License, * Version 1.1, (the "License"); you may not use this file except in @@ -165,7 +165,7 @@ static char heX[] = "0123456789ABCDEF"; #define SIGN(X) ((X) > 0 ? 1 : ((X) < 0 ? -1 : 0)) #define USIGN(X) ((X) == 0 ? 0 : 1) -int (*erts_printf_eterm_func)(fmtfn_t, void*, unsigned long, long, unsigned long*) = NULL; +int (*erts_printf_eterm_func)(fmtfn_t, void*, ErlPfEterm, long, ErlPfEterm*) = NULL; static int noop_fn(void *vfp, char* buf, size_t len) @@ -234,7 +234,7 @@ static int fmt_fld(fmtfn_t fn,void* arg, return 0; } -static int fmt_long(fmtfn_t fn,void* arg,int sign,unsigned long uval, +static int fmt_uword(fmtfn_t fn,void* arg,int sign,ErlPfUWord uval, int width,int precision,int fmt,int* count) { char buf[32]; @@ -335,11 +335,11 @@ static int fmt_double(fmtfn_t fn,void*arg,double val, int fi = 0; char format_str[7]; char sbuf[32]; - char *bufp; + char *bufp = sbuf; double dexp; int exp; size_t max_size = 1; - size_t size; + int size; int new_fmt = fmt; int fpe_was_unmasked; @@ -425,12 +425,12 @@ static int fmt_double(fmtfn_t fn,void*arg,double val, max_size++; /* '\0' */ - if (max_size < sizeof(sbuf)) - bufp = sbuf; - else { + if (max_size >= sizeof(sbuf)) { bufp = (char *) malloc(sizeof(char)*max_size); if (!bufp) { res = -ENOMEM; + /* Make sure not to trigger free */ + bufp = sbuf; goto out; } } @@ -448,10 +448,10 @@ static int fmt_double(fmtfn_t fn,void*arg,double val, res = fmt_fld(fn, arg, bufp, size, 0, width, 0, new_fmt, count); + out: if (bufp != sbuf) free((void *) bufp); - out: if (erts_printf_unblock_fpe) (*erts_printf_unblock_fpe)(fpe_was_unmasked); return res; @@ -475,7 +475,7 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) int res = 0; while(*ptr) { - unsigned long ul_val; + ErlPfUWord ul_val; int fmt = 0; int width = -1; int precision = -1; @@ -661,22 +661,22 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) switch(fmt & FMTL_MASK) { case FMTL_hh: { signed char tval = (signed char) va_arg(ap,int); - ul_val = (unsigned long) (tval < 0 ? (-tval) : tval); - res = fmt_long(fn,arg,SIGN(tval),ul_val, + ul_val = (ErlPfUWord) (tval < 0 ? (-tval) : tval); + res = fmt_uword(fn,arg,SIGN(tval),ul_val, width,precision,fmt,&count); break; } case FMTL_h: { signed short tval = (signed short) va_arg(ap,int); - ul_val = (unsigned long) (tval < 0 ? (-tval) : tval); - res = fmt_long(fn,arg,SIGN(tval),ul_val, + ul_val = (ErlPfUWord) (tval < 0 ? (-tval) : tval); + res = fmt_uword(fn,arg,SIGN(tval),ul_val, width,precision,fmt,&count); break; } case FMTL_l: { signed long tval = (signed long) va_arg(ap,long); - ul_val = (unsigned long) (tval < 0 ? (-tval) : tval); - res = fmt_long(fn,arg,SIGN(tval),ul_val, + ul_val = (ErlPfUWord) (tval < 0 ? (-tval) : tval); + res = fmt_uword(fn,arg,SIGN(tval),ul_val, width,precision,fmt,&count); break; } @@ -693,8 +693,8 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) #endif default: { signed int tval = (signed int) va_arg(ap,int); - ul_val = (unsigned long) (tval < 0 ? (-tval) : tval); - res = fmt_long(fn,arg,SIGN(tval),ul_val, + ul_val = (ErlPfUWord) (tval < 0 ? (-tval) : tval); + res = fmt_uword(fn,arg,SIGN(tval),ul_val, width,precision,fmt,&count); break; } @@ -707,21 +707,21 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) switch(fmt & FMTL_MASK) { case FMTL_hh: { unsigned char tval = (unsigned char) va_arg(ap,int); - ul_val = (unsigned long) tval; - res = fmt_long(fn,arg,USIGN(tval),ul_val, + ul_val = (ErlPfUWord) tval; + res = fmt_uword(fn,arg,USIGN(tval),ul_val, width,precision,fmt,&count); break; } case FMTL_h: { unsigned short tval = (unsigned short) va_arg(ap,int); - ul_val = (unsigned long) tval; - res = fmt_long(fn,arg,USIGN(tval),ul_val, + ul_val = (ErlPfUWord) tval; + res = fmt_uword(fn,arg,USIGN(tval),ul_val, width,precision,fmt,&count); break; } case FMTL_l: { - ul_val = (unsigned long) va_arg(ap,long); - res = fmt_long(fn,arg,USIGN(ul_val),ul_val, + ul_val = (ErlPfUWord) va_arg(ap,long); + res = fmt_uword(fn,arg,USIGN(ul_val),ul_val, width,precision,fmt,&count); break; } @@ -736,8 +736,8 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) #endif default: { unsigned int tval = (unsigned int) va_arg(ap,int); - ul_val = (unsigned long) tval; - res = fmt_long(fn,arg,USIGN(tval),ul_val, + ul_val = (ErlPfUWord) tval; + res = fmt_uword(fn,arg,USIGN(tval),ul_val, width,precision,fmt,&count); break; } @@ -795,10 +795,10 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) case FMTC_p: { void* addr = va_arg(ap, void*); - res = fmt_long(fn, + res = fmt_uword(fn, arg, - USIGN((unsigned long) addr), - (unsigned long) addr, + USIGN((ErlPfUWord) addr), + (ErlPfUWord) addr, width < 0 ? ((int) 2*sizeof(void *)) : width, (precision < 0 ? ((int) 2*sizeof(void *)) @@ -822,8 +822,8 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) case FMTC_T: /* Eterm */ case FMTC_R: { /* Eterm, Eterm* base (base ignored if !HALFWORD_HEAP) */ long prec; - unsigned long eterm; - unsigned long* eterm_base; + ErlPfEterm eterm; + ErlPfEterm* eterm_base; if (!erts_printf_eterm_func) return -EINVAL; @@ -833,9 +833,9 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap) prec = LONG_MAX; else prec = (long) precision; - eterm = va_arg(ap, unsigned long); + eterm = va_arg(ap, ErlPfEterm); eterm_base = ((fmt & FMTC_MASK) == FMTC_R) ? - va_arg(ap, unsigned long*) : NULL; + va_arg(ap, ErlPfEterm*) : NULL; if (width > 0 && !(fmt & FMTF_adj)) { res = (*erts_printf_eterm_func)(noop_fn, NULL, eterm, prec, eterm_base); if (res < 0) @@ -890,8 +890,8 @@ int erts_printf_pointer(fmtfn_t fn, void *arg, void *ptr) { int count = 0; - int res = fmt_long(fn, arg, USIGN((unsigned long) ptr), - (unsigned long) ptr, 2*sizeof(void *), + int res = fmt_uword(fn, arg, USIGN((ErlPfUWord) ptr), + (ErlPfUWord) ptr, 2*sizeof(void *), 2*sizeof(void *), FMTC_x|FMTF_pad|FMTF_alt, &count); if (res < 0) return res; @@ -899,8 +899,8 @@ erts_printf_pointer(fmtfn_t fn, void *arg, void *ptr) } int -erts_printf_ulong(fmtfn_t fn, void *arg, char conv, int pad, int width, - unsigned long val) +erts_printf_uword(fmtfn_t fn, void *arg, char conv, int pad, int width, + ErlPfUWord val) { int count = 0; int res; @@ -917,21 +917,21 @@ erts_printf_ulong(fmtfn_t fn, void *arg, char conv, int pad, int width, } if (pad) prec = width; - res = fmt_long(fn, arg, USIGN(val), val, width, prec, fmt, &count); + res = fmt_uword(fn, arg, USIGN(val), val, width, prec, fmt, &count); if (res < 0) return res; return count; } -extern int -erts_printf_slong(fmtfn_t fn, void *arg, char conv, int pad, int width, - signed long val) +int +erts_printf_sword(fmtfn_t fn, void *arg, char conv, int pad, int width, + ErlPfSWord val) { int count = 0; int res; int fmt = 0; int prec = -1; - unsigned long ul_val; + ErlPfUWord ul_val; switch (conv) { case 'd': fmt |= FMTC_d; break; case 'i': fmt |= FMTC_d; break; @@ -943,8 +943,8 @@ erts_printf_slong(fmtfn_t fn, void *arg, char conv, int pad, int width, } if (pad) prec = width; - ul_val = (unsigned long) (val < 0 ? -val : val); - res = fmt_long(fn, arg, SIGN(val), ul_val, width, prec, fmt, &count); + ul_val = (ErlPfUWord) (val < 0 ? -val : val); + res = fmt_uword(fn, arg, SIGN(val), ul_val, width, prec, fmt, &count); if (res < 0) return res; return count; diff --git a/erts/lib_src/common/ethr_mutex.c b/erts/lib_src/common/ethr_mutex.c index e363279f2e..036914af7b 100644 --- a/erts/lib_src/common/ethr_mutex.c +++ b/erts/lib_src/common/ethr_mutex.c @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2010-2011. All Rights Reserved. + * Copyright Ericsson AB 2010-2013. All Rights Reserved. * * The contents of this file are subject to the Erlang Public License, * Version 1.1, (the "License"); you may not use this file except in @@ -692,7 +692,7 @@ write_lock_wait(struct ethr_mutex_base_ *mtxb, goto chk_spin; if (--until_yield == 0) { until_yield = ETHR_YIELD_AFTER_BUSY_LOOPS; - ETHR_YIELD(); + (void) ETHR_YIELD(); } } @@ -711,7 +711,7 @@ write_lock_wait(struct ethr_mutex_base_ *mtxb, ETHR_SPIN_BODY; if (--until_yield == 0) { until_yield = ETHR_YIELD_AFTER_BUSY_LOOPS; - ETHR_YIELD(); + (void) ETHR_YIELD(); } act = ethr_atomic32_read(&mtxb->flgs); scnt--; @@ -2161,7 +2161,7 @@ rwmutex_normal_rlock_wait(ethr_rwmutex *rwmtx, ethr_sint32_t initial) ETHR_SPIN_BODY; if (--until_yield == 0) { until_yield = ETHR_YIELD_AFTER_BUSY_LOOPS; - ETHR_YIELD(); + (void) ETHR_YIELD(); } act = ethr_atomic32_read(&rwmtx->mtxb.flgs); scnt--; @@ -2288,7 +2288,7 @@ rwmutex_freqread_rlock_wait(ethr_rwmutex *rwmtx, ETHR_SPIN_BODY; if (--until_yield == 0) { until_yield = ETHR_YIELD_AFTER_BUSY_LOOPS; - ETHR_YIELD(); + (void) ETHR_YIELD(); } act = ethr_atomic32_read(&rwmtx->mtxb.flgs); scnt--; |