成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

close 中文man頁面

系統(tǒng)
close 關(guān)閉 一個 文件 描述符 , 使它 不在 指向 任何 文件 和 可以 在 新的 文件 操作 中 被 再次 使用. 任何 與 此 文件 相關(guān)聯(lián) 的 以及 程序 所 擁有 的 鎖 , 都 會 被 刪除 (忽略 那些 持有 鎖 的 文件描述符)

NAME 名字

close - 關(guān)閉一個文件描述符  

SYNOPSIS 總覽

#include <unistd.h>

int close(int fd);

DESCRIPTION 描述

close 關(guān)閉 一個 文件 描述符 , 使它 不在 指向 任何 文件 和 可以 在 新的 文件 操作 中 被 再次 使用. 任何 與 此 文件 相關(guān)聯(lián) 的 以及 程序 所 擁有 的 鎖 , 都 會 被 刪除 (忽略 那些 持有 鎖 的 文件描述符)

假如 fd 是 最后 一個 文件描述符 與此 資源 相 關(guān)聯(lián) , 則 這個 資源 將 被 釋放. 若此 描述符 是 最后 一個 引用 到 此 文件 上 的 , 則 文件 將 使用 unlink(2) 刪除.  

RETURN VALUE 返回值

close 返回 0 表示 成功 , 或者 -1 表示 有 錯誤 發(fā)生 .  

ERRORS 錯誤信息

EBADF
fd 不是 一個 有效 的 已 被 打開 的 文件 的 描述符
EINTR
The close() 調(diào)用 被 一 信號 中斷.
EIO
I/O 有 錯誤 發(fā)生

CONFORMING TO

SVr4, SVID, POSIX, X/OPEN, BSD 4.3. SVr4 documents an additional ENOLINK error condition.  

NOTES 注意

通常 不檢測 返回值 , 除了 發(fā)生 嚴(yán)重 的 程序 錯誤. 文件系統(tǒng) 使用 了 "write-behind" 的 技術(shù) 提高 了 執(zhí)行 write(2) 時 的 性能 . 即使 還 沒有 被 寫 , 寫操作 也會 成功 . 錯誤 信息 在 寫操作 以后報告 , 但是 這 保證 在 關(guān)閉 文件 時 報告 . 在 關(guān)閉 文件 時 不檢測 返回值 可能會 導(dǎo)致 數(shù)據(jù) 的 丟失 . 這 一點 在 NFS 和 磁盤 配額 上 比較 明顯.

由于 內(nèi)核 會 延遲 寫 , 所以 就算 成功 關(guān)閉 一個 文件 不能 保證 數(shù)據(jù) 被 成功 的 寫到 磁盤 上. 當(dāng) 文件流 關(guān)閉 時 , 對 文件系統(tǒng) 來說 一般 不去 刷新 緩沖區(qū) . 如果 你 要 保證 數(shù)據(jù) 寫入磁盤 等 物理 存貯器 中就 使用 fsync(2) 或 sync(2), 他們 會 做到 你想做的 (對于 這一點 要 依賴于 磁盤 設(shè)備).  

SEE ALSO 參考

open(2), fcntl(2), shutdown(2), unlink(2), fclose(3)

#p#

NAME

close - close a file descriptor  

SYNOPSIS

#include <unistd.h>

int close(int fd);

DESCRIPTION

close closes a file descriptor, so that it no longer refers to any file and may be reused. Any locks held on the file it was associated with, and owned by the process, are removed (regardless of the file descriptor that was used to obtain the lock).

If fd is the last copy of a particular file descriptor the resources associated with it are freed; if the descriptor was the last reference to a file which has been removed using unlink(2) the file is deleted.  

RETURN VALUE

close returns zero on success, or -1 if an error occurred.  

ERRORS

EBADF
fd isn't a valid open file descriptor.
EINTR
The close() call was interrupted by a signal.
EIO
An I/O error occurred.

CONFORMING TO

SVr4, SVID, POSIX, X/OPEN, BSD 4.3. SVr4 documents an additional ENOLINK error condition.  

NOTES

Not checking the return value of close is a common but nevertheless serious programming error. It is quite possible that errors on a previous write(2) operation are first reported at the final close. Not checking the return value when closing the file may lead to silent loss of data. This can especially be observed with NFS and disk quotas.

A successful close does not guarantee that the data has been successfully saved to disk, as the kernel defers writes. It is not common for a filesystem to flush the buffers when the stream is closed. If you need to be sure that the data is physically stored use fsync(2). (It will depend on the disk hardware at this point.)  

SEE ALSO

open(2), fcntl(2), shutdown(2), unlink(2), fclose(3), fsync(2)

責(zé)任編輯:韓亞珊 來源: CMPP.net
相關(guān)推薦

2011-08-24 10:24:26

CLOSE中文man

2011-08-25 16:57:51

iconv_close中文man

2011-08-15 10:21:09

man中文man

2011-08-24 16:48:36

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-11 15:03:21

ACCESS中文man

2011-08-11 15:28:43

ali中文man

2011-08-11 16:31:49

biff中文man

2011-08-11 17:16:43

cce中文man

2011-08-11 18:05:04

chvt中文man

2011-08-11 18:13:07

clear中文man

2011-08-12 09:13:02

df中文man

2011-08-12 09:38:06

dircolors中文man

2011-08-12 09:44:37

dirname中文man

2011-08-12 10:20:02

echo中文man

2011-08-12 10:25:55

eject中文man

2011-08-12 11:07:19

git中文man

2011-08-12 13:18:19

head中文man

2011-08-12 13:49:23

hostid中文man
點贊
收藏

51CTO技術(shù)棧公眾號

主站蜘蛛池模板: 九色在线观看 | 精品中文在线 | 免费精品| 国产精品视频导航 | 天天干精品| 亚州综合在线 | 欧美xxxx色视频在线观看免费 | 中文字幕一区在线观看视频 | 精品亚洲一区二区三区四区五区高 | 综合久| av免费网站在线观看 | 日韩无| 久久91av | 亚洲国产一区二区三区四区 | 91在线视频网址 | 亚洲一区二区三区免费视频 | 亚洲综合五月天婷婷 | 免费看一级毛片 | 国产精品一区在线观看你懂的 | 精品综合 | 伊人久久国产 | 日韩一区二区黄色片 | 噜啊噜在线 | 欧产日产国产精品视频 | 超碰在线观看97 | 色黄网站 | 亚洲视频一 | 亚洲精选一区 | 欧美一区二区另类 | 国产欧美一区二区三区在线看蜜臀 | 日本一区二区三区四区 | 神马久久久久久久久久 | 中文字幕视频在线观看 | 国内精品久久久久久 | 国产95在线| 国产成人福利 | 久草热8精品视频在线观看 午夜伦4480yy私人影院 | 国产精品无码久久久久 | 亚洲国产精品久久久 | 亚洲一区二区三区免费在线观看 | 五月婷婷视频 |