#include #include int main() { int fd = open("testfile", O_RDONLY); if (fd == -1) { perror("open"); return 1; } int flags = fcntl(fd, F_GETFD); if (flags == -1) { perror("fcntl"); return 1; } if (flags & FD_CLOEXEC) { printf("O_CLOEXEC is supported.\n"); } else { printf("O_CLOEXEC is not supported.\n"); } close(fd); return 0; }