<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Long command line and pstat_getproc() in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157080#M718063</link>
    <description>Unfortunately, I can't do it. This ps should run almost every second :-(&lt;BR /&gt;</description>
    <pubDate>Tue, 06 Jan 2004 13:28:24 GMT</pubDate>
    <dc:creator>Michael Goltsman</dc:creator>
    <dc:date>2004-01-06T13:28:24Z</dc:date>
    <item>
      <title>Long command line and pstat_getproc()</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157076#M718059</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I need to get long (more than 128 chars) command lines out of pstat_getproc(). Currently pst_cmd is 64 bytes long and pst_ucomm is 17 bytes long.&lt;BR /&gt;I know It's possible as ps(1) does it in UNIX95 mode on the same machine. &lt;BR /&gt;&lt;BR /&gt;What should I do?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Mike</description>
      <pubDate>Tue, 06 Jan 2004 08:34:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157076#M718059</guid>
      <dc:creator>Michael Goltsman</dc:creator>
      <dc:date>2004-01-06T08:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Long command line and pstat_getproc()</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157077#M718060</link>
      <description>A patched ps on 11i v1 uses pstat_getcommandline().  That is not available as a documented and supported interface until 11i v1.6 or 11i v2.  You can read about the call in the system calls section of&lt;BR /&gt;&lt;A href="http://www.docs.hp.com./hpux/onlinedocs/B2355-60103/B2355-60103.html" target="_blank"&gt;http://www.docs.hp.com./hpux/onlinedocs/B2355-60103/B2355-60103.html&lt;/A&gt;</description>
      <pubDate>Tue, 06 Jan 2004 11:10:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157077#M718060</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2004-01-06T11:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Long command line and pstat_getproc()</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157078#M718061</link>
      <description>1. I have HP-UX B.11.11. &lt;BR /&gt;2. I tried to use pstat_getcommandline() and link failed. &lt;BR /&gt;&lt;BR /&gt;Any help?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Mike</description>
      <pubDate>Tue, 06 Jan 2004 11:37:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157078#M718061</guid>
      <dc:creator>Michael Goltsman</dc:creator>
      <dc:date>2004-01-06T11:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: Long command line and pstat_getproc()</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157079#M718062</link>
      <description>You could just use popen to get the information from ps.&lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;#include &lt;STRING.H&gt;&lt;BR /&gt;&lt;BR /&gt;char *getcommandline(int pid)&lt;BR /&gt;{&lt;BR /&gt;    char command[500];&lt;BR /&gt;    static char args[1024];&lt;BR /&gt;    FILE *pipe;&lt;BR /&gt;    int result;&lt;BR /&gt;    char *newline;&lt;BR /&gt;    sprintf(command, "UNIX95=1 /usr/bin/ps -p %d -x -o args=", pid);&lt;BR /&gt;    pipe = popen(command, "r");&lt;BR /&gt;    result = fread(args, 1, 1023, pipe);&lt;BR /&gt;    pclose(pipe);&lt;BR /&gt;    args[result] = 0;&lt;BR /&gt;    newline = strchr(args, '\n');&lt;BR /&gt;    if (newline) {&lt;BR /&gt; *newline = 0;&lt;BR /&gt;    }&lt;BR /&gt;    return args;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;int main(int argc, char *argv[])&lt;BR /&gt;{&lt;BR /&gt;    int i;&lt;BR /&gt;    for (i=1; i&lt;ARGC&gt;&lt;/ARGC&gt; printf("%s\n", getcommandline(atoi(argv[i])));&lt;BR /&gt;    }&lt;BR /&gt;    return 0;&lt;BR /&gt;}&lt;/STRING.H&gt;&lt;/STDLIB.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Tue, 06 Jan 2004 13:23:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157079#M718062</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2004-01-06T13:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: Long command line and pstat_getproc()</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157080#M718063</link>
      <description>Unfortunately, I can't do it. This ps should run almost every second :-(&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Jan 2004 13:28:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157080#M718063</guid>
      <dc:creator>Michael Goltsman</dc:creator>
      <dc:date>2004-01-06T13:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Long command line and pstat_getproc()</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157081#M718064</link>
      <description>Have a look at document KBRC00006317 in technical knowledge base. Here is a code sample from this document that demonstrates how to get up to 1024 chars for the command (as with 'ps -x'). Please note that PSTAT_GETCOMMANDLINE interface is unsupported.&lt;BR /&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;#define MAX_LENGTH (1024)&lt;BR /&gt;main (argc, argv) int argc; char *argv[]; {&lt;BR /&gt;  int    pid;&lt;BR /&gt;  char   long_command [MAX_LENGTH];&lt;BR /&gt;  union  pstun pu;&lt;BR /&gt;&lt;BR /&gt;  pid = atoi(argv[1]);&lt;BR /&gt;  pu.pst_command = long_command;&lt;BR /&gt;  if (pstat(PSTAT_GETCOMMANDLINE, pu, MAX_LENGTH, 1, pid) == -1) {&lt;BR /&gt;    printf("ERROR: pstat() failure using pid(%d)\n", pid);&lt;BR /&gt;    exit(-1);&lt;BR /&gt;  }&lt;BR /&gt;  printf("pid %d = %s\n", pid, pu.pst_command);&lt;BR /&gt;}&lt;/SYS&gt;&lt;/SYS&gt;</description>
      <pubDate>Tue, 06 Jan 2004 19:59:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157081#M718064</guid>
      <dc:creator>Ermin Borovac</dc:creator>
      <dc:date>2004-01-06T19:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: Long command line and pstat_getproc()</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157082#M718065</link>
      <description>&amp;gt; This ps should run almost every second :-(&lt;BR /&gt; &lt;BR /&gt;Be sure that you pick a specific process or perhaps a user list. ps -e is a VERY expensive command to be used on a busy machine and may take longer than 1 second to run. If you need to monitor a specific process, use the PID and never use grep to locate processes.</description>
      <pubDate>Tue, 06 Jan 2004 21:54:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157082#M718065</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2004-01-06T21:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Long command line and pstat_getproc()</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157083#M718066</link>
      <description>Thank you very much Ermin. It works.</description>
      <pubDate>Wed, 07 Jan 2004 07:17:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/long-command-line-and-pstat-getproc/m-p/3157083#M718066</guid>
      <dc:creator>Michael Goltsman</dc:creator>
      <dc:date>2004-01-07T07:17:57Z</dc:date>
    </item>
  </channel>
</rss>

