From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Christopher Knorr Newsgroups: gmane.os.tru64.managers Subject: SUMMARY: Question on why ps sometimes truncates the process name and puts it in brackets Date: Fri, 09 Dec 2005 13:36:56 -0500 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1134153607 10403 80.91.229.2 (9 Dec 2005 18:40:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 9 Dec 2005 18:40:07 +0000 (UTC) Original-X-From: tru64-unix-managers-owner-gotm-tru64-unix-managers=m.gmane.org@sws1.ctd.ornl.gov Fri Dec 09 19:39:58 2005 Return-path: Original-Received: from sws1.ornl.gov ([160.91.1.101]) by ciao.gmane.org with smtp (Exim 4.43) id 1Ekn7U-0004OU-80 for gotm-tru64-unix-managers@gmane.org; Fri, 09 Dec 2005 19:37:24 +0100 Original-Received: (qmail 24076 invoked by uid 49509); 9 Dec 2005 18:37:12 -0000 Original-Sender: tru64-unix-managers-owner@ornl.gov Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 24061 invoked by uid 49501); 9 Dec 2005 18:37:12 -0000 Original-Received: from 160.91.4.119 by sws1 (envelope-from , uid 49491) with qmail-scanner-1.25 (clamdscan: 0.83/743. spamassassin: 3.0.2. Clear:RC:0(160.91.4.119):SA:0(-2.6/5.0):. Processed in 0.700192 secs); 09 Dec 2005 18:37:12 -0000 X-Spam-Status: No, hits=-2.6 required=5.0 Original-Received: from emroute1.cind.ornl.gov (160.91.4.119) by sws1.ornl.gov with SMTP; 9 Dec 2005 18:37:11 -0000 Original-Received: from emroute1.cind.ornl.gov (localhost [127.0.0.1]) by emroute1.cind.ornl.gov (PMDF V6.2-1x9 #31038) with ESMTP id <0IR800DDXUDYJR@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 09 Dec 2005 13:37:10 -0500 (EST) Original-Received: from VIRUSCAN-DAEMON.emroute1.cind.ornl.gov by emroute1.cind.ornl.gov (PMDF V6.2-1x9 #31038) id <0IR800K02UDORH@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 09 Dec 2005 13:37:10 -0500 (EST) Original-Received: from gull.hopsdc.com (gull.hopsdc.com [199.227.253.10]) by emroute1.cind.ornl.gov (PMDF V6.2-1x9 #31038) with ESMTP id <0IR800I6RUDMLN@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 09 Dec 2005 13:37:00 -0500 (EST) Original-To: tru64-unix-managers@ornl.gov X-Envelope-from: cknorr@trapsystems.com X-MIMEOLE: Produced By Microsoft Exchange V6.5 Thread-Topic: SUMMARY: Question on why ps sometimes truncates the process name and puts it in brackets Thread-Index: AcX874if5AvMe9lPRquL6fJn1U5SaQ== Content-class: urn:content-classes:message X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on email.cind.ornl.gov X-Spam-Level: X-Qmail-Scanner-MOVED-X-Spam-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-MS-Has-Attach: X-MS-TNEF-Correlator: Xref: news.gmane.org gmane.os.tru64.managers:8684 Archived-At: Original Question: =20 Why does the ps output sometimes truncate the process name and put it in brackets? Thanks to Dr. Blinn for the following thorough answer: The UNIX standard for the "ps" command allows the system to truncate or omit certain parts of the output when the resources necessary to gather and display them are unavailable. There are two places this could happen -- inside the "ps" utility and in the kernel (which is called MANY times by the utility to gather the data for a single "ps -e" command, especially if there are a lot of processes on the system). In this case, the output is usually being truncated in the kernel because there is a temporary shortage of the in-memory buffer size needed for that particular field. When that happens, you'll see the kind of output you're seeing. The correct fix for this is to design your script to be able to deal with either of the two outputs, since you will presumably always get one or the other. There may be ways to simplify the logic that would result in a more expeditious and reliable test, but you should be just fine if you take into account that as system load changes, there can be times when certain resources are temporarily scarce and that these times can impact the output of commands like "ps" (or for that matter, cause some things to simply fail).