From cde6d564278dda9a806c7b5a220855e6f2fe778c Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Wed, 22 Nov 2017 14:57:35 +0900 Subject: [PATCH] Bump to procps-ng 3.3.12 [Model] All [BinType] AP [Customer] OPEN [Issue#] N/A [Request] N/A [Occurrence Version] N/A [Problem] version upgrade [Cause & Measure] procps-ng 3.3.9 -> 3.3.12 [Checking Method] procps-ng unit test [Team] Open Source Management and Setting Part [Developer] dh0128.kwak [Solution company] Samsung [Change Type] N/A Change-Id: I5d2ad77258d7f04f2bce8725a168541db204a2c2 Signed-off-by: DongHun Kwak --- configure.ac | 10 +++---- packaging/procps-ng.spec | 20 ++++++-------- proc/sysinfo.c | 69 +++++------------------------------------------- ps/global.c | 24 ++++++++--------- ps/sortformat.c | 12 ++++----- 5 files changed, 38 insertions(+), 97 deletions(-) diff --git a/configure.ac b/configure.ac index e553e99..4b92510 100644 --- a/configure.ac +++ b/configure.ac @@ -222,11 +222,11 @@ AC_ARG_ENABLE([numa], if test "x$enable_numa" = xno; then AC_DEFINE([NUMA_DISABLE], [1], [disable NUMA/Node support in top]) else - AC_SEARCH_LIBS([dlopen], [dl], [], - [AC_MSG_ERROR([dynamic linking unavailable, circumvent with --disable-numa])]) - if test "x$ac_cv_search_dlopen" != "xnone required"; then - DL_LIB="$ac_cv_search_dlopen" - fi + AC_CHECK_LIB(dl, dlopen, [have_dlopen=yes], [have_dlopen=no]) + if test "x$have_dlopen" = xno; then + AC_MSG_ERROR([dynamic linking unavailable, circumvent with --disable-numa]) + fi + DL_LIB="-ldl" fi AC_SUBST([DL_LIB]) diff --git a/packaging/procps-ng.spec b/packaging/procps-ng.spec index c539acd..bd428ba 100644 --- a/packaging/procps-ng.spec +++ b/packaging/procps-ng.spec @@ -1,7 +1,10 @@ -%global tests_enabled 0 +%if "%{run_tests}" == "1" + %define __spec_check_pre %___build_pre + %define check %%check +%endif Name: procps-ng -Version: 3.3.9 +Version: 3.3.12 Release: 1 License: GPL-2.0 and LGPL-2.0+ Summary: System and process monitoring utilities @@ -19,10 +22,6 @@ BuildRequires: gettext-devel BuildRequires: libtool BuildRequires: ncurses-devel -%if %{tests_enabled} -BuildRequires: dejagnu -%endif - Provides: procps = %{version} Obsoletes: procps < 3.3.4-1 @@ -77,10 +76,8 @@ LDFLAGS+=" -pie" make %{?_smp_mflags} -%if %{tests_enabled} %check -make check -%endif + make check || exit 0 %install @@ -88,21 +85,20 @@ make check mkdir -p %{buildroot}%{_sysconfdir}/sysctl.d rm -rf %{buildroot}/unwanted +%remove_docs %post -p /sbin/ldconfig %postun -p /sbin/ldconfig -%docs_package - %files %manifest %{name}.manifest %license COPYING COPYING.LIB %{_libdir}/libprocps.so.* %{_bindir}/* %{_sbindir}/* +%{_datadir}/locale/* %{_sysconfdir}/sysctl.d - %exclude %{_sysconfdir}/sysctl.conf %files devel diff --git a/proc/sysinfo.c b/proc/sysinfo.c index 1d2b8e2..1435de1 100644 --- a/proc/sysinfo.c +++ b/proc/sysinfo.c @@ -36,9 +36,6 @@ #include /* htons */ #endif -#include -#include - long smp_num_cpus; /* number of CPUs */ long page_bytes; /* this architecture's page size */ @@ -252,67 +249,15 @@ static void old_Hertz_hack(void){ extern char** environ; -static unsigned long find_elf_note(unsigned long type) -{ - ElfW(auxv_t) auxv_struct; - ElfW(auxv_t) *auxv_temp; - FILE *fd; - int i; - static ElfW(auxv_t) *auxv = NULL; +/* for ELF executables, notes are pushed before environment and args */ +static unsigned long find_elf_note(unsigned long findme){ unsigned long *ep = (unsigned long *)environ; - unsigned long ret_val = NOTE_NOT_FOUND; - - - if(!auxv) { - - fd = fopen("/proc/self/auxv", "rb"); - - if(!fd) { // can't open auxv? that could be caused by euid change - // ... and we need to fall back to the old and unsafe - // ... method that doesn't work when calling library - // ... functions with dlopen -> FIXME :( - - while(*ep++); // for ELF executables, notes are pushed - while(*ep){ // ... before environment and args - if(ep[0]==type) return ep[1]; - ep+=2; - } - return NOTE_NOT_FOUND; - } - - auxv = (ElfW(auxv_t) *) malloc(getpagesize()); - if (!auxv) { - perror("malloc"); - exit(EXIT_FAILURE); - } - - i = 0; - do { - fread(&auxv_struct, sizeof(ElfW(auxv_t)), 1, fd); - auxv[i] = auxv_struct; - i++; - } while (auxv_struct.a_type != AT_NULL); - - fclose(fd); - - } - - auxv_temp = auxv; - i = 0; - do { - if(auxv_temp[i].a_type == type) { - ret_val = (unsigned long)auxv_temp[i].a_un.a_val; - break; - } - i++; - } while (auxv_temp[i].a_type != AT_NULL); - - if (auxv){ - auxv_temp = NULL; - free(auxv); - auxv = NULL; + while(*ep++); + while(*ep){ + if(ep[0]==findme) return ep[1]; + ep+=2; } - return ret_val; + return NOTE_NOT_FOUND; } int have_privs; diff --git a/ps/global.c b/ps/global.c index 7ab7774..f2354e9 100644 --- a/ps/global.c +++ b/ps/global.c @@ -73,7 +73,7 @@ int lines_to_next_header = -1; int negate_selection = -1; int running_only = -1; int page_size = -1; // "int" for math reasons? -unsigned personality = 0xffffffff; +unsigned _personality = 0xffffffff; int prefer_bsd_defaults = -1; int screen_cols = -1; int screen_rows = -1; @@ -219,7 +219,7 @@ static const char *set_personality(void){ }; const int personality_table_count = sizeof(personality_table)/sizeof(personality_table_struct); - personality = 0; + _personality = 0; prefer_bsd_defaults = 0; bsd_j_format = "OL_j"; @@ -256,7 +256,7 @@ static const char *set_personality(void){ goto *(found->jump); /* See gcc extension info. :-) */ case_bsd: - personality = PER_FORCE_BSD | PER_BSD_h | PER_BSD_m; + _personality = PER_FORCE_BSD | PER_BSD_h | PER_BSD_m; prefer_bsd_defaults = 1; bsd_j_format = "FB_j"; bsd_l_format = "FB_l"; @@ -266,13 +266,13 @@ static const char *set_personality(void){ return NULL; case_old: - personality = PER_FORCE_BSD | PER_OLD_m; + _personality = PER_FORCE_BSD | PER_OLD_m; prefer_bsd_defaults = 1; return NULL; case_debian: /* Toss this? They don't seem to care much. */ case_gnu: - personality = PER_GOOD_o | PER_OLD_m; + _personality = PER_GOOD_o | PER_OLD_m; prefer_bsd_defaults = 1; sysv_f_format = "RD_f"; /* sysv_fl_format = "RD_fl"; */ /* old Debian ps can't do this! */ @@ -281,7 +281,7 @@ static const char *set_personality(void){ return NULL; case_linux: - personality = PER_GOOD_o | PER_ZAP_ADDR | PER_SANE_USER; + _personality = PER_GOOD_o | PER_ZAP_ADDR | PER_SANE_USER; return NULL; case_default: /* use defaults for ps, ignoring other environment variables */ @@ -301,7 +301,7 @@ static const char *set_personality(void){ case_digital: // no PER_NO_DEFAULT_g even though man page claims it // Reality: the g is a NOP - personality = PER_GOOD_o | PER_BSD_h; + _personality = PER_GOOD_o | PER_BSD_h; prefer_bsd_defaults = 1; sysv_f_format = "F5FMT"; sysv_fl_format = "FL5FMT"; @@ -315,7 +315,7 @@ static const char *set_personality(void){ return NULL; case_sunos4: - personality = PER_NO_DEFAULT_g; + _personality = PER_NO_DEFAULT_g; prefer_bsd_defaults = 1; bsd_j_format = "FB_j"; bsd_l_format = "FB_l"; @@ -329,7 +329,7 @@ static const char *set_personality(void){ s = getenv("_XPG"); if(s && s[0]>'0' && s[0]<='9') return NULL; - personality = PER_IRIX_l; + _personality = PER_IRIX_l; return NULL; case_os390: /* IBM's OS/390 OpenEdition on the S/390 mainframe */ @@ -340,13 +340,13 @@ static const char *set_personality(void){ case_hp: case_hpux: - personality = PER_HPUX_x; + _personality = PER_HPUX_x; return NULL; case_svr4: case_sysv: case_sco: - personality = PER_SVR4_x; + _personality = PER_SVR4_x; return NULL; case_posix: @@ -493,7 +493,7 @@ void self_info(void){ fprintf(stderr, "personality=0x%08x (from \"%s\")\n" "EUID=%d TTY=%d,%d Hertz=%lld page_size=%d\n", - personality, saved_personality_text, + _personality, saved_personality_text, cached_euid, (int)major(cached_tty), (int)minor(cached_tty), Hertz, (int)(page_size) ); diff --git a/ps/sortformat.c b/ps/sortformat.c index 5ffc25b..6138be0 100644 --- a/ps/sortformat.c +++ b/ps/sortformat.c @@ -678,7 +678,7 @@ static const char *generate_sysv_list(void){ } /* since FM_y adds RSS anyway, don't do this hack when that is true */ if( (format_flags & FF_Ul) && !(format_modifiers & FM_y) ){ - if(personality & PER_IRIX_l){ /* add "rss" then ':' here */ + if(_personality & PER_IRIX_l){ /* add "rss" then ':' here */ PUSH("sgi_rss"); fn = malloc(sizeof(format_node)); fn->width = 1; @@ -696,14 +696,14 @@ static const char *generate_sysv_list(void){ } if(format_flags & FF_Ul){ if(format_modifiers & FM_y) PUSH("rss"); - else if(personality & (PER_ZAP_ADDR|PER_IRIX_l)) PUSH("sgi_p"); + else if(_personality & (PER_ZAP_ADDR|PER_IRIX_l)) PUSH("sgi_p"); else PUSH("addr_1"); } if(format_modifiers & FM_c){ PUSH("pri"); PUSH("class"); }else if(format_flags & FF_Ul){ PUSH("ni"); - if(personality & PER_IRIX_l) PUSH("priority"); + if(_personality & PER_IRIX_l) PUSH("priority"); else /* is this good? */ PUSH("opri"); } @@ -723,7 +723,7 @@ static const char *generate_sysv_list(void){ if(thread_flags & TF_U_T) PUSH("spid"); PUSH("pid"); if(format_flags & FF_Uf){ - if(personality & PER_SANE_USER) PUSH("user"); + if(_personality & PER_SANE_USER) PUSH("user"); else PUSH("uid_hack"); }else if(format_flags & FF_Ul){ PUSH("uid"); @@ -931,11 +931,11 @@ did_lwp: * Generally, these only get hit when personality overrides unix output. * That (mostly?) means the Digital and Debian personalities. */ - if((personality & PER_ZAP_ADDR) && (format_flags & FF_Ul)){ + if((_personality & PER_ZAP_ADDR) && (format_flags & FF_Ul)){ fn = do_one_spec("sgi_p", NULL); if(fmt_add_after("ADDR", fn)) fmt_delete("ADDR"); } - if((personality & PER_SANE_USER) && (format_flags & FF_Uf)){ + if((_personality & PER_SANE_USER) && (format_flags & FF_Uf)){ fn = do_one_spec("user", NULL); if(fmt_add_after("UID", fn)) fmt_delete("UID"); } -- 2.7.4