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系統程式設計 第二版
288
|
第八章
unsigned int count);
int getdents (unsigned int fd,
struct dirent *dirp,
unsigned int count);
你不會想要使用這兩個系統呼叫!因為不好使用,而且不具移植性。事實上。用戶空間
應用程式應該使用 C 程式庫的
opendir()
readdir()
以及
closedir()
系統呼叫。
連結
前面在討論目錄的時候有提到,每個「名稱至 inode」的映射(mapping)稱為一個
連結
link
)。另一個簡單的定義—連結基本上就是一份清單(一個目錄)中指向特定 inode
的一個名稱—說明了何以會有多個連結指向相同的 inode。也就是,單一 inode (因此是
單一檔案)可以被,例如,
/etc/customs
/var/run/ledger
所參照。
事實上,此狀況下,會有一個問題:因為連結會映射至 inode,而 inode 編號專屬於特定
的檔案系統,所以
/etc/customs
/var/run/ledger
必須位於相同的檔案系統。在單一檔案
系統中,可能會有大量的連結指向任何特定的檔案。唯一的限制是用於保存「連結之數
量」的整數資料型別的大小。這些連結中,沒有一個連結是“最初的”或“第一個”連
結。所有這些連結均共享同樣的狀態:指向同一個檔案。
我們稱這些連結的型態為
硬連結
hard link
)。檔案可能具有零、一或多個連結。多數
檔案都會具有值為 1 的「連結計數」(link count)—也就是 ...
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