JM プロジェクトは、主に Linux 関連のマニュアルページの日本語ページを翻訳・公開しています。
... ポートされているかや、 設定可能な特定の定数や制限 (limits) がどんな値かをテストすることができる。 コンパイル時に行うには、 < unistd.h > と < limits.h > の両方もしくは一方をインクルードし、 特定のマクロの値を確認する。 実行時には、ここで説明する関数 sysco ... る値は設定可能なシステム定数である。 これらはプロセスの生存期間の間は変化しない。 オプションを確認できるように、たいていは < unistd.h > で定数 _POSIX_FOO が定義されている。 定義されていないときは、実行時に問い合わせを行う必要がある。 その値が -1 に定義さ ... リストについては posixoptions (7) を参照のこと。 変数や制限を確認できるように、たいていは、 < limits.h > で定数 _FOO が、 < unistd.h > で _POSIX_FOO が定義されている。 制限が規定されていない場合は定数は定義されない。 定数が定義されているときには、その定 ... ... _syscall() をインクルードしておくと、 そのシステムコールを name という名前で呼ぶことができる。 ファイル /usr/include/linux/unistd.h 準拠 これらのマクロは Linux 固有であり、その使用は非推奨である。 注意 カーネル 2.6.18 あたりから、_syscall マクロ群はユー ... ー渡し (by-pointer) でなければならない。 例 #include < stdio.h > #include < stdlib.h > #include < errno.h > #include < linux/unistd.h > /* for _syscallX macros/related stuff */ #include < linux/kernel.h > /* for struct sysinfo */ _syscall1(int, sysinfo, ... ... の値を取得する。 pathconf () はファイル名 path に対して設定されているオプション name の値を取得する。 対応するマクロのうち < unistd.h > で定義されているものは最小値である。アプリケーションによってはこれらの 値を変更してより有利な動作を行おうとするものがあ ... returned. This value will not be more restrictive than the corresponding value that was described to the application in < unistd.h > or < limits.h > when the application was compiled. エラー EACCES ( pathconf ()) Search permission is denied for one of ... ... の値を取得する。 pathconf () はファイル名 path に対して設定されているオプション name の値を取得する。 対応するマクロのうち < unistd.h > で定義されているものは最小値である。アプリケーションによってはこれらの 値を変更してより有利な動作を行おうとするものがあ ... returned. This value will not be more restrictive than the corresponding value that was described to the application in < unistd.h > or < limits.h > when the application was compiled. エラー EACCES ( pathconf ()) Search permission is denied for one of ... ... い。 注意 移植性が必要なアプリケーションでは、 getpagesize () ではなく sysconf(_SC_PAGESIZE) を利用すべきである。 #include < unistd.h > long sz = sysconf(_SC_PAGESIZE); (ほとんどのシステムでは _SC_PAGESIZE の同義語として _SC_PAGE_SIZE を使用することができ ... ... fd [2]); #define _GNU_SOURCE /* feature_test_macros (7) 参照 */ #include < fcntl.h > /* O_* 定数の定義の取得 */ #include < unistd.h > int pipe2(int pipefd [2], int flags ); 説明 pipe () はパイプを生成する。 パイプは、プロセス間通信に使用できる単方向のデ ... プログラムのソース #include < sys/types.h > #include < sys/wait.h > #include < stdio.h > #include < stdlib.h > #include < unistd.h > #include < string.h > int main(int argc, char *argv[]) { int pipefd[2]; pid_t cpid; char buf; if (argc != 2) { fprintf ... ... fd [2]); #define _GNU_SOURCE /* feature_test_macros (7) 参照 */ #include < fcntl.h > /* O_* 定数の定義の取得 */ #include < unistd.h > int pipe2(int pipefd [2], int flags ); 説明 pipe () はパイプを生成する。 パイプは、プロセス間通信に使用できる単方向のデ ... プログラムのソース #include < sys/types.h > #include < sys/wait.h > #include < stdio.h > #include < stdlib.h > #include < unistd.h > #include < string.h > int main(int argc, char *argv[]) { int pipefd[2]; pid_t cpid; char buf; if (argc != 2) { fprintf ... ... ; #include < fcntl.h > /* AT_* 定数の定義 */ #include < unistd.h > ssize_t readlinkat(int dirfd , const char * pathname , char * buf , size_t bufsiz ); glibc 向けの機能検査マクロの要件 ... nclude < sys/types.h > #include < sys/stat.h > #include < limits.h > #include < stdio.h > #include < stdlib.h > #include < unistd.h > int main(int argc, char *argv[]) { struct stat sb; char *buf; ssize_t nbytes, bufsiz; if (argc != 2) { fprintf(stderr, ... ... ; #include < fcntl.h > /* AT_* 定数の定義 */ #include < unistd.h > ssize_t readlinkat(int dirfd , const char * pathname , char * buf , size_t bufsiz ); glibc 向けの機能検査マクロの要件 ... nclude < sys/types.h > #include < sys/stat.h > #include < limits.h > #include < stdio.h > #include < stdlib.h > #include < unistd.h > int main(int argc, char *argv[]) { struct stat sb; char *buf; ssize_t nbytes, bufsiz; if (argc != 2) { fprintf(stderr, ... ... きる 符号なし整数型である。 明示的にこの型を使わないことでプログラムの移植性がより高まる。 以下のように使うこと。 #include < unistd.h > ... unsigned int usecs; ... usleep(usecs); この関数と、 SIGALRM シグナルあるいは alarm (2), sleep (3), nanosleep (2), ... 日本語の文書やマニュアルを配布している個人/プロジェクトへのリンクです。