1.簡單實現 「ls」。
#include
opendir()
readdir ()
closedir()
2.將標準輸入複製到標準輸出
#include
n=read(stdin_fileno,buf,4096)
write(stdout_fileno,buf,n)
3.執行時限制
#include
long sysconf(int name);
long pathconf(const char *pathname,int name);
long fpathconf(int filedes,int name);
4.獲取當前工作目錄
getcwd(char *buffer, int maxlen);
5.errno 記錄系統的最後一次錯誤**。**是乙個int型的值,在errno.h中定義
6.允許原子性操作擴充套件函式:pread() , pwrite();
UNIX環境高階程式設計 第2版 pdf格式
unix環境高階程式設計 第2版 本書描述unix系統的程式設計介面 系統呼叫介面和標準c庫提供的很多函式。本 書針對的是所有的程式設計師。與大多數作業系統一樣,unix為程式執行提供了大量的服務 開啟檔案,讀檔案,啟 動乙個新程式,分配儲存區以廈獲得當前時間等。這些服務被稱為系統呼叫介面 syst...
《unix環境高階程式設計》筆記2
第四章 檔案和目錄 本章將描述檔案系統特徵和檔案性質 1 stat fstat和lstat函式 原型 include int stat const char restrict pathname,struct stat restrict buf int fstat int filedes,struct...
unix環境高階程式設計 訊號(2)
函式kill和raise kill函式將訊號傳送給程序或程序組,raise函式則執行程序向自身傳送訊號。kill的pid引數有以下四種不同情況 pid 0,將該訊號傳送給程序id為pid的程序 pid 0,將該訊號傳送給與傳送程序屬於同一程序組的所有程序。pid 0 將該訊號傳送給程序組id等於pi...