The Pedigree Project  0.1
FileDescriptor.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef POSIX_FILEDESCRIPTOR_H
21 #define POSIX_FILEDESCRIPTOR_H
22 
23 #include "pedigree/kernel/compiler.h"
24 #include "pedigree/kernel/processor/types.h"
25 #include "pedigree/kernel/utilities/SharedPointer.h"
26 #include "pedigree/kernel/utilities/String.h"
27 
28 class File;
29 class LockedFile;
30 class UnixSocket;
31 class IoEvent;
32 
37 {
38  public:
41 
44  File *newFile, uint64_t newOffset = 0, size_t newFd = 0xFFFFFFFF,
45  int fdFlags = 0, int flFlags = 0, LockedFile *lf = 0);
46 
49 
52 
54  FileDescriptor &operator=(FileDescriptor &desc);
55 
57  virtual ~FileDescriptor();
58 
60  void setFlags(int newFlags);
61 
63  void addFlag(int newFlag);
64 
66  int getFlags() const;
67 
69  void setStatusFlags(int newFlags);
70 
72  void addStatusFlag(int newFlag);
73 
75  int getStatusFlags() const;
76 
79 
81  uint64_t offset;
82 
84  size_t fd;
85 
88 
91 
94 
95  public:
96  int fdflags;
98 
100  int flflags;
101 };
102 
103 #endif
uint64_t offset
Offset within the file for I/O.
LockedFile * lockedFile
Locked file, non-zero if there is an advisory lock on the file.
SharedPointer< class NetworkSyscalls > networkImpl
Network syscall implementation for this descriptor (if it&#39;s a socket).
size_t fd
Descriptor number.
File * file
Our open file pointer.
int flflags
File status flags (fcntl)
IoEvent * ioevent
IO event for reporting changes to files.
Definition: File.h:66