Tom Seddon Tom Seddon - 1 year ago 57
C Question

F_SEAL_SEAL undeclared, even when headers are included

I'm trying to use file sealing on Linux. Here's an example C program.

#define _GNU_SOURCE
#include <unistd.h>
#include <fcntl.h>

int main(void) {

You can build it using
gcc -Wall -o ./linux_file_sealing linux_file_sealing.c
or similar.

When I build it, I get an error about

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)
linux_file_sealing.c:7:19: note: each undeclared identifier is reported only once for each function it appears in

I'm including
, as per the man page... so what else should I be doing, and where is that described?

(The man pages just say that sealing is "Linux-specific", but give no further details. This is the reason for including the
define, which is how you get the other Linux-specific stuff, but for
it seems to make no difference.)

(Ubuntu 16.04 LTS, Linux 4.4.0-36)

Answer Source

You want

#include <linux/fcntl.h>

instead of

#include <fcntl.h>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download