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系統程式設計 第二版
檔案與目錄的管理
|
311
EBADF
fd
不是一個有效的 inotify 實例。
EINVAL
在所指定的 inotify 實例上
wd
不是一個有效的檢視描述器。
移除一個檢視項目時,核心會產生
IN_IGNORED
事件。核心不僅會在手動移除期間送出
此事件,而且會因為另一種操作的副作用而銷毀檢視項目。舉例來說,當所檢視的一個
檔案被刪除時,此檔案上的任何檢視項目均會被移除。以上兩種狀況下,核心都會送出
IN_IGNORED
。此行為讓應用程式得以固定在一處進行移除檢視項目的處理:
IN_IGNORED
事件處理程序(event handler)。這對 inotify 的進階消費者(需要管理每個 inotify 檢視
項目背後複雜的資料結構,例如 GNOME Beagle 搜尋基礎設施)而言非常有用。
取得事件佇列的大小
未決事件佇列(pending event queue)的大小可經由 inotify 實例之檔案描述器上的
FIONREAD
ioctl 要求」來取得。此要求的第一個引數用於接收佇列的大小(以位元組為
單位),這是一個無號整數。
unsigned int queue_len;
int ret;
ret = ioctl (fd, FIONREAD, &queue_len);
if (ret < 0)
perror ("ioctl");
else
printf ("%u bytes pending in queue\n", queue_len);
請注意,此要求所傳回的是佇列的大小(以位元組為單位) ...
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