23 #include "ConsoleDefines.h" 24 #include "modules/system/vfs/File.h" 25 #include "modules/system/vfs/Filesystem.h" 26 #include "pedigree/kernel/Spinlock.h" 27 #include "pedigree/kernel/compiler.h" 28 #include "pedigree/kernel/process/Mutex.h" 29 #include "pedigree/kernel/processor/types.h" 30 #include "pedigree/kernel/utilities/Buffer.h" 31 #include "pedigree/kernel/utilities/String.h" 32 #include "pedigree/kernel/utilities/Vector.h" 33 #include "pedigree/kernel/utilities/utility.h" 40 #define DEFAULT_FLAGS \ 41 (ConsoleManager::OPostProcess | ConsoleManager::IMapCRToNL | \ 42 ConsoleManager::OMapNLToCRNL | ConsoleManager::LEcho | \ 43 ConsoleManager::LEchoErase | ConsoleManager::LEchoKill | \ 44 ConsoleManager::LCookedMode | ConsoleManager::LGenerateEvent) 58 virtual bool isMaster() = 0;
60 void setEvent(
Event *e)
80 Event *getEvent()
const 88 MemoryCopy(out, m_ControlChars, MAX_CONTROL_CHAR);
93 return PTY_BUFFER_SIZE;
96 size_t getConsoleNumber()
const 98 return m_ConsoleNumber;
101 virtual size_t getPhysicalConsoleNumber()
const 121 virtual int select(
bool bWriting,
int timeout);
124 void inject(
char *buf,
size_t len,
bool canBlock);
128 virtual void performInject(
char *buf,
size_t len,
bool canBlock);
138 char m_ControlChars[MAX_CONTROL_CHAR];
140 unsigned short m_Rows;
141 unsigned short m_Cols;
152 char *buf,
size_t len,
size_t flags = ~0U,
153 const char *controlChars = 0);
170 size_t m_ConsoleNumber;
184 bool checkForEvent(
size_t flags,
char check,
const char *controlChars);
205 uint64_t location, uint64_t size, uintptr_t buffer,
206 bool bCanBlock =
true);
208 uint64_t location, uint64_t size, uintptr_t buffer,
209 bool bCanBlock =
true);
214 m_Flags = pOther->m_Flags;
224 virtual bool isMaster()
241 uint64_t location, uint64_t size, uintptr_t buffer,
242 bool bCanBlock =
true);
244 uint64_t location, uint64_t size, uintptr_t buffer,
245 bool bCanBlock =
true);
252 virtual bool isMaster()
273 uint64_t location, uint64_t size, uintptr_t buffer,
274 bool bCanBlock =
true);
276 uint64_t location, uint64_t size, uintptr_t buffer,
277 bool bCanBlock =
true);
279 virtual bool isMaster()
290 virtual size_t getPhysicalConsoleNumber()
const 292 return m_TerminalNumber;
295 virtual int select(
bool bWriting,
int timeout);
300 size_t m_TerminalNumber;
302 virtual void performInject(
char *buf,
size_t len,
bool canBlock);
324 IStripToSevenBits = 8
341 LGenerateEvent = 16384
358 bool lockConsole(
File *file);
361 void unlockConsole(
File *file);
365 void newConsole(
char c,
size_t i);
367 bool isConsole(
File *file);
368 bool isMasterConsole(
File *file);
370 void setAttributes(
File *file,
size_t flags);
371 void getAttributes(
File *file,
size_t *flags);
372 void getControlChars(
File *file,
void *p);
373 void setControlChars(
File *file,
void *p);
374 int getWindowSize(
File *file,
unsigned short *rows,
unsigned short *cols);
375 int setWindowSize(
File *file,
unsigned short rows,
unsigned short cols);
376 bool hasDataAvailable(
File *file);
377 void flush(
File *file);
395 return String(
"consolemanager");
423 void newConsole(
char c,
size_t i,
bool lock);
size_t m_LineBufferSize
Size of the input line buffer.
static size_t outputLineDiscipline(char *buf, size_t len, size_t maxSz, size_t flags=0)
Output line discipline.
virtual File * getRoot() const
virtual bool isBytewise() const
virtual void eventComplete()
virtual uint64_t readBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
size_t m_LineBufferFirstNewline
Location of the first newline in the line buffer. ~0 if none.
virtual bool createDirectory(File *parent, const String &filename, uint32_t mask)
size_t processInput(char *buf, size_t len)
Input processing.
bool checkForEvent(size_t flags, char check, const char *controlChars)
Check if the given character requires an event.
ConsoleFile * m_pOther
Other side of the console.
virtual void performEventTrigger(char cause)
virtual bool initialise(Disk *pDisk)
virtual bool createFile(File *parent, const String &filename, uint32_t mask)
virtual int select(bool bWriting, int timeout)
select - check and optionally for a particular state.
void inputLineDiscipline(char *buf, size_t len, size_t flags=~0U, const char *controlChars=0)
Input line discipline.
void inject(char *buf, size_t len, bool canBlock)
inject - inject bytes into the ring buffer
char m_Last
Character that triggered an event.
void getControlCharacters(char *out)
Grabs the current array of control characters.
virtual size_t getBlockSize() const
void triggerEvent(char cause)
Triggers our event.
bool bLocked
Is this master locked (ie, already opened)?
virtual void performInject(char *buf, size_t len, bool canBlock)
virtual uint64_t writeBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
Mutex m_EventTrigger
Locked when we trigger an event, unlocked when eventComplete called.
virtual bool createSymlink(File *parent, const String &filename, const String &value)
virtual String getVolumeLabel() const
char m_LineBuffer[LINEBUFFER_MAXIMUM]
Input line buffer.