一 : deallocvt 中文man页面(1)
deallocvt - 释放未使用的虚拟终端
deallocvt [N1 N2... ]
如果不指定参数,deallocvt程序会释放所有未使用的虚拟终端的核心内存和数据结构. 如果给定了参数Ni那么就只释放TTY /dev/ttyNi.
如果一个虚拟终端不是前台控制台,而且没有在上面打开进程执行读或写操作,又没有在该屏幕上选择文本,那么认为该终端是未使用的.
chvt(1),openvt(1).
deallocvt 中文man页面(1)_dealloc
deallocvt - deallocate unused virtual consoles
deallocvt[N...]
The commanddeallocvtdeallocates kernel memory and data structures for all unused virtual consoles. If one or more argumentsN... are given, only the corresponding consoles/dev/ttyNare deallocated.
A virtual console is unused if it is not the foreground console, and no process has it open for reading or writing, and no text has been selected on its screen.
chvt(1),openvt(1)
二 : arp 中文man页面(1)
arp - Linux的ARP核心模块
这个核心协议模块实现RFC826中定义的 Address Resolution Protocol [译注:即TCP/IP的第三层到第一层的地址转换协议],用于在直接相连的网络中换第二层硬件地址和 Ipv4 协议地址之间的转换。用户除非想对其进行配置,否则一般不会直接操作这个模块。
实际上,它提供对核心中其它协议的服务。
用户进程可以使用packet(7) 的 sockets,收到 ARP 包(译注:一译分组)。还有一种机制是使用netlink(7) sockets,在用户空间管理 ARP 缓存的机制。我们也可以通过ioctl (2)控制任意PF_INETsocket上的 ARP 表
ARP 模块维护一个硬件地址到协议地址映射的缓存。这个缓存有大小限制,所以不常用的和旧的记录(Entry)将被垃圾收集器清除(garbage-collected),垃圾收集器永远不能删除标为永久的记录。我们可以使用ioctls直接操纵缓冲,并且其性状可以用下面定义的 sysctl 调节。
如果在限定的时间(见下面的sysctl)内,一条现存映射没有肯定反馈时,则认为相邻层的缓存记录失效。为了再次向目标发送数据,ARP将首先试着询问本地arp进程app_solicit次,获取更新了的 MAC(介质访问控制)地址。如果失败,并且旧的MAC地址是已知的,则发送ucast_solicit次的 unicast probe。如果仍然失败,则将向网络广播一个新的ARP请求,此时要有待发送数据的队列
如果 Linux 接到一个地址请求,而且该地址指向 Linux 转发的地址,并且接收接口打开了代理 arp 时,Linux 将自动添加一条非永久的代理 arp 记录;如果存在拒绝到目标的路由,则不添加代理 arp 记录。
有三个 ioctl 可以用于所有PF_INET的 sockets 中。它们以一个指向struct arpreq的指针作为它们的参数。
struct arpreq{struct sockaddr arp_pa; /* 协议地址(protocol address)*/struct sockaddr arp_ha; /* 硬件地址(hardware address) */int arp_flags; /* 标志(flags) */struct sockaddr arp_netmask; /* 协议地址的网络掩码(netmask of protocol address)*/char arp_dev[16];};
SIOCSARP,SIOCDARP和SIOCGARP可分贝设置、删除和获取 ARP 映射。设置和删除 ARP 映射是特许操作,只有拥有CAP_NET_ADMIN权限的进程或有效UID为0的进程可以执行。
arp_pa必须是AF_INETsocket,并且arp_ha必须有和arp_dev. 指定的设备相同的类型。arp_dev是个以null结束的设备名字符串。
arp_flags | |
标志(flag) | 含义(meaning) |
ATF_COM | 查找完成(Lookup complete) |
ATF_PERM | 永久记录(Permanent entry) |
ATF_PUBL | 张贴记录(Publish entry) |
ATF_USETRAILERS | 要求使用后缀(Trailers requested) |
ATF_NETMASK | 使用网络掩码(Use a netmask) |
ATF_DONTPUB | 不回复(Don't answer) |
如果设置了ATF_NETMASK标志,那么arp_netmask必须有效。 Linux 2.2 不支持代理网络 ARP 记录,因此,要设成0xffffffff或者0,以删除现存代理arp记录。这里不使用现存代理arp记录。ATF_USETRAILERS已经过时了,不应该继续使用。
ARP 支持一个 sysctl 接口,可以用以配置全局参数或逐个网络接口地进行配制。该 sysctl 可以通过/proc/sys/net/ipv4/neigh/*/*文件或者使用sysctl(2) 接口来访问。系统中每个接口都在 /proc/sys/net/ipv4/neigh/. 中有自己的目录。`default'目录中的设置用于所有新建的设备。 sysctl 相关的时间是以秒为单位,除非特别声明过.
时钟设置的时间单位 jiffy,跟硬件体系有关。在 Alpha 上,一个 jiffy 是 1/1024 秒,而在其它机器上,是 1/100 秒。
目前还没有办法从用户空间发送肯定反馈。这意味着在用户空间实现的面向连接的协议(connection oriented protocols)将产生大量的 ARP 通讯。因为ndisc将重新探测MAC地址。内核 NFS 的实现也存在同样的问题。
这个手册页主要讲 IPv4 规范并且共享 IPv4 和 IPv6 的功能.
Linux 2.0中的struct arpreq,添加了arp_dev,同时 ioctl 数目也改变了。在 Linux 2.2 中将不再支持旧的ioctl。
在 Linux 2.2 中,取消了对网络代理 arp 记录(网络掩码不是0xffffffff)的支持。这个功能被内核设置的一个自动代理 arp 取代,这个自动代理 arp 用于所有位于其它接上的可到达的主机(如果该接口的转发和代理 arp 打开了)。
ip(7)
arp 中文man页面(1)_arp
arp - Linux ARP kernel module.
This kernel protocol module implements the Address Resolution Protocol defined in RFC 826. It is used to convert between Layer2 hardware addresses and IPv4 protocol addresses on directly connected networks. The user normally doesn't interact directly with this module except to configure it; instead it provides a service for other protocols in the kernel.
A user process can receive ARP packets by usingpacket(7) sockets. There is also a mechanism for managing the ARP cache in user-space by usingnetlink(7) sockets. The ARP table can also be controlled viaioctl (2)on anyPF_INETsocket.
The ARP module maintains a cache of mappings between hardware addresses and protocol addresses. The cache has a limited size so old and less frequently used entries are garbage-collected. Entries which are marked as permanent are never deleted by the garbage-collector. The cache can be directly manipulated by the use of ioctls and its behaviour can be tuned by the sysctls defined below.
When there is no positive feedback for an existing mapping after some time (see the sysctls below) a neighbour cache entry is considered stale. Positive feedback can be gotten from a higher layer; for example from a successful TCP ACK. Other protocols can signal forward progress using theMSG_CONFIRMflag tosendmsg(2). When there is no forward progress ARP tries to reprobe. It first tries to ask a local arp daemonapp_solicittimes for an updated MAC address. If that fails and an old MAC address is known an unicast probe is senducast_solicittimes. If that fails too it will broadcast a new ARP request to the network. Requests are only send when there is data queued for sending.
Linux will automatically add a non-permanent proxy arp entry when it receives a request for an address it forwards to and proxy arp is enabled on the receiving interface. When there is a reject route for the target no proxy arp entry is added.
Three ioctls are available on allPF_INETsockets. They take a pointer to astruct arpreqas their parameter.
struct arpreq{ struct sockaddr arp_pa; /* protocol address */ struct sockaddr arp_ha; /* hardware address */ int arp_flags; /* flags */ struct sockaddr arp_netmask; /* netmask of protocol address */ char arp_dev[16];};
SIOCSARP,SIOCDARPandSIOCGARPrespectively set, delete and get an ARP mapping. Setting & deleting ARP maps are privileged operations and may only be performed by a process with theCAP_NET_ADMINcapability or an effective UID of 0.
arp_pamust be anAF_INETsocket andarp_hamust have the same type as the device which is specified inarp_dev.arp_devis a zero-terminated string which names a device.
arp_flags | |
flag | meaning |
ATF_COM | Lookup complete |
ATF_PERM | Permanent entry |
ATF_PUBL | Publish entry |
ATF_USETRAILERS | Trailers requested |
ATF_NETMASK | Use a netmask |
ATF_DONTPUB | Don't answer |
If theATF_NETMASKflag is set, thenarp_netmaskshould be valid. Linux 2.2 does not support proxy network ARP entries, so this should be set to 0xffffffff, or 0 to remove an existing proxy arp entry.ATF_USETRAILERSis obsolete and should not be used.
ARP supports a sysctl interface to configure parameters on a global or per-interface basis. The sysctls can be accessed by reading or writing the/proc/sys/net/ipv4/neigh/*/*files or with thesysctl(2) interface. Each interface in the system has its own directory in /proc/sys/net/ipv4/neigh/. The setting in the `default' directory is used for all newly created devices. Unless otherwise specified time related sysctls are specified in seconds.
Some timer settings are specified in jiffies, which is architecture related. On the Alpha a jiffy is 1/1024 of a second, on most other architectures it is 1/100s.
There is no way to signal positive feedback from user space. This means connection oriented protocols implemented in user space will generate excessive ARP traffic, because ndisc will regularly reprobe the MAC address. The same problem applies for some kernel protocols (e.g. NFS over UDP).
This man page mashes IPv4 specific and shared between IPv4 and IPv6 functionality together.
Thestruct arpreqchanged in Linux 2.0 to include thearp_devmember and the ioctl numbers changed at the same time. Support for the old ioctls was dropped in Linux 2.2.
Support for proxy arp entries for networks (netmask not equal 0xffffffff) was dropped in Linux 2.2. It is replaced by automatic proxy arp setup by the kernel for all reachable hosts on other interfaces (when forwarding and proxy arp is enabled for the interface).
The neigh/* sysctls did not exist before Linux 2.2.
ip(7)
三 : sprintf 中文man页面(1)
printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf - 输出格式转换
#include <stdio.h>
int printf(const char *format, ...);
int fprintf(FILE *stream, const char *format, ...);
int sprintf(char *str, const char *format, ...);
int snprintf(char *str, size_tsize, const char *format, ...);
#include <stdarg.h>
int vprintf(const char *format, va_listap);
int vfprintf(FILE *stream, const char *format, va_listap);
int vsprintf(char *str, const char *format, va_listap);
int vsnprintf(char *str, size_tsize, const char *format, va_listap);
printf系列 函数 根据 下述的format参数 生成 输出内容.printf和vprintf函数 把 输出内容 写到stdout, 即 标准输出流;fprintf和vfprintf函数 把 输出内容 写到 给定的stream流;sprintf,snprintf,vsprintf和vsnprintf函数 把 输出内容 存放到 字符串str中.
这些 函数 由 格式字符串format参数 控制 输出内容, 它 指出 怎么样 把 后面的 参数 (或 通过stdarg(3) 的 变长参数机制 访问的 参数) 转换成 输出内容.
这些 函数 返回 打印的 字符 数量 (不包括 字符串 结尾用的 `\0').snprintf和vsnprintf的 输出 不会 超过size字节 (包括了 结尾的 `\0'), 如果 因为 这个 限制 导致 输出内容 被截断, 则 函数 返回 -1.
格式字符串 (format 参数) 由 零到多个 指令 组成: 普通字符 (除%外), 它们 被 原封不动的 送到 输出流; 以及 格式转换说明 (conversion specification), 每个 格式转换说明 都会 从后面 提取 零到多个 参数. 格式转换说明 由%字符 引导开始. 参数 必须 正确的 对应到 格式转换符 (conversion specifier) 上. 下述 字符 按顺序 列在%后面:
可以 用 星号 `*' 代替 数字 指定 域宽 或 精度, 也可以 两者 同时 指定. 这种情况下 要求 用一个int参数 指出 域宽 或 精度. 负域宽 被认为是 正域宽 跟在 向左对齐标志 后面; 负精度 被认为是 精度 丢失.
格式转换符(specifier) 及其 含义 如下:
不指定 域宽 或 偏小的 域宽 不会 导致 内容 被截断; 如果 转换结果 的 长度超过 其域宽, 则 域宽 会 扩大到 容下 完整的 结果.
以 `Sunday, July 3, 10:02' 格式 显示 日期, 其中weekday和month是 字符串指针:
#include <stdio.h>fprintf(stdout, "%s, %s %d, %.2d:%.2d\n", weekday, month, day, hour, min);
显示 五位 十进制数:
#include <math.h>#include <stdio.h>fprintf(stdout, "pi = %.5f\n", 4 * atan(1.0));
分配 128 个 字节 的 字符串 空间 保存 打印 结果:
#include <stdio.h>#include <stdlib.h>#include <stdarg.h>char *newfmt(const char *fmt, ...){ char *p; va_list ap; if ((p = malloc(128)) == NULL) return (NULL); va_start(ap, fmt); (void) vsnprintf(p, 128, fmt, ap); va_end(ap); return (p);}
printf(1),scanf(3)
sprintf 中文man页面(1)_sprintf
printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf - formatted output conversion
#include <stdio.h>
int printf(const char *format, ...);
int fprintf(FILE *stream, const char *format, ...);
int sprintf(char *str, const char *format, ...);
int snprintf(char *str, size_tsize, const char *format, ...);
#include <stdarg.h>
int vprintf(const char *format, va_listap);
int vfprintf(FILE *stream, const char *format, va_listap);
int vsprintf(char *str, const char *format, va_listap);
int vsnprintf(char *str, size_tsize, const char *format, va_listap);
The functions in theprintffamily produce output according to aformatas described below. The functionsprintfandvprintfwrite output tostdout, the standard output stream;fprintfandvfprintfwrite output to the given outputstream;sprintf,snprintf,vsprintfandvsnprintfwrite to the character stringstr.
The functionsvprintf,vfprintf,vsprintf,vsnprintfare equivalent to the functionsprintf,fprintf,sprintf,snprintf, respectively, except that they are called with a va_list instead of a variable number of arguments. These functions do not call theva_endmacro. Consequently, the value ofapis undefined after the call. The application should callva_end(ap)itself afterwards.
These eight functions write the output under the control of aformatstring that specifies how subsequent arguments (or arguments accessed via the variable-length argument facilities ofstdarg(3)) are converted for output.
Upon successful return, these functions return the number of characters printed (not including the trailing '\0' used to end output to strings). The functionssnprintfandvsnprintfdo not write more thansizebytes (including the trailing '\0'). If the output was truncated due to this limit then the return value is the number of characters (not including the trailing '\0') which would have been written to the final string if enough space had been available. Thus, a return value ofsizeor more means that the output was truncated. (See also below under NOTES.) If an output error is encountered, a negative value is returned.
The format string is a character string, beginning and ending in its initial shift state, if any. The format string is composed of zero or more directives: ordinary characters (not%), which are copied unchanged to the output stream; and conversion specifications, each of which results in fetching zero or more subsequent arguments. Each conversion specification is introduced by the character%, and ends with aconversion specifier. In between there may be (in this order) zero or moreflags, an optional minimumfield width, an optionalprecisionand an optionallength modifier.
The arguments must correspond properly (after type promotion) with the conversion specifier. By default, the arguments are used in the order given, where each `*' and each conversion specifier asks for the next argument (and it is an error if insufficiently many arguments are given). One can also specify explicitly which argument is taken, at each place where an argument is required, by writing `%m$' instead of `%' and `*m$' instead of `*', where the decimal integer m denotes the position in the argument list of the desired argument, indexed starting from 1. Thus,
printf("%*d", width, num);
and
printf("%2$*1$d", width, num);
are equivalent. The second style allows repeated references to the same argument. The C99 standard does not include the style using `$', which comes from the Single Unix Specification. If the style using `$' is used, it must be used throughout for all conversions taking an argument and all width and precision arguments, but it may be mixed with `%%' formats which do not consume an argument. There may be no gaps in the numbers of arguments specified using `$'; for example, if arguments 1 and 3 are specified, argument 2 must also be specified somewhere in the format string.
For some numeric conversions a radix character (`decimal point') or thousands' grouping character is used. The actual character used depends on the LC_NUMERIC part of the locale. The POSIX locale uses `.' as radix character, and does not have a grouping character. Thus,
printf("%'.2f", 1234567.89);
results in `1234567.89' in the POSIX locale, in `1234567,89' in the nl_NL locale, and in `1.234.567,89' in the da_DK locale.
The character % is followed by zero or more of the following flags:
The five flag characters above are defined in the C standard. The SUSv2 specifies one further flag character.
glibc 2.2 adds one further flag character.
An optional decimal digit string (with nonzero first digit) specifying a minimum field width. If the converted value has fewer characters than the field width, it will be padded with spaces on the left (or right, if the left-adjustment flag has been given). Instead of a decimal digit string one may write `*' or `*m$' (for some decimal integer m) to specify that the field width is given in the next argument, or in the m-th argument, respectively, which must be of typeint. A negative field width is taken as a `-' flag followed by a positive field width. In no case does a non-existent or small field width cause truncation of a field; if the result of a conversion is wider than the field width, the field is expanded to contain the conversion result.
An optional precision, in the form of a period (`.') followed by an optional decimal digit string. Instead of a decimal digit string one may write `*' or `*m$' (for some decimal integer m) to specify that the precision is given in the next argument, or in the m-th argument, respectively, which must be of typeint. If the precision is given as just `.', or the precision is negative, the precision is taken to be zero. This gives the minimum number of digits to appear ford,i,o,u,x, andXconversions, the number of digits to appear after the radix character fora,A,e,E,f, andFconversions, the maximum number of significant digits forgandGconversions, or the maximum number of characters to be printed from a string forsandSconversions.
Here, `integer conversion' stands ford,i,o,u,x, orXconversion.
The SUSv2 only knows about the length modifiersh(inhd,hi,ho,hx,hX,hn) andl(inld,li,lo,lx,lX,ln,lc,ls) andL(inLe,LE,Lf,Lg,LG).
A character that specifies the type of conversion to be applied. The conversion specifiers and their meanings are:
(The SUSv2 does not know aboutFand says that character string representations for infinity and NaN may be made available. The C99 standard specifies `[-]inf' or `[-]infinity' for infinity, and a string starting with `nan' for NaN, in the case offconversion, and `[-]INF' or `[-]INFINITY' or `NAN*' in the case ofFconversion.)
If anlmodifier is present: Theconst wchar_t *argument is expected to be a pointer to an array of wide characters. Wide characters from the array are converted to multibyte characters (each by a call to thewcrtombfunction, with a conversion state starting in the initial state before the first wide character), up to and including a terminating null wide character. The resulting multibyte characters are written up to (but not including) the terminating null byte. If a precision is specified, no more bytes than the number specified are written, but no partial multibyte characters are written. Note that the precision determines the number ofbyteswritten, not the number ofwide charactersorscreen positions. The array must contain a terminating null wide character, unless a precision is given and it is so small that the number of bytes written exceeds it before the end of the array is reached.
To print to five decimal places:
#include <math.h>#include <stdio.h>fprintf(stdout, "pi = %.5f\n", 4 * atan(1.0));
To print a date and time in the form `Sunday, July 3, 10:02', whereweekdayandmonthare pointers to strings:
#include <stdio.h>fprintf(stdout, "%s, %s %d, %.2d:%.2d\n", weekday, month, day, hour, min);
Many countries use the day-month-year order. Hence, an internationalized version must be able to print the arguments in an order specified by the format:
#include <stdio.h>fprintf(stdout, format, weekday, month, day, hour, min);
whereformatdepends on locale, and may permute the arguments. With the value
"%1$s, %3$d. %2$s, %4$d:%5$.2d\n"
one might obtain `Sonntag, 3. Juli, 10:02'.
To allocate a sufficiently large string and print into it (code correct for both glibc 2.0 and glibc 2.1):
#include <stdio.h>#include <stdlib.h>#include <stdarg.h>char *make_message(const char *fmt, ...) { /* Guess we need no more than 100 bytes. */ int n, size = 100; char *p; va_list ap; if ((p = malloc (size)) == NULL) return NULL; while (1) { /* Try to print in the allocated space. */ va_start(ap, fmt); n = vsnprintf (p, size, fmt, ap); va_end(ap); /* If that worked, return the string. */ if (n > -1 && n < size) return p; /* Else try again with more space. */ if (n > -1) /* glibc 2.1 */ size = n+1; /* precisely what is needed */ else /* glibc 2.0 */ size *= 2; /* twice the old size */ if ((p = realloc (p, size)) == NULL) return NULL; }}
The glibc implementation of the functionssnprintfandvsnprintfconforms to the C99 standard, i.e., behaves as described above, since glibc version 2.1. Until glibc 2.0.6 they would return -1 when the output was truncated.
Thefprintf,printf,sprintf,vprintf,vfprintf, andvsprintffunctions conform to ANSI X3.159-1989 (``ANSI C'') and ISO/IEC 9899:1999 (``ISO C99''). Thesnprintfandvsnprintffunctions conform to ISO/IEC 9899:1999.
Concerning the return value ofsnprintf, the SUSv2 and the C99 standard contradict each other: whensnprintfis called withsize=0 then SUSv2 stipulates an unspecified return value less than 1, while C99 allowsstrto be NULL in this case, and gives the return value (as always) as the number of characters that would have been written in case the output string has been large enough.
Linux libc4 knows about the five C standard flags. It knows about the length modifiers h,l,L, and the conversions cdeEfFgGinopsuxX, where F is a synonym for f. Additionally, it accepts D,O,U as synonyms for ld,lo,lu. (This is bad, and caused serious bugs later, when support for %D disappeared.) No locale-dependent radix character, no thousands' separator, no NaN or infinity, no %m$ and *m$.
Linux libc5 knows about the five C standard flags and the ' flag, locale, %m$ and *m$. It knows about the length modifiers h,l,L,Z,q, but accepts L and q both for long doubles and for long long integers (this is a bug). It no longer recognizes FDOU, but adds a new conversion characterm, which outputsstrerror(errno).
glibc 2.0 adds conversion characters C and S.
glibc 2.1 adds length modifiers hh,j,t,z and conversion characters a,A.
glibc 2.2 adds the conversion character F with C99 semantics, and the flag character I.
Unix V7 defines the three routinesprintf,fprintf,sprintf, and has the flag -, the width or precision *, the length modifier l, and the conversions doxfegcsu, and also D,O,U,X as synonyms for ld,lo,lu,lx. This is still true for BSD 2.9.1, but BSD 2.10 has the flags #, + and <space> and no longer mentions D,O,U,X. BSD 2.11 hasvprintf,vfprintf,vsprintf, and warns not to use D,O,U,X. BSD 4.3 Reno has the flag 0, the length modifiers h and L, and the conversions n, p, E, G, X (with current meaning) and deprecates D,O,U. BSD 4.4 introduces the functionssnprintfandvsnprintf, and the length modifier q. FreeBSD also has functionsasprintfandvasprintf, that allocate a buffer large enough forsprintf. In glibc there are functionsdprintfandvdprintfthat print to a file descriptor instead of a stream.
Becausesprintfandvsprintfassume an arbitrarily long string, callers must be careful not to overflow the actual space; this is often impossible to assure. Note that the length of the strings produced is locale-dependent and difficult to predict. Usesnprintfandvsnprintfinstead (orasprintfandvasprintf).
Linux libc4.[45] does not have asnprintf, but provides a libbsd that contains ansnprintfequivalent tosprintf, i.e., one that ignores thesizeargument. Thus, the use ofsnprintfwith early libc4 leads to serious security problems.
Code such asprintf(foo);often indicates a bug, sincefoomay contain a % character. Iffoocomes from untrusted user input, it may contain %n, causing theprintfcall to write to memory and creating a security hole.
printf(1),asprintf(3),dprintf(3),wcrtomb(3),wprintf(3),scanf(3),locale(5)
四 : fclose 中文man页面(1)
fclose - 关闭流
#include <stdio.h>
int fclose(FILE *stream);
函数fclose将名为stream的流与它底层关联的文件或功能集合断开。如果流曾用作输出,任何缓冲的数据都将首先被写入,使用fflush(3) 。
成功执行返回 0,否则返回EOF并设置全局变量errno来指示错误发生。任何一种情况下,对流再进行存取 (包括再次调用fclose()) 都会带来未定义的结果。
函数fclose也可能失败并置errno为close(2),write(2) 或fflush(3) 指定的值。
注意fclose仅仅刷新用户空间的由 C 库提供的缓冲。要保证数据被物理地存储到磁盘上,必须也刷新内核缓冲。例如,使用sync(2) 或fsync(2).
函数fclose遵循 ANSI X3.159-1989 (``ANSI C'') 标准。
close(2),fcloseall(3),fflush(3),fopen(3),setbuf(3)
fclose 中文man页面(1)_fclose
fclose - close a stream
#include <stdio.h>
int fclose(FILE *stream);
Thefclosefunction dissociates the namedstreamfrom its underlying file or set of functions. If the stream was being used for output, any buffered data is written first, usingfflush(3).
Upon successful completion 0 is returned. Otherwise,EOFis returned and the global variableerrnois set to indicate the error. In either case any further access (including another call tofclose()) to the stream results in undefined behaviour.
Thefclosefunction may also fail and seterrnofor any of the errors specified for the routinesclose(2),write(2) orfflush(3).
Note thatfcloseonly flushes the user space buffers provided by the C library. To ensure that the data is physically stored on disk the kernel buffers must be flushed too, e.g. withsync(2) orfsync(2).
Thefclosefunction conforms to ANSI X3.159-1989 (``ANSI C'').
close(2),fcloseall(3),fflush(3),fopen(3),setbuf(3)
本文标题:192.168.1.1登录页面-deallocvt 中文man页面(1)61阅读| 精彩专题| 最新文章| 热门文章| 苏ICP备13036349号-1