Unix-system-calls-dup2
[top]#
|http://www.google.com/[Google] | a|
Web | This Site |
選択した読書 Copyright©2014 by finddevguides |
[cols=",,,,,,,",] |
| | Home | | References | | Discussion Forums | | About TP
[width="100%",cols="100%",] |
a| == dup()-Unix、Linuxシステムコール
[[File:]] image :http://www.finddevguides.com/images/next.gif [next] image:http://www.finddevguides.com/add- this.gif [AddThisソーシャルブックマークボタン]
広告
NAME
dup、dup2-ファイル記述子を複製します
概要
#include <unistd.h> int dup(int oldfd); int dup2(int oldfd, int newfd); |
説明
2つの記述子は、ファイル記述子フラグ(close-on-execフラグ)を共有しません。 重複記述子のclose-on-execフラグ( FD_CLOEXEC 。 fcntl (2)を参照)はオフです。
返り値
エラー
Tag | Description |
---|---|
EBADF | oldfd isn’t an open file descriptor, or newfd is out of the allowed range for file descriptors. |
*EBUSY * | (Linux only) This may be returned by* dup2*() during a race condition with open() and dup(). |
*EINTR * | The* dup2*() call was interrupted by a signal. |
EMFILE | The process already has the maximum number of file descriptors open and tried to open a new one. |
警告
_newfd_が範囲外の場合、 dup2 ()によって返されるエラーは、* fcntl(* …、 F_DUPFD 、… )*によって返されるエラーとは異なります。 一部のシステムでは、 *dup2 ()は F_DUPFD のような EINVAL を返すこともあります。
_newfd_が開いていた場合、 close ()の時点で報告されていたエラーは失われます。 注意深いプログラマーは、_newfd_を最初に閉じずに dup2 ()を使用することはありません。
準拠
SVr4、4.3BSD、POSIX.1-2001。
関連項目
[[File:]] image :http://www.finddevguides.com/images/next.gif [next] [[File:]]
広告
|
[cols="^",] |
|Advertisements