Include sys/types and sys/stat to fix undeclared file mode flags