The kernel now checks owner/group/other on open, create, unlink, rename, exec and path search; honours set-user-id and set-group-id; restricts kill, mount, reboot and mknod; keeps supplementary groups; and implements chown. devtmpfs nodes carry owners and modes that chmod/chown keep. Terminals run login, the image has root and schos, X starts as the ordinary user. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EVRhxi9zpdW2uDUN4FVcao
42 lines
1.5 KiB
C
42 lines
1.5 KiB
C
#pragma once
|
|
|
|
// Pseudo-terminals, Unix98 style: open /dev/ptmx and get the master side of a
|
|
// new pair; the slave is /dev/pts/N. What sits between the two is the same
|
|
// line discipline a console has. See kernel/dev/pty.c.
|
|
|
|
#include "core/types.h"
|
|
|
|
#define PTMX_MAJOR 13 // /dev/ptmx: opening it allocates a pair
|
|
#define PTM_MAJOR 14 // a master, minor = pair number; never in a listing
|
|
#define PTS_MAJOR 15 // /dev/pts/N
|
|
#define NPTY 32
|
|
|
|
// A controlling terminal that is a pty, in proc->ctty: PTY_CTTY + N. The
|
|
// console's are 1..NVT.
|
|
#define PTY_CTTY 64
|
|
|
|
struct inode;
|
|
struct file;
|
|
|
|
int pty_alloc(void); // the new pair's number, or -1
|
|
int pty_used(int n);
|
|
int pty_ioctl(struct inode *ip, uint request, addr_t arg);
|
|
int pty_poll(struct inode *ip, int events, int readable, int writable);
|
|
struct inode *ptmx_open(struct inode *ip); // ip locked; returns the master, locked
|
|
void pty_init(void);
|
|
|
|
// Lines the devsw table needs.
|
|
int ptm_read(struct inode*, uint64, char*, int);
|
|
int ptm_write(struct inode*, uint64, char*, int);
|
|
int ptm_ready(struct inode*);
|
|
void ptm_open(struct inode*);
|
|
void ptm_close(struct inode*);
|
|
int pts_read(struct inode*, uint64, char*, int);
|
|
int pts_write(struct inode*, uint64, char*, int);
|
|
int pts_ready(struct inode*);
|
|
void pts_open(struct inode*);
|
|
void pts_close(struct inode*);
|
|
|
|
// From kernel/fs/devfs.c: the inode of master N.
|
|
struct inode *devfs_pty_master(int n);
|
|
void devfs_pty_claim(int n, uint uid);
|