HP-UX General
1825023 メンバー
2823 オンライン
109678 解決策
新規ポスト

PSコマンドの出力結果

 
TOYAMA
新しいメンバー

PSコマンドの出力結果

PSコマンドの出力結果について質問させていただきます。

コマンド"ps -e"を実行すると、PID, TTY, TIME, COMMANDが表示されますが、このCOMMANDには何が表示されるのでしょうか(実行したファイル名 or プロセス名)?

Aというプログラムを作成して、2台のHP-UX上で、プログラムの中から「exec("A", "B", ・・・);」と実行したところ、一方ではCOMMAND列にAと表示され、他方ではBと表示されました。HW的にはやや異なる部分もあるのですが、HP-UXのOSのバージョンも同一ですので、環境変数等が影響していると考えています。

このあたりの情報をお持ちの方がいらっしゃいましたら、ぜひ、ご教授願います。

以上、宜しくお願い致します。

2件の返信2
H_K
頻繁なアドバイザー

PSコマンドの出力結果

別の OS だけど、プログラムの「現在の」argv を表示していると教わった。

通常、argv は書き換えないけど、プロセスが自分の状態を表示する場所として使えるので、プロセスの進行に応じて argv を書き換えることがある、と。

でも OS によっては、現在の argv ではなく、起動時の argv を表示する実装もあると聞いたことがある。

実装依存っつーことで。

oops
貴重なコントリビューター

PSコマンドの出力結果

OS のバージョンは 11i v2 でしょうか?

どうも ps のパッチで、kinokino さんが書かれている実装が変わってしまったようです。

片方に PHCO_31594 があたってるということはありませんか?このパッチには下記のような Warning がついていますが。

2004/11/18 - This Non-Critical Warning has been issued by HP.

- PHCO_31594 introduced behavior that can result in unexpected

output from the ps(1) command. If the UNIX95 variable is

not set and neither the '-f' nor the '-x' options are used,

the output of the ps(1) command may display unexpected

process names for shell scripts and applications that modify

their name. This behavior may result in undesirable results

for scripts and utilities that manage processes using the

output of the ps(1) command, as they may not properly

identify the running processes.

- For example, with PHCO_31594 installed the output of the

ps(1) command will display 'sh' in the COMMAND field

instead of the name of the shell script. The output of

ps(1) for a shell script named 'test_ps' will display:

# ps

PID TTY TIME COMMAND

22049 pts/ta 0:00 sh

Without PHCO_31594 installed, the output of the ps(1) command

will display the name of the shell script:

# ps

PID TTY TIME COMMAND

22049 pts/ta 0:00 test_ps

- Additional details on this issue may be obtained in Service

Request 8606386603 (JAGaf46757).

- To work around this behavior and maintain compatibility with

previous versions of the ps(1) command, the UNIX95

environment variable may be set or the '-x' or '-f' options

may be used. Such changes would need to be made in all

scripts and utilities that manage processes using the ps(1)

command.

- If these workarounds are not acceptable, HP recommends

removing PHCO_31594 from systems that may experience process

management issues based on the output of the ps(1) command.

- Please note that the Japanese process management man page

patch, PHCO_31656, is dependent upon PHCO_31594. If you

choose to remove PHCO_31594, it will also be necessary to

remove PHCO_31656. If you wish to remove PHCO_31594 but do

not wish to remove PHCO_31656 in order to retain the other

man page changes it provides, the following command may be

used:

/usr/sbin/swmodify -x enforce_dependencies=false PHCO_31594

However, if you choose to remove PHCO_31594 but retain

PHCO_31656 be aware that the Japanese man pages for ps(1)

will still document the new functionality that was removed

with PHCO_31594.

- PHCO_31594 is included in the following HP Patch Bundle:

Sep 2004: BUNDLE11i,B.11.23.0409.3