Skip to Content
LINUX系統程式設計 第二版
book

LINUX系統程式設計 第二版

by Robert Love
December 2013
Intermediate to advanced
496 pages
8h 57m
Chinese
GoTop Information, Inc.
Content preview from LINUX系統程式設計 第二版
進階檔案 I/O
|
131
EINVAL
指定了無效的建議,或所指定的檔案描述器參用了一個導管(pipe),或所指定建議
無法應用至所指定的檔案。
readahead() 系統呼叫
posix_fadvise()
系統呼叫是 2.6 版的 Linux 核心新引進的。在此之前,
readahead()
統呼叫可用於提供與
POSIX_FADV_WILLNEED
建議一致的行為。與
posix_fadvise()
不同的
是,
readahead()
Linux 特有的介面:
#define _GNU_SOURCE
#include <fcntl.h>
ssize_t readahead (int fd,
off64_t offset,
size_t count);
叫用
readahead()
可以把檔案描述器
fd
[offset,offset+count)
範圍的資料填入頁面快
取區。
傳回值與錯誤碼
執行成功時,
readahead()
會傳回
0
。執行失敗時,則會傳回
-1
並把
errno
設定成下面其
中一個值:
EBADF
指定了無效的檔案描述器,或檔案描述器並未開啟以備讀取。
EINVAL
所指定的檔案描述器並未映射至一個支援先讀功能的檔案。
建議是廉價的
有些常見的應用程式工作量,可輕易得利於「對核心的善意建議」。此類建議對 I/O
荷的減輕有很大的幫助。由於硬碟速度如此之慢,而現代的處理器如此之快,每一個小
協助與好建議都會有莫大的幫助。
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

優雅的SciPy|Python科學研究的美學

優雅的SciPy|Python科學研究的美學

Juan Nunez-Iglesias, Stéfan van der Walt, Harriet Dashnow
C++语言导学(原书第2版)

C++语言导学(原书第2版)

本贾尼 斯特劳斯特鲁普

Publisher Resources

ISBN: 9789862769812