我試圖在Linux上使用文件密封。這裏有一個C程序的例子。F_SEAL_SEAL未聲明,即使包含標題
#define _GNU_SOURCE
#include <unistd.h>
#include <fcntl.h>
int main(void) {
(void)F_SEAL_SEAL;
}
您可以使用gcc -Wall -o ./linux_file_sealing linux_file_sealing.c
或類似方式構建它。
當我建立它時,我得到一個關於F_SEAL_SEAL
的錯誤。
gcc -Wall -o ./linux_file_sealing linux_file_sealing.c
linux_file_sealing.c: In function ‘main’:
linux_file_sealing.c:7:19: error: ‘F_SEAL_SEAL’ undeclared (first use in this function)
printf("%d\n",F_SEAL_SEAL);
^
linux_file_sealing.c:7:19: note: each undeclared identifier is reported only once for each function it appears in
我包括unistd.h
和fcntl.h
,按照該男子頁...所以還有什麼我應該做的,而其中所描述? (這個手冊頁只是說密封是「特定於Linux」的,但沒有提供進一步的細節,這就是包含GNU_SOURCE
的定義的原因,這是你如何獲得其他Linux特定的東西,但是對於F_SEAL_SEAL
它似乎沒有什麼區別。)
(Ubuntu的LTS 16.04,Linux的4.4.0-36)
您指的是哪個手冊頁? – alk
我從'man fcntl'中得到的那個。看起來是這樣的:http://man7.org/linux/man-pages/man2/fcntl.2.html - 但我沒有檢查每個字符! –
我爲此提出了一個手冊頁錯誤:https://bugzilla.kernel.org/show_bug.cgi?id=156231 –