亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? library_12.html

?? linux_c函數,linux下編程必備的
?? HTML
?? 第 1 頁 / 共 5 頁
字號:
The <CODE>select</CODE> function checks only the first <VAR>nfds</VAR> file
descriptors.  The usual thing is to pass <CODE>FD_SETSIZE</CODE> as the value
of this argument.
<P>
The <VAR>timeout</VAR> specifies the maximum time to wait.  If you pass a
null pointer for this argument, it means to block indefinitely until one
of the file descriptors is ready.  Otherwise, you should provide the
time in <CODE>struct timeval</CODE> format; see section <A HREF="library_19.html#SEC315" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_19.html#SEC315">High-Resolution Calendar</A>.  Specify zero as the time (a <CODE>struct timeval</CODE> containing
all zeros) if you want to find out which descriptors are ready without
waiting if none are ready.
<P>
The normal return value from <CODE>select</CODE> is the total number of ready file
descriptors in all of the sets.  Each of the argument sets is overwritten
with information about the descriptors that are ready for the corresponding
operation.  Thus, to see if a particular descriptor <VAR>desc</VAR> has input,
use <CODE>FD_ISSET (<VAR>desc</VAR>, <VAR>read_fds</VAR>)</CODE> after <CODE>select</CODE> returns.
<P>
If <CODE>select</CODE> returns because the timeout period expires, it returns
a value of zero.
<P>
Any signal will cause <CODE>select</CODE> to return immediately.  So if your
program uses signals, you can't rely on <CODE>select</CODE> to keep waiting
for the full time specified.  If you want to be sure of waiting for a
particular amount of time, you must check for <CODE>EINTR</CODE> and repeat
the <CODE>select</CODE> with a newly calculated timeout based on the current
time.  See the example below.  See also section <A HREF="library_21.html#SEC362" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_21.html#SEC362">Primitives Interrupted by Signals</A>.
<P>
If an error occurs, <CODE>select</CODE> returns <CODE>-1</CODE> and does not modify
the argument file descriptor sets.  The following <CODE>errno</CODE> error 
conditions are defined for this function:
<P>
<DL COMPACT>
<DT><CODE>EBADF</CODE>
<DD>One of the file descriptor sets specified an invalid file descriptor.
<P>
<DT><CODE>EINTR</CODE>
<DD>The operation was interrupted by a signal.  See section <A HREF="library_21.html#SEC362" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_21.html#SEC362">Primitives Interrupted by Signals</A>.
<P>
<DT><CODE>EINVAL</CODE>
<DD>The <VAR>timeout</VAR> argument is invalid; one of the components is negative
or too large.
</DL>
<P>
<STRONG>Portability Note:</STRONG>  The <CODE>select</CODE> function is a BSD Unix
feature.
<P>
Here is an example showing how you can use <CODE>select</CODE> to establish a
timeout period for reading from a file descriptor.  The <CODE>input_timeout</CODE>
function blocks the calling process until input is available on the
file descriptor, or until the timeout period expires.
<P>
<PRE>
#include &#60;stdio.h&#62;
#include &#60;unistd.h&#62;
#include &#60;sys/types.h&#62;
#include &#60;sys/time.h&#62;

int 
input_timeout (int filedes, unsigned int seconds)
{
  fd_set set;
  struct timeval timeout;

  /* Initialize the file descriptor set.  */
  FD_ZERO (&#38;set);
  FD_SET (filedes, &#38;set);

  /* Initialize the timeout data structure.  */
  timeout.tv_sec = seconds;
  timeout.tv_usec = 0;

  /* <CODE>select</CODE> returns 0 if timeout, 1 if input available, -1 if error.  */
  return TEMP_FAILURE_RETRY (select (FD_SETSIZE, &#38;set, NULL, NULL, &#38;timeout));
}

int
main (void)
{
  fprintf (stderr, "select returned %d.\n", input_timeout (STDIN_FILENO, 5));
  return 0;
}
</PRE>
<P>
There is another example showing the use of <CODE>select</CODE> to multiplex
input from multiple sockets in section <A HREF="library_15.html#SEC254" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_15.html#SEC254">Byte Stream Connection Server Example</A>.
<P>
<H2><A NAME="SEC181" HREF="library_toc.html#SEC181" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC181">Control Operations on Files</A></H2>
<A NAME="IDX684"></A>
<A NAME="IDX685"></A>
<P>
This section describes how you can perform various other operations on
file descriptors, such as inquiring about or setting flags describing
the status of the file descriptor, manipulating record locks, and the
like.  All of these operations are performed by the function <CODE>fcntl</CODE>.
<P>
The second argument to the <CODE>fcntl</CODE> function is a command that
specifies which operation to perform.  The function and macros that name
various flags that are used with it are declared in the header file
<TT>`fcntl.h'</TT>.  (Many of these flags are also used by the <CODE>open</CODE>
function; see section <A HREF="library_12.html#SEC172" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC172">Opening and Closing Files</A>.)
<A NAME="IDX686"></A>
<P>
<A NAME="IDX687"></A>
<U>Function:</U> int <B>fcntl</B> <I>(int <VAR>filedes</VAR>, int <VAR>command</VAR>, ...)</I><P>
The <CODE>fcntl</CODE> function performs the operation specified by
<VAR>command</VAR> on the file descriptor <VAR>filedes</VAR>.  Some commands
require additional arguments to be supplied.  These additional arguments
and the return value and error conditions are given in the detailed
descriptions of the individual commands.
<P>
Briefly, here is a list of what the various commands are.
<P>
<DL COMPACT>
<DT><CODE>F_DUPFD</CODE>
<DD>Duplicate the file descriptor (return another file descriptor pointing
to the same open file).  See section <A HREF="library_12.html#SEC182" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC182">Duplicating Descriptors</A>.
<P>
<DT><CODE>F_GETFD</CODE>
<DD>Get flags associated with the file descriptor.  See section <A HREF="library_12.html#SEC183" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC183">File Descriptor Flags</A>.
<P>
<DT><CODE>F_SETFD</CODE>
<DD>Set flags associated with the file descriptor.  See section <A HREF="library_12.html#SEC183" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC183">File Descriptor Flags</A>.
<P>
<DT><CODE>F_GETFL</CODE>
<DD>Get flags associated with the open file.  See section <A HREF="library_12.html#SEC184" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC184">File Status Flags</A>.
<P>
<DT><CODE>F_SETFL</CODE>
<DD>Set flags associated with the open file.  See section <A HREF="library_12.html#SEC184" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC184">File Status Flags</A>.
<P>
<DT><CODE>F_GETLK</CODE>
<DD>Get a file lock.  See section <A HREF="library_12.html#SEC185" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC185">File Locks</A>.
<P>
<DT><CODE>F_SETLK</CODE>
<DD>Set or clear a file lock.  See section <A HREF="library_12.html#SEC185" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC185">File Locks</A>.
<P>
<DT><CODE>F_SETLKW</CODE>
<DD>Like <CODE>F_SETLK</CODE>, but wait for completion.  See section <A HREF="library_12.html#SEC185" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC185">File Locks</A>.
<P>
<DT><CODE>F_GETOWN</CODE>
<DD>Get process or process group ID to receive <CODE>SIGIO</CODE> signals.
See section <A HREF="library_12.html#SEC186" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC186">Interrupt-Driven Input</A>.
<P>
<DT><CODE>F_SETOWN</CODE>
<DD>Set process or process group ID to receive <CODE>SIGIO</CODE> signals.
See section <A HREF="library_12.html#SEC186" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC186">Interrupt-Driven Input</A>.
</DL>
<P>
<H2><A NAME="SEC182" HREF="library_toc.html#SEC182" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC182">Duplicating Descriptors</A></H2>
<A NAME="IDX688"></A>
<A NAME="IDX689"></A>
<P>
You can <DFN>duplicate</DFN> a file descriptor, or allocate another file
descriptor that refers to the same open file as the original.  Duplicate
descriptors share one file position and one set of file status flags
(see section <A HREF="library_12.html#SEC184" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC184">File Status Flags</A>), but each has its own set of file descriptor
flags (see section <A HREF="library_12.html#SEC183" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_12.html#SEC183">File Descriptor Flags</A>).
<P>
The major use of duplicating a file descriptor is to implement
<DFN>redirection</DFN> of input or output:  that is, to change the
file or pipe that a particular file descriptor corresponds to.
<P>
You can perform this operation using the <CODE>fcntl</CODE> function with the
<CODE>F_DUPFD</CODE> command, but there are also convenient functions
<CODE>dup</CODE> and <CODE>dup2</CODE> for duplicating descriptors.
<A NAME="IDX690"></A>
<A NAME="IDX691"></A>
<P>
The <CODE>fcntl</CODE> function and flags are declared in <TT>`fcntl.h'</TT>,
while prototypes for <CODE>dup</CODE> and <CODE>dup2</CODE> are in the header file
<TT>`unistd.h'</TT>.
<P>
<A NAME="IDX692"></A>
<U>Function:</U> int <B>dup</B> <I>(int <VAR>old</VAR>)</I><P>
This function copies descriptor <VAR>old</VAR> to the first available
descriptor number (the first number not currently open).  It is
equivalent to <CODE>fcntl (<VAR>old</VAR>, F_DUPFD, 0)</CODE>.
<P>
<A NAME="IDX693"></A>
<U>Function:</U> int <B>dup2</B> <I>(int <VAR>old</VAR>, int <VAR>new</VAR>)</I><P>
This function copies the descriptor <VAR>old</VAR> to descriptor number
<VAR>new</VAR>.
<P>
If <VAR>old</VAR> is an invalid descriptor, then <CODE>dup2</CODE> does nothing; it
does not close <VAR>new</VAR>.  Otherwise, the new duplicate of <VAR>old</VAR>
replaces any previous meaning of descriptor <VAR>new</VAR>, as if <VAR>new</VAR>
were closed first.
<P>
If <VAR>old</VAR> and <VAR>new</VAR> are different numbers, and <VAR>old</VAR> is a
valid descriptor number, then <CODE>dup2</CODE> is equivalent to:
<P>
<PRE>
close (<VAR>new</VAR>);
fcntl (<VAR>old</VAR>, F_DUPFD, <VAR>new</VAR>)
</PRE>
<P>
However, <CODE>dup2</CODE> does this atomically; there is no instant in the
middle of calling <CODE>dup2</CODE> at which <VAR>new</VAR> is closed and not yet a
duplicate of <VAR>old</VAR>.
<P>
<A NAME="IDX694"></A>
<U>Macro:</U> int <B>F_DUPFD</B><P>
This macro is used as the <VAR>command</VAR> argument to <CODE>fcntl</CODE>, to
copy the file descriptor given as the first argument.
<P>
The form of the call in this case is:
<P>
<PRE>
fcntl (<VAR>old</VAR>, F_DUPFD, <VAR>next_filedes</VAR>)
</PRE>
<P>
The <VAR>next_filedes</VAR> argument is of type <CODE>int</CODE> and specifies that
the file descriptor returned should be the next available one greater
than or equal to this value.
<P>
The return value from <CODE>fcntl</CODE> with this command is normally the value
of the new file descriptor.  A return value of <CODE>-1</CODE> indicates an
error.  The following <CODE>errno</CODE> error conditions are defined for
this command:
<P>
<DL COMPACT>
<DT><CODE>EBADF</CODE>
<DD>The <VAR>old</VAR> argument is invalid.
<P>
<DT><CODE>EINVAL</CODE>
<DD>The <VAR>next_filedes</VAR> argument is invalid.
<P>
<DT><CODE>EMFILE</CODE>
<DD>There are no more file descriptors available--your program is already
using the maximum.
</DL>
<P>
<CODE>ENFILE</CODE> is not a possible error code for <CODE>dup2</CODE> because
<CODE>dup2</CODE> does not create a new opening of a file; duplicate
descriptors do not count toward the limit which <CODE>ENFILE</CODE>
indicates.  <CODE>EMFILE</CODE> is possible because it refers to the limit on
distinct descriptor numbers in use in one process.
<P>
Here is an example showing how to use <CODE>dup2</CODE> to do redirection.
Typically, redirection of the standard streams (like <CODE>stdin</CODE>) is
done by a shell or shell-like program before calling one of the
<CODE>exec</CODE> functions (see section <A HREF="library_23.html#SEC406" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_23.html#SEC406">Executing a File</A>) to execute a new
program in a child process.  When the new program is executed, it
creates and initializes the standard streams to point to the
corresponding file descriptors, before its <CODE>main</CODE> function is
invoked.
<P>
So, to redirect standard input to a file, the shell could do something
like:
<P>
<PRE>
pid = fork ();
if (pid == 0)
  {
    char *filename;
    char *program;
    int file;
    ...
    file = TEMP_FAILURE_RETRY (open (filename, O_RDONLY));
    dup2 (file, STDIN_FILENO);
    TEMP_FAILURE_RETRY (close (file));
    execv (program, NULL);
  }
</PRE>
<P>
There is also a more detailed example showing how to implement redirection
in the context of a pipeline of processes in section <A HREF="library_24.html#SEC420" tppabs="http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_24.html#SEC420">Launching Jobs</A>.
<P>
<A NAME="IDX695"></A>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品视频在线观看网站| 色综合天天做天天爱| 91丨porny丨国产| 欧美精品一二三| 亚洲欧洲日韩av| 国产麻豆精品theporn| 欧美日韩国产经典色站一区二区三区| 久久精品欧美一区二区三区不卡 | 色诱视频网站一区| 欧美一级精品在线| 亚洲综合激情小说| 不卡大黄网站免费看| 久久婷婷久久一区二区三区| 水野朝阳av一区二区三区| 91豆麻精品91久久久久久| 国产精品理论片在线观看| 国产真实乱子伦精品视频| 91精品婷婷国产综合久久性色| 一区二区三区91| 91黄色在线观看| 亚洲女人的天堂| 成人国产精品免费观看视频| 欧美精品一区二区三区蜜桃| 日韩电影在线观看网站| 色婷婷精品大在线视频| 亚洲精品中文字幕乱码三区| 99久久国产综合精品麻豆| 国产精品嫩草久久久久| 国产不卡视频在线观看| 国产精品视频免费看| 成人晚上爱看视频| 国产精品久久一卡二卡| 成人激情电影免费在线观看| 日本一区二区三区在线观看| 成人性生交大合| 国产精品不卡一区二区三区| 不卡的av中国片| 亚洲精品一二三| 欧美午夜电影在线播放| 午夜日韩在线电影| 日韩欧美一区在线| 麻豆国产精品777777在线| 日韩精品专区在线| 黄色日韩网站视频| 国产精品久久久久永久免费观看 | 国精产品一区一区三区mba桃花 | 日韩欧美视频在线| 国产在线看一区| 国产精品乱人伦| 色网综合在线观看| 天堂成人免费av电影一区| 日韩欧美中文一区二区| 国产精品亚洲视频| 亚洲精品国产一区二区精华液| 欧美日韩中文一区| 久久国产麻豆精品| 国产精品久久久久7777按摩| 欧亚洲嫩模精品一区三区| 美女性感视频久久| 国产精品午夜春色av| 在线观看av一区二区| 国产曰批免费观看久久久| 一区精品在线播放| 制服丝袜国产精品| yourporn久久国产精品| 日韩专区在线视频| 亚洲国产高清aⅴ视频| 欧美日韩免费观看一区二区三区| 精彩视频一区二区| 一区二区三区波多野结衣在线观看 | 国产高清精品网站| 亚洲图片自拍偷拍| 国产亚洲精久久久久久| 精品视频一区三区九区| 国产成人在线视频网址| 图片区小说区国产精品视频| 国产精品久久久久影院色老大| 欧美高清www午色夜在线视频| 成人黄色电影在线| 免费在线观看视频一区| 亚洲精品日产精品乱码不卡| 精品美女一区二区| 欧美欧美欧美欧美| 97成人超碰视| 国产乱人伦偷精品视频免下载| 午夜伦欧美伦电影理论片| 国产精品免费视频观看| 久久综合久久综合九色| 欧美日韩中文另类| 91麻豆国产自产在线观看| 国产呦精品一区二区三区网站| 日日骚欧美日韩| 亚洲一区二区在线视频| 亚洲色图欧美偷拍| 国产偷v国产偷v亚洲高清| 日韩欧美色综合网站| 7777精品伊人久久久大香线蕉超级流畅| 成人蜜臀av电影| 国产成人午夜99999| 狠狠色丁香婷综合久久| 美女国产一区二区| 轻轻草成人在线| 日日夜夜精品视频天天综合网| 亚洲综合在线第一页| 亚洲人成网站色在线观看| 国产精品欧美久久久久一区二区| 欧美v亚洲v综合ⅴ国产v| 欧美日本在线视频| 制服丝袜亚洲播放| 欧美一卡2卡三卡4卡5免费| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 99久久精品免费| av不卡在线观看| 色综合激情五月| 色哟哟一区二区在线观看 | 国产91精品一区二区麻豆网站 | 国产精品免费网站在线观看| 国产日韩欧美麻豆| 国产日韩一级二级三级| 中文字幕av不卡| 亚洲免费毛片网站| 一区二区三区影院| 亚洲自拍偷拍综合| 日韩精品一级二级| 久色婷婷小香蕉久久| 国产伦精品一区二区三区免费迷 | 69堂成人精品免费视频| 69精品人人人人| 欧美精品一区二区三区在线| 久久综合999| 国产精品第五页| 亚洲午夜久久久久久久久电影院| 亚洲第一福利一区| 久久电影网站中文字幕| 成人爽a毛片一区二区免费| 91视频一区二区三区| 69久久夜色精品国产69蝌蚪网| 欧美成人性战久久| 国产精品久久综合| 午夜av一区二区| 国产成人av一区二区三区在线| 色一情一乱一乱一91av| 欧美一级二级三级蜜桃| 日本一区二区三区电影| 亚洲国产美女搞黄色| 精品在线免费视频| 色中色一区二区| 欧美精品一区二区精品网| 中文字幕一区二区三区不卡| 丝袜美腿亚洲一区| 国产乱码精品一区二区三区忘忧草| 99久久婷婷国产综合精品| 欧美挠脚心视频网站| 国产精品午夜电影| 日本午夜一区二区| 91亚洲精品乱码久久久久久蜜桃| 欧美一级日韩不卡播放免费| 国产精品视频yy9299一区| 婷婷国产v国产偷v亚洲高清| 成人久久视频在线观看| 欧美一区二区三区播放老司机| 一区二区中文视频| 狠狠色2019综合网| 欧美美女一区二区三区| 欧美国产一区二区在线观看| 日韩av在线免费观看不卡| av在线不卡免费看| 久久久不卡影院| 日本欧美一区二区在线观看| 91色综合久久久久婷婷| 国产亚洲自拍一区| 精品写真视频在线观看| 欧美色视频在线观看| 欧美韩国日本一区| 韩日欧美一区二区三区| 欧美精品一级二级三级| 亚洲精品视频免费看| thepron国产精品| 欧美激情在线看| 国产又黄又大久久| 日韩一区二区三区免费观看| 亚洲小说欧美激情另类| 色先锋资源久久综合| 中文字幕在线不卡一区| 国产一区二区91| 26uuu国产电影一区二区| 美脚の诱脚舐め脚责91| 91精品国产综合久久蜜臀| 亚洲一区二区欧美激情| 在线观看免费成人| 一区二区三区中文在线| 日本乱人伦一区| 亚洲黄色性网站| 日本黄色一区二区| 一区二区三区四区不卡在线| 日本韩国欧美国产| 亚洲国产裸拍裸体视频在线观看乱了| 色域天天综合网| 一区二区三区四区国产精品| 欧美综合天天夜夜久久|