Squash commits for public release

This commit is contained in:
2025-02-12 09:54:05 -05:00
commit 7118adc514
1108 changed files with 80873 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
#ifndef _KERNEL_IO_TTY_PTMX_H
#define _KERNEL_IO_TTY_PTMX_H
int ptmx_install();
#endif

View File

@@ -0,0 +1,23 @@
#ifndef _KERNEL_IO_TTY_PTY_MASTER_H
#define _KERNEL_IO_TTY_PTY_MASTER_H
#include <algo/sync_ringbuffer.h>
#include <fs/vfs.h>
#ifndef PTYS_COUNT
#define PTYS_COUNT 16
#endif
struct pty_slave_entry;
struct pty_master_entry {
sync_ringbuffer_t buffer;
struct pty_slave_entry* pts;
dentry_t dentry;
};
typedef struct pty_master_entry pty_master_entry_t;
extern pty_master_entry_t pty_masters[PTYS_COUNT];
int pty_master_alloc(file_descriptor_t* fd);
#endif

View File

@@ -0,0 +1,24 @@
#ifndef _KERNEL_IO_TTY_PTY_SLAVE_H
#define _KERNEL_IO_TTY_PTY_SLAVE_H
#include <algo/sync_ringbuffer.h>
#include <io/tty/tty.h>
#ifndef PTYS_COUNT
#define PTYS_COUNT 4
#endif
struct pty_master_entry;
struct pty_slave_entry {
int inode_indx;
struct pty_master_entry* ptm;
tty_entry_t tty;
};
typedef struct pty_slave_entry pty_slave_entry_t;
extern pty_slave_entry_t pty_slaves[PTYS_COUNT];
int pty_slave_create(int id, struct pty_master_entry* ptm);
#endif

View File

@@ -0,0 +1,88 @@
#ifndef _KERNEL_IO_TTY_TTY_H
#define _KERNEL_IO_TTY_TTY_H
#include <algo/sync_ringbuffer.h>
#include <fs/vfs.h>
#include <libkern/types.h>
#define TTY_MAX_COUNT 8
#define TTY_BUFFER_SIZE 1024
typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;
#define NCCS 32
struct termios {
tcflag_t c_iflag; // input mode flags
tcflag_t c_oflag; // output mode flags
tcflag_t c_cflag; // control mode flags
tcflag_t c_lflag; // local mode flags
cc_t c_cc[NCCS]; // control characters
};
typedef struct termios termios_t;
/* c_cc characters */
#define VINTR 0
#define VQUIT 1
#define VERASE 2
#define VKILL 3
#define VEOF 4
#define VTIME 5
#define VMIN 6
#define VSWTC 7
#define VSTART 8
#define VSTOP 9
#define VSUSP 10
#define VEOL 11
#define VREPRINT 12
#define VDISCARD 13
#define VWERASE 14
#define VLNEXT 15
#define VEOL2 16
/* c_lflag bits */
#define ISIG 0000001
#define ICANON 0000002
#define ECHO 0000010
#define ECHOE 0000020
#define ECHOK 0000040
#define ECHONL 0000100
#define NOFLSH 0000200
#define TOSTOP 0000400
#define IEXTEN 0100000
/* tcflow() and TCXONC use these */
#define TCOOFF 0
#define TCOON 1
#define TCIOFF 2
#define TCION 3
/* tcflush() and TCFLSH use these */
#define TCIFLUSH 0
#define TCOFLUSH 1
#define TCIOFLUSH 2
/* tcsetattr uses these */
#define TCSANOW 0
#define TCSADRAIN 1
#define TCSAFLUSH 2
struct tty_entry {
sync_ringbuffer_t buffer;
int line_count;
gid_t pgid;
termios_t termios;
};
typedef struct tty_entry tty_entry_t;
int tty_init(tty_entry_t* tty);
int tty_clear(tty_entry_t* tty);
bool tty_can_read(tty_entry_t* tty, file_t* file, size_t start);
int tty_read(tty_entry_t* tty, file_t* file, void __user* buf, size_t start, size_t len);
bool tty_can_write(tty_entry_t* tty, file_t* file, size_t start);
int tty_write(tty_entry_t* tty, file_t* file, void __user* buf, size_t start, size_t len);
int tty_ioctl(tty_entry_t* tty, file_t* file, uintptr_t cmd, uintptr_t arg);
#endif // _KERNEL_IO_TTY_TTY_H

View File

@@ -0,0 +1,23 @@
#ifndef _KERNEL_IO_TTY_VCONSOLE_H
#define _KERNEL_IO_TTY_VCONSOLE_H
#include <algo/sync_ringbuffer.h>
#include <io/tty/tty.h>
#include <libkern/types.h>
#define VCONSOLE_MAX_COUNT 8
#define VCONSOLE_BUFFER_SIZE 1024
struct vconsole_entry {
int id;
int inode_indx;
tty_entry_t tty;
};
typedef struct vconsole_entry vconsole_entry_t;
extern vconsole_entry_t vconsoles[VCONSOLE_MAX_COUNT];
vconsole_entry_t* vconsole_new();
void vconsole_eat_key(int key);
#endif // _KERNEL_IO_TTY_TTY_H