CLOSE(2) Linux Programmer's Manual CLOSE(2)

NAME

close - close a file descriptor

//关闭一个fd

SYNOPSIS

#include

int close(int fd);

DESCRIPTION

close() closes a file descriptor, so that it no longer refers to any file and

may be reused. Any record locks (see fcntl(2)) 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).

//close()关闭一个fd,这样fd就不会被其他文件调用和再次使用.任何对文件抓紧不放的记录锁是有联系的,

//被进程所有的,被清除(除了fd被使用来阻止这个锁).??

If fd is the last file descriptor referring to the underlying open file

description (see open(2)), the resources associated with the open file

description are freed; if the descriptor was the last reference to a file

which has been removed using unlink(2) the file is deleted.

//如果fd是使用open()打开的最后文件的fd,与打开文件联系的资源就被释放.

//如果fd是使用unlink()打开的最后文件的fd,那么文件被删除

RETURN VALUE

close() returns zero on success. On error, -1 is returned, and errno is set

appropriately.

//成功:0

//错误:-1

ERRORS

EBADF fd isn't a valid open file descriptor.

//fd不是一个有效的打开的fd

EINTR The close() call was interrupted by a signal; see signal(7).

//close()被信号中断

EIO An I/O error occurred.

//发生I/O错误

CONFORMING TO

SVr4, 4.3BSD, POSIX.1-2001.

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 with disk quota.

//一般是不检查close()的返回值的,但是仍然会有一些程序错误.很可能在之前的write()操作在最后的

//close()时被报告出来.当关闭文件会导致数据的静静的流失的时候,不要渐染返回值.

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 file

system 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.)

//成功的关闭并不能保证数据成功的写入磁盘,因为kernel会延迟写入.当流关闭的时候文件系统冲洗缓存

//不是一个普遍的现象.如果你需要确认数据被物理的存储你可以使用fsync().(这取决于在此点是的硬盘)

It is probably unwise to close file descriptors while they may be in use by

system calls in other threads in the same process. Since a file descriptor

may be reused, there are some obscure race conditions that may cause

unintended side effects.

//当在同一进程的不同线程中系统调用fd的时候就关闭fd可能是不明智的.因为fd可以被再使用,

//有一些模糊的竞态条件可能会导致无意识的作用.

SEE ALSO

COLOPHON

This page is part of release 3.29 of the Linux man-pages project. A

description of the project, and information about reporting bugs, can be found

at http://www.kernel.org/doc/man-pages/.

Linux 2007-12-28 CLOSE(2)

linux man 手册翻译,close (linux man) 翻译相关推荐

  1. linux的命令窗口,(翻译)Linux命令行(二)

    文件和目录操作 cd /home              进入'/home'目录 cd ..                     返回上一层目录 cd ../..             返回上 ...

  2. linux语言 翻译工具,Linux文本转语音工具eSpeak介绍

    Text to speech tool in Linux eSpeak是一款 Linux 命令行工具,能把文本转换成语音.它是一款简洁的语音合成器,用C语言编写而成,它支持英语和其它多种语言. eSp ...

  3. Linux 管理员手册(2)

    2019独角兽企业重金招聘Python工程师标准>>> Linux 管理员手册(2) 本章说明标准Linux目录树的重要部分,基于FSSTND文件系统标准.概述根据不同的目的和给定的 ...

  4. Nessus 4.4 windows and linux 安装手册

    Nessus 4.4 windows and linux 安装手册 网上Nessus资料多是3.x或是更早期的nessus,而4.2后nessus架构已改为B/S结构,windows下也不是如以前一样 ...

  5. debin linux 指令手册,debianGNULinux系统应用手册.pdf

    DebianGNU/Linux安装手册 June14,2017 DebianGNU/Linux安装手册 版权©2004–2017DebianInstaller团队 本手册属于自由软件,您可以在GNU通 ...

  6. Linux管理员手册

    为什么80%的码农都做不了架构师?>>>    Linux管理员手册 Linux管理员手册(1)--Linux系统概述 本章概述Linux系统.首先描述操作系统提供的主要服务.然后说 ...

  7. Linux管理传世经典:Linux 系统管理技术手册(第二版) 中文高清版下载

    Linux管理传世经典:Linux 系统管理技术手册(第二版) 中文高清版下载 转载于:https://www.cnblogs.com/gavinhughhu/archive/2010/07/05/1 ...

  8. 让技术Leader疯狂点赞的Linux速成手册,到底有多强悍?

    Linux简介 Linux是一种自由和开放源码的操作系统,存在着许多不同的Linux版本,但它们都使用了Linux内核.Linux可安装在各种计算机硬件设备中,比如手机.平板电脑.路由器.台式计算机 ...

  9. 让技术Leader狂点赞的Linux速成手册,到底有多强悍?

    最新的统计数据表明,Linux的采用正在以非常快的速度发展,Linux在过去几年中市场份额逐步提高,而在2020年更是有了明显的增长,5月份在这方面创造了新的记录. Linux的优势: Linux 不 ...

  10. 离线调用linux命令,GitHub - rinetd/linux-command: Linux命令大全搜索工具,内容包含Linux命令手册、详解、学习、搜集。...

    Linux Command 516 个 Linux 命令大全,内容包含 Linux 命令手册.详解.学习,值得收藏的 Linux 命令速查手册.请原谅我写了个爬虫,爬了他们家的数据linuxde.ne ...

最新文章

  1. WPF XAML 资源样式模板属性存放位置
  2. 远场语音识别错误率降低30%,百度提基于复数CNN网络的新技术
  3. Emacs之爬坑日记(一)
  4. shell提示符的个性化设定
  5. java延迟函数_Java 8:延迟计算
  6. 西安单招学校学计算机软件的,西北大学软件职业技术学院单招
  7. Java中的Enum的使用与分析
  8. 台账软件测试自学,测试情况汇总.docx
  9. 5个Python特性 越早知道越好的
  10. 任意进制的转换(C,C++)itoa函数,strtol函数,bitset函数,oct函数,dec函数,hex函数
  11. 《Ray Tracing in One Weekend》——Chapter 7: Diffuse materials
  12. mysql—触发器trigger
  13. Vmware虚拟机文件复制及改名称方法
  14. 庞加莱买面包的故事(一)
  15. 基于ssm的酒店客房管理系统(含数据库结构文档)
  16. 神经网络:Epoch、Batch Size和迭代
  17. Tableau导出PDF格式文件
  18. 第2章 C语言的赋值运算符、复合运算符与逗号运算符 (十一)
  19. 08-微服务版单点登陆系统(SSO)实践
  20. 相位式激光测距法中相位产生原理

热门文章

  1. EventBus的使用
  2. centos 安装及vim使用
  3. ToString(C2)转人民币金额时的相关问题
  4. TopFreeTheme精选免费模板【20130617】
  5. 绑定下拉菜单的通用方法
  6. Creating a Pager Control for ASP.NET以及Dino Esposito 分页组件的一个 Bug
  7. mysql 连接查询分组_详解MySQL中的分组查询与连接查询语句
  8. 报告PPT--Python程序设计,不仅仅是学习编程(35页)
  9. Python根据字符分组数量判断密码安全强度
  10. Python多线程编程基础1:为什么要使用线程