diff --git a/libmaxsi/include/fcntl.h b/libmaxsi/include/fcntl.h index 7b05caf0..b9519d59 100644 --- a/libmaxsi/include/fcntl.h +++ b/libmaxsi/include/fcntl.h @@ -28,6 +28,8 @@ #define _FCNTL_H 1 #include +#include +#include __BEGIN_DECLS @@ -41,27 +43,6 @@ __BEGIN_DECLS @include(SEEK_CUR.h) @include(SEEK_END.h) -/* TODO: Keep these aligned with those in the Sortix kernel */ -#define O_RDONLY 1 -#define O_WRONLY 2 -#define O_RDWR 3 -#define O_EXEC 4 -#define O_SEARCH 5 -#define O_APPEND (1<<3) -#define O_CLOEXEC (1<<4) -#define O_CREAT (1<<5) -#define O_DIRECTORY (1<<6) -#define O_DSYNC (1<<6) -#define O_EXCL (1<<7) -#define O_NOCTTY (1<<8) -#define O_NOFOLLOW (1<<9) -#define O_RSYNC (1<<11) -#define O_SYNC (1<<12) -#define O_TRUNC (1<<13) -#define O_TTY_INIT (1<<13) - -#include - /* TODO: AT_FDCWD missing here */ /* TODO: AT_EACCESS missing here */ /* TODO: AT_SYMLINK_NOFOLLOW missing here */ diff --git a/sortix/fcntl.h b/sortix/fcntl.h new file mode 100644 index 00000000..56d798e6 --- /dev/null +++ b/sortix/fcntl.h @@ -0,0 +1,48 @@ +/******************************************************************************* + + COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2012. + + This file is part of Sortix. + + Sortix is free software: you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your option) any later + version. + + Sortix is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + details. + + You should have received a copy of the GNU General Public License along with + Sortix. If not, see . + + fcntl.h + Declares various constants related to opening files. + +*******************************************************************************/ + +#ifndef SORTIX_FCNTL_H +#define SORTIX_FCNTL_H + +#include + +__BEGIN_DECLS + +#define O_RDONLY 1 +#define O_WRONLY 2 +#define O_RDWR 3 +#define O_EXEC 4 +#define O_SEARCH 5 +#define O_LOWERFLAGS 0x7 +#define O_APPEND (1<<3) +#define O_CLOEXEC (1<<4) +#define O_CREAT (1<<5) +#define O_DIRECTORY (1<<6) +#define O_EXCL (1<<7) +#define O_TRUNC (1<<8) + +__END_DECLS + +#endif + diff --git a/sortix/filesystem.h b/sortix/filesystem.h index e4a4a8a8..2357ec53 100644 --- a/sortix/filesystem.h +++ b/sortix/filesystem.h @@ -27,30 +27,10 @@ #include "device.h" #include "stream.h" +#include "fcntl.h" namespace Sortix { - // TODO: These belong in libmaxsi! - // TODO: Sortix might never support all of these flags if they are stupid. - const int O_RDONLY = 1; - const int O_WRONLY = 2; - const int O_RDWR = 3; - const int O_EXEC = 4; - const int O_SEARCH = 5; - const int O_LOWERFLAGS = 0x7; - const int O_APPEND = (1<<3); - const int O_CLOEXEC = (1<<4); - const int O_CREAT = (1<<5); - const int O_DIRECTORY = (1<<6); - const int O_DSYNC = (1<<6); - const int O_EXCL = (1<<7); - const int O_NOCTTY = (1<<8); - const int O_NOFOLLOW = (1<<9); - const int O_RSYNC = (1<<11); - const int O_SYNC = (1<<12); - const int O_TRUNC = (1<<13); - const int O_TTY_INIT = (1<<13); - class DevFileSystem : public Device { public: