From c3cd844df67806ab22a72290c40170731a60109a Mon Sep 17 00:00:00 2001 From: Marcin Cieslak Date: Thu, 23 Aug 2012 16:40:36 +0200 Subject: [PATCH] Use FreeBSD-specific invocation of /bin/ps --- cde/programs/dtlogin/config/_common.ksh.src | 4 +++- cde/programs/dtprintinfo/util/Process.C | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cde/programs/dtlogin/config/_common.ksh.src b/cde/programs/dtlogin/config/_common.ksh.src index 90154a6a..b3b73eaa 100644 --- a/cde/programs/dtlogin/config/_common.ksh.src +++ b/cde/programs/dtlogin/config/_common.ksh.src @@ -36,8 +36,10 @@ pexec=$(LC_TIME=C ps -p $PPID | awk 'NR==2 {print $5}') #elif defined(USL) && (OSMAJORVERSION > 1) pexec=$(LC_TIME=C ps -p $PPID | awk 'NR==2 {print $6}') -#elif defined(linux) || defined(CSRG_BASED) +#elif defined(linux) || defined(CSRG_BASED) && !defined(__FreeBSD__) pexec=$(LC_TIME=C /bin/ps -p $PPID 2>/dev/null | awk 'NR==2 {print $4}') +#elif defined(__FreeBSD__) + pexec=$(LC_TIME=C /bin/ps -o comm= -p $PPID 2>/dev/null) #else pexec=$(LC_TIME=C /usr/bin/ps -p $PPID | awk 'NR==2 {print $4}') #endif diff --git a/cde/programs/dtprintinfo/util/Process.C b/cde/programs/dtprintinfo/util/Process.C index 9dc93ce0..51e91154 100644 --- a/cde/programs/dtprintinfo/util/Process.C +++ b/cde/programs/dtprintinfo/util/Process.C @@ -38,6 +38,8 @@ Process::Process() { #ifdef aix (void)Invoke("ps -e -F \"pid ppid uid command\"", &procs); +#elif defined(__FreeBSD__) + (void)Invoke("/bin/ps ax -o pid,ppid,uid,comm", &procs); #else (void)Invoke("/bin/ps -el | awk '{printf(\"%s %s %s %s\\n\",$4,$5,$3,$NF)}'", &procs); -- 2.25.1