- 浏览: 443438 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (538)
- C/C++ Primer (69)
- Objective-C Primer (102)
- Python Primer (19)
- JavaScript Primer (1)
- Java Primer (37)
- PHP Primer (17)
- 泛 Linux (37)
- Shell Script (21)
- APUE (21)
- UNP__1&2 (19)
- NetWork (7)
- Oracle周边 (38)
- Mysql里边 (6)
- Windows技 (9)
- 简单算法 & 数据结构 (14)
- 设计模式 (6)
- GTK历程 (12)
- 工具使用 (25)
- 杂事 (23)
- 一些概念 (17)
- Web方面 (10)
- myCodeTools (9)
- ^未 竟$ (13)
- 硬件通信 (2)
- Games (1)
最新评论
无聊,贴些本章的关键字:
一、空洞文件、预读技术(read ahead)、缓冲
二、进程表->打开的文件描述符表->文件表
三、文件状态标志、文件偏移量、v与i节点表
四、多函数操作,都不可能是原子操作。
五、延迟写->减少物理IO->降低文件更新速度->数据丢失危险增大
关键函数:
open - close
read - write (内核级无缓冲)
creat
lseek
pread - pwrite
dup、dup2
sync 不等待
fsync 等待
fdatasync 类fsync,但只影响文件数据,不影响文件属性
fcntl 改变句柄性质
ioctl
系统命令:
od、dd
int fcntl(int filedes, int cmd, .../* int arg */); int fcntl(int filedes, int cmd, .../* struct flock *flockptr */); //记录锁 fcntl函数有5种功能: 1)复制一个现有的描述符(cmd = F_DUPFD) 2)get/set文件描述符标记(cmd = F_GETFD / F_SETFD) 3)get/set文件状态标志(cmd = F_GETFL / F_SETFL) 4)get/set异步I/O所有权(cmd = F_GETOWN / F_SETOWN) 5)get/set记录锁(cmd = F_GETLK / F_SETLK / F_SETLKW)
#include <fcntl.h> void set_fl(int fd, int flags); void clr_fl(int fd, int flags); void set_fl(int fd, int flags) // void clr_fl(int fd, int flags) { int val; if ((val = fcntl(fd, F_GETFL, 0)) < 0) printf("fcntl F_GETFL error"); val |= flags; // val &= ~flags; // if (fcntl(fd, F_SETFL, val) < 0) printf("fcntl F_SETFL error"); }
发表评论
-
execl
2010-10-28 11:13 819#include <stdio.h> ... -
dup2-close-fd
2010-10-28 10:54 783int main(int argc, char *argv ... -
Chapter 16__套接字
2010-10-25 11:39 562AF_INET、TCP、UDP、SCTP 报文界限 soc ... -
pthread_mutex_lock Test
2010-10-22 15:43 944#include <stdio.h> #in ... -
Chapter 14__高级IO
2010-10-20 11:45 685struct flock { short ... -
Chapter 15__进程间通信
2010-10-19 15:15 633- - 纯属抄书。。。 IPC(InterProcess ... -
APUE一栏入口
2010-10-14 15:25 734《UNIX环境高级编程》 《Advanced Programm ... -
Chapter 3__文件IO
2010-10-14 14:51 24int fcntl(int filedes, int cm ... -
Chapter 14
2010-10-14 09:01 6841、永远阻塞的调用有哪些? 阻塞,直到函数调用完成为止, ... -
Chapter 5__标准IO库
2010-10-12 11:56 5701)缓冲的本质是减少read和write调用的次数,也就是物 ... -
Chapter 4__文件和目录
2010-10-09 17:34 665一些概念: 主、次设备号 主设备号标识设备驱动程序 次设备号 ... -
Chapter 1__ls DIR And struct dirent
2010-10-08 10:25 58遍历目录 #include "aupe.h& ... -
stdarg.h 可变长参数
2010-09-30 12:13 719http://zh.wikipedia.org/zh-sg/S ... -
Practice Shell解释器
2010-09-29 15:34 929http://linux.chinaunix.net/bbs/ ... -
Chapter 13__守护进程Daemon
2010-09-29 14:43 604为什么守护进程会从进程中成为一类,相对普通进程有什么区别? ... -
Chapter 12__线程控制
2010-09-29 09:53 587★12.2线程限制,sysconf函数,增强可移植性; ★ ... -
Chapter 11__线程
2010-09-28 09:35 648★线程的执行环境 线程ID、栈 一组寄存器值 调度优先级和策 ... -
Chapter 10__信号
2010-09-27 14:06 722SIGHUP解说,有关终端和 ... -
Chapter 9__进程关系
2010-09-27 12:06 723------------------------------ ... -
Chapter 8__进程控制
2010-09-19 13:58 696//一些函数: pid_t getpid(void); ...
相关推荐
Chapter 6 通用IO模块:语音播放系统设计.rar Freescale系列单片机常用模块与综合系统设计实例精讲CD光盘\素材文件
Freescale系列单片机常用模块与综合系统设计实例精讲CD光盘\素材文件
示例描述:本章学习使用VC6进行文件IO开发的技巧。 01_BinaryView 用基本API编写二进制编辑器。 02_MyCompressor 用MFC类编写文件压缩软件。 03_DirMonitor 监控硬盘上文件的变化。 04_HddSpace 获取本机...
https://www.lectserve.com/date/yyyy-mm-dd 音频文件路径https://dbt.io/audio/path?key=<access>&dam_id=ENGESVN2DA&book_id=John&chapter_id=1&v=2 获取John 1 MP3文件的相对路径。诗句时间码列表...
Transpect.github.ioHTML页面是使用基于XSLT / XProc的脚本从存储内容的原始DocBook文件中自动生成的。 DocBook XML被拆分为多个块,然后转换为HTML。 每个HTML块都插入到HTML模板中,该模板使用Materialize CSS...
本文实例讲述了C#使用文件流读取文件的方法。分享给大家供大家参考。具体如下: using System; using System.IO; namespace Client.Chapter_11___File_and_Streams { public class OpenExistingFile { static ...
课程内容:1.非阻塞IO 如何将阻塞的读写设置为非阻塞的读写。2.文件锁 1)使用fcntl函数实现 2)使用flock函数实现3.多路IO select方式,poll方式。 4.异步IO5.存储映射
using System.IO; using iTextSharp.text; using iTextSharp.text.pdf; public class Chap0101 { public static void Main() { Console.WriteLine("Chapter 1 example 1: Hello World"); // step 1: ...
杰基尔主题留声机 欢迎使用您的新Jekyll主题!...* layout: chapter 带红色*的版式依赖于jekyll书籍生成器插件: 安装 将此行添加到您的Jekyll网站的Gemfile : gem "jekyll-theme-persephone" 并将此行
让我们听听乔说的 欢迎使用您的新Jekyll主题!...* layout: chapter演示 带红色*的版式依赖于jekyll书籍生成器插件: jekyll-books 安装 将此行添加到您的Jekyll网站的Gemfile : gem "jekyll-them
$ hugo new --kind chapter {{ * .md_FILE_REL_PATH_ABOUT_/content/}} 设置草稿:.Page.Params中为true时,可以通过hugo serve -D以草稿状态查看为开发(草稿)编写的文章。 部署自动化 在branch:master写一个...
{3}常用类}{67}{chapter.3} {3.1}Object类}{67}{section.3.1} {3.1.1}\ttfamily toString}{67}{subsection.3.1.1} {3.1.2}\ttfamily equals}{67}{subsection.3.1.2} {3.1.3}\ttfamily hashCode}{68}{subsection...
//3.通过虚拟目录获取文件资源 VirtualFile testFile = home.getChild("test.txt"); ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); Resource[] resources = resolver....
它包含从头到尾完成本书所必需的所有支持项目文件。 ##说明和导航所有代码都组织在文件夹中。 每个文件夹均以数字开头,后跟应用程序名称。 例如,Chapter02。 该代码将如下所示: <?php \Magento\Framework\...
如果您想了解更多有关Quarkus的信息,请访问其网站: ://quarkus.io/。 在开发人员模式下运行应用程序 在Ubuntu上必须安装 sudo apt-get install build-essential sudo sudo apt-get install zlib1g-dev 您可以在...
ii Chapter: Contents 转换. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 练习. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...