Unified constants from sortix/filesystem.h and <fcntl.h> in <sortix/fcntl.h>.

This commit is contained in:
Jonas 'Sortie' Termansen 2012-02-23 13:15:40 +01:00
parent 03273d0076
commit 5de83df6ec
3 changed files with 51 additions and 42 deletions

View File

@ -28,6 +28,8 @@
#define _FCNTL_H 1
#include <features.h>
#include <sortix/fcntl.h>
#include <sys/stat.h>
__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 <sys/stat.h>
/* TODO: AT_FDCWD missing here */
/* TODO: AT_EACCESS missing here */
/* TODO: AT_SYMLINK_NOFOLLOW missing here */

48
sortix/fcntl.h Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
fcntl.h
Declares various constants related to opening files.
*******************************************************************************/
#ifndef SORTIX_FCNTL_H
#define SORTIX_FCNTL_H
#include <features.h>
__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

View File

@ -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: