.\" Copyright (c) 1995 Peter Wemm .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, is permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice immediately at the beginning of the file, without modification, .\" this list of conditions, and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. This work was done expressly for inclusion into FreeBSD. Other use .\" is permitted provided this notation is included. .\" 4. Absolutely no warranty of function or purpose is made by the author .\" Peter Wemm. .\" 5. Modifications may be freely made to this file providing the above .\" conditions are met. .\" .\" %Id: setproctitle.3,v 1.10 1998/03/19 07:34:19 charnier Exp % .\" .\" The following requests are required for all man pages. .\" $FreeBSD$ .Dd December 16, 1995 .Os FreeBSD .Dt SETPROCTITLE 3 .Sh 名称 .Nm setproctitle .Nd .Xr ps 1 用のプロセスタイトルを設定する .Sh 書式 .Fd #include .Fd #include .Ft void .Fn setproctitle "const char *fmt" "..." .Pp Link with .Va -lutil on the .Xr cc 1 command line. .Sh 解説 .Fn setproctitle ライブラリルーチンは、 .Xr ps 1 コマンドに現れるプロセスタイトル を設定します。 .Pp タイトルは実行可能モジュールの名前に、 .Va fmt で指定される引数の .Xr printf 3 スタイルの拡張の結果が続いたもので設定されます。 .Pp .Va fmt が NULL の場合、プロセスタイトルは実行可能モジュールの名前にリセット されるだけです。 .Sh 例 デーモンにタイトルを設定してそのアクティビティを示す方法は次のとおりです。 .Bd -literal -offset indent setproctitle("talking to %s", inet_ntoa(addr)); .Ed .Sh 関連項目 .Xr ps 1 , .Xr w 1 , .Xr kvm 3 , .Xr kvm_getargv 3 , .Xr printf 3 .Sh 規格 .Fn setproctitle は、黙示的には標準ではありません。 .Xr ps 1 コマンド行が変化するようにする他の方法 (argv[0] ストリング上のコピーを含む)も黙示的に 移植不可能です。システム付属の .Fn setproctitle が存在する場合は、これを使用する方が賢明です。 .Pp 不都合なことに、 .Fn setproctitle の他のバージョンを呼び出す他の規約がある 可能性があります。ただし、作者はまだどれも見つけていません。これは主導的な 慣行であると信じられています。 .Pp 実現は、 .Tn NetBSD と .Tn BSD/OS も含めて、実現システムは他のシステムとの 互換性があると考えられます。 .Sh 歴史 .Fn setproctitle は .Fx 2.2 で最初に現れました。 他のオペレーティングシステムも同じような機能を持っています。 .Sh 作者 .An Peter Wemm Aq peter@FreeBSD.org は、 .An Eric Allman Aq eric@sendmail.org による .Sy "Sendmail 8.7.3" ソースコードからアイデアを取りました。