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系統程式設計 第二版
268
|
第八章
程必須對相應的檔案具有寫入的權限。你只能對正規檔案(而非符號連結或裝置
檔)進行
user
命名空間中之延伸屬性的賦值。如果要設計一個使用延伸屬性的用戶
空間應用程式,這可能會是你想要使用的命名空間。
延伸屬性的操作
POSIX 定義了四項操作,讓應用程式得以用於處理特定檔案的延伸屬性:
指定一個檔案,傳回檔案之延伸屬性的所有鍵。
指定一個檔案以及一個鍵,傳回相對應的值。
指定一個檔案、一個鍵以及一個值,把值指定給鍵。
指定一個檔案以及一個鍵,從檔案移除該延伸屬性。
POSIX 又分別替每項操作提供了 3 類系統呼叫
一類系統呼叫用於操作所指定的路徑名稱,而且如果該路徑參用到一個符號連結,
則操作該連結的目標檔案(標準行為)。
一類系統呼叫用於操作所指定的路徑名稱,而且如果該路徑參用到一個符號連結,
則操作該連結本身(此類系統呼叫的名稱會前綴
l
字母)。
一類系統呼叫用於操作檔案描述器(此類系統呼叫的名稱會前綴
f
字母)。
接下來說明這 12 種組合。
取得一個延伸屬性
最簡單的操作就是從一個檔案傳回特定延伸屬性(所指定的鍵)的值:
#include <sys/types.h>
#include <attr/xattr.h>
ssize_t getxattr (const char *path, const char *key,
void *value, size_t size);
ssize_t lgetxattr (const char *path, const ...
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

深入理解運算原理|從簡單的機器到無所不能的程式

深入理解運算原理|從簡單的機器到無所不能的程式

Tom Stuart
管理Kubernetes

管理Kubernetes

Brendan Burns, Craig Tracey
算法技术手册(原书第2 版)

算法技术手册(原书第2 版)

George T.Heineman, Gary Pollice, Stanley Selkow

Publisher Resources

ISBN: 9789862769812