Initial revision
This commit is contained in:
40
include/sys/asynchio.h
Executable file
40
include/sys/asynchio.h
Executable file
@@ -0,0 +1,40 @@
|
||||
/* asynchio.h - Asynchronous I/O Author: Kees J. Bot
|
||||
* 26 Jan 1995
|
||||
* This is just a fake async I/O library to be used for programs
|
||||
* written for Minix-vmd that must also run under standard Minix.
|
||||
* This limits the number of ugly #ifdefs somewhat. The programs must
|
||||
* be restricted to performing just one service, of course.
|
||||
*/
|
||||
#ifndef _SYS__ASYNCHIO_H
|
||||
#define _SYS__ASYNCHIO_H
|
||||
|
||||
#ifndef _ANSI_H
|
||||
#include <ansi.h>
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
char state;
|
||||
char op;
|
||||
char fd;
|
||||
char req;
|
||||
void *data;
|
||||
ssize_t count;
|
||||
int errno;
|
||||
} asynchio_t;
|
||||
|
||||
#define ASYN_NONBLOCK 0x01
|
||||
|
||||
struct timeval { long tv_sec, tv_usec; };
|
||||
|
||||
#define EINPROGRESS EINTR
|
||||
#define ASYN_INPROGRESS EINPROGRESS
|
||||
|
||||
void asyn_init(asynchio_t *_asyn);
|
||||
ssize_t asyn_read(asynchio_t *_asyn, int _fd, void *_buf, size_t _len);
|
||||
ssize_t asyn_write(asynchio_t *_asyn, int _fd, const void *_buf, size_t _len);
|
||||
int asyn_ioctl(asynchio_t *_asyn, int _fd, unsigned long _request, void *_data);
|
||||
int asyn_wait(asynchio_t *_asyn, int _flags, struct timeval *to);
|
||||
int asyn_synch(asynchio_t *_asyn, int _fd);
|
||||
int asyn_close(asynchio_t *_asyn, int _fd);
|
||||
|
||||
#endif /* _SYS__ASYNCHIO_H */
|
||||
19
include/sys/dir.h
Executable file
19
include/sys/dir.h
Executable file
@@ -0,0 +1,19 @@
|
||||
/* The <dir.h> header gives the layout of a directory. */
|
||||
|
||||
#ifndef _DIR_H
|
||||
#define _DIR_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define DIRBLKSIZ 512 /* size of directory block */
|
||||
|
||||
#ifndef DIRSIZ
|
||||
#define DIRSIZ 60
|
||||
#endif
|
||||
|
||||
struct direct {
|
||||
ino_t d_ino;
|
||||
char d_name[DIRSIZ];
|
||||
};
|
||||
|
||||
#endif /* _DIR_H */
|
||||
15
include/sys/ioc_disk.h
Executable file
15
include/sys/ioc_disk.h
Executable file
@@ -0,0 +1,15 @@
|
||||
/* sys/ioc_disk.h - Disk ioctl() command codes. Author: Kees J. Bot
|
||||
* 23 Nov 2002
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _S_I_DISK_H
|
||||
#define _S_I_DISK_H
|
||||
|
||||
#include <minix/ioctl.h>
|
||||
|
||||
#define DIOCSETP _IOW('d', 3, struct partition)
|
||||
#define DIOCGETP _IOR('d', 4, struct partition)
|
||||
#define DIOCEJECT _IO ('d', 5)
|
||||
|
||||
#endif /* _S_I_DISK_H */
|
||||
19
include/sys/ioc_memory.h
Executable file
19
include/sys/ioc_memory.h
Executable file
@@ -0,0 +1,19 @@
|
||||
/* sys/ioc_memory.h - Memory ioctl() command codes.
|
||||
* Author: Kees J. Bot
|
||||
* 23 Nov 2002
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _S_I_MEMORY_H
|
||||
#define _S_I_MEMORY_H
|
||||
|
||||
#include <minix/ioctl.h>
|
||||
|
||||
#define MIOCRAMSIZE _IOW('m', 3, u32_t)
|
||||
#define MIOCSPSINFO _IOW('m', 4, void *)
|
||||
#define MIOCGPSINFO _IOR('m', 5, struct psinfo)
|
||||
#define MIOCINT86 _IORW('m', 6, struct mio_int86)
|
||||
#define MIOCGLDT86 _IORW('m', 7, struct mio_ldt86)
|
||||
#define MIOCSLDT86 _IOW('m', 8, struct mio_ldt86)
|
||||
|
||||
#endif /* _S_I_MEMORY_H */
|
||||
13
include/sys/ioc_scsi.h
Executable file
13
include/sys/ioc_scsi.h
Executable file
@@ -0,0 +1,13 @@
|
||||
/* sys/ioc_scsi.h - SCSI ioctl() command codes. Author: Kees J. Bot
|
||||
* 23 Nov 2002
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _S_I_SCSI_H
|
||||
#define _S_I_SCSI_H
|
||||
|
||||
#include <minix/ioctl.h>
|
||||
|
||||
#define SCIOCCMD _IOW('S', 1, struct scsicmd)
|
||||
|
||||
#endif /* _S_I_SCSI_H */
|
||||
30
include/sys/ioc_sound.h
Executable file
30
include/sys/ioc_sound.h
Executable file
@@ -0,0 +1,30 @@
|
||||
/* sys/ioc_sound.h - Sound ioctl() command codes. Author: Kees J. Bot
|
||||
* 23 Nov 2002
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _S_I_SOUND_H
|
||||
#define _S_I_SOUND_H
|
||||
|
||||
#include <minix/ioctl.h>
|
||||
|
||||
/* Soundcard DSP ioctls. */
|
||||
#define DSPIORATE _IOR('s', 1, unsigned int)
|
||||
#define DSPIOSTEREO _IOR('s', 2, unsigned int)
|
||||
#define DSPIOSIZE _IOR('s', 3, unsigned int)
|
||||
#define DSPIOBITS _IOR('s', 4, unsigned int)
|
||||
#define DSPIOSIGN _IOR('s', 5, unsigned int)
|
||||
#define DSPIOMAX _IOW('s', 6, unsigned int)
|
||||
#define DSPIORESET _IO ('s', 7)
|
||||
|
||||
/* Soundcard mixer ioctls. */
|
||||
#define MIXIOGETVOLUME _IORW('s', 10, struct volume_level)
|
||||
#define MIXIOGETINPUTLEFT _IORW('s', 11, struct inout_ctrl)
|
||||
#define MIXIOGETINPUTRIGHT _IORW('s', 12, struct inout_ctrl)
|
||||
#define MIXIOGETOUTPUT _IORW('s', 13, struct inout_ctrl)
|
||||
#define MIXIOSETVOLUME _IORW('s', 20, struct volume_level)
|
||||
#define MIXIOSETINPUTLEFT _IORW('s', 21, struct inout_ctrl)
|
||||
#define MIXIOSETINPUTRIGHT _IORW('s', 22, struct inout_ctrl)
|
||||
#define MIXIOSETOUTPUT _IORW('s', 23, struct inout_ctrl)
|
||||
|
||||
#endif /* _S_I_SOUND_H */
|
||||
15
include/sys/ioc_tape.h
Executable file
15
include/sys/ioc_tape.h
Executable file
@@ -0,0 +1,15 @@
|
||||
/* sys/ioc_tape.h - Magnetic Tape ioctl() command codes.
|
||||
* Author: Kees J. Bot
|
||||
* 23 Nov 2002
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _S_I_TAPE_H
|
||||
#define _S_I_TAPE_H
|
||||
|
||||
#include <minix/ioctl.h>
|
||||
|
||||
#define MTIOCTOP _IOW('M', 1, struct mtop)
|
||||
#define MTIOCGET _IOR('M', 2, struct mtget)
|
||||
|
||||
#endif /* _S_I_TAPE_H */
|
||||
36
include/sys/ioc_tty.h
Executable file
36
include/sys/ioc_tty.h
Executable file
@@ -0,0 +1,36 @@
|
||||
/* sys/ioc_tty.h - Terminal ioctl() command codes.
|
||||
* Author: Kees J. Bot
|
||||
* 23 Nov 2002
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _S_I_TTY_H
|
||||
#define _S_I_TTY_H
|
||||
|
||||
#include <minix/ioctl.h>
|
||||
|
||||
/* Terminal ioctls. */
|
||||
#define TCGETS _IOR('T', 8, struct termios) /* tcgetattr */
|
||||
#define TCSETS _IOW('T', 9, struct termios) /* tcsetattr, TCSANOW */
|
||||
#define TCSETSW _IOW('T', 10, struct termios) /* tcsetattr, TCSADRAIN */
|
||||
#define TCSETSF _IOW('T', 11, struct termios) /* tcsetattr, TCSAFLUSH */
|
||||
#define TCSBRK _IOW('T', 12, int) /* tcsendbreak */
|
||||
#define TCDRAIN _IO ('T', 13) /* tcdrain */
|
||||
#define TCFLOW _IOW('T', 14, int) /* tcflow */
|
||||
#define TCFLSH _IOW('T', 15, int) /* tcflush */
|
||||
#define TIOCGWINSZ _IOR('T', 16, struct winsize)
|
||||
#define TIOCSWINSZ _IOW('T', 17, struct winsize)
|
||||
#define TIOCGPGRP _IOW('T', 18, int)
|
||||
#define TIOCSPGRP _IOW('T', 19, int)
|
||||
#define TIOCSFON _IOW('T', 20, u8_t [8192])
|
||||
|
||||
/* Legacy <sgtty.h> */
|
||||
#define TIOCGETP _IOR('t', 1, struct sgttyb)
|
||||
#define TIOCSETP _IOW('t', 2, struct sgttyb)
|
||||
#define TIOCGETC _IOR('t', 3, struct tchars)
|
||||
#define TIOCSETC _IOW('t', 4, struct tchars)
|
||||
|
||||
/* Keyboard ioctls. */
|
||||
#define KIOCSMAP _IOW('k', 3, keymap_t)
|
||||
|
||||
#endif /* _S_I_TTY_H */
|
||||
24
include/sys/ioctl.h
Executable file
24
include/sys/ioctl.h
Executable file
@@ -0,0 +1,24 @@
|
||||
/* sys/ioctl.h - All ioctl() command codes. Author: Kees J. Bot
|
||||
* 23 Nov 2002
|
||||
*
|
||||
* This header file includes all other ioctl command code headers.
|
||||
*/
|
||||
|
||||
#ifndef _S_IOCTL_H
|
||||
#define _S_IOCTL_H
|
||||
|
||||
/* A driver that uses ioctls claims a character for its series of commands.
|
||||
* For instance: #define TCGETS _IOR('T', 8, struct termios)
|
||||
* This is a terminal ioctl that uses the character 'T'. The character(s)
|
||||
* used in each header file are shown in the comment following.
|
||||
*/
|
||||
|
||||
#include <sys/ioc_tty.h> /* 'T' 't' 'k' */
|
||||
#include <net/ioctl.h> /* 'n' */
|
||||
#include <sys/ioc_disk.h> /* 'd' */
|
||||
#include <sys/ioc_memory.h> /* 'm' */
|
||||
#include <sys/ioc_tape.h> /* 'M' */
|
||||
#include <sys/ioc_scsi.h> /* 'S' */
|
||||
#include <sys/ioc_sound.h> /* 's' */
|
||||
|
||||
#endif /* _S_IOCTL_H */
|
||||
45
include/sys/mtio.h
Executable file
45
include/sys/mtio.h
Executable file
@@ -0,0 +1,45 @@
|
||||
/* <sys/mtio.h> magnetic tape commands Author: Kees J. Bot
|
||||
*/
|
||||
|
||||
#ifndef _SYS__MTIO_H
|
||||
#define _SYS__MTIO_H
|
||||
|
||||
/* Tape operations: ioctl(fd, MTIOCTOP, &struct mtop) */
|
||||
|
||||
struct mtop {
|
||||
short mt_op; /* Operation (MTWEOF, etc.) */
|
||||
int mt_count; /* Repeat count. */
|
||||
};
|
||||
|
||||
#define MTWEOF 0 /* Write End-Of-File Marker */
|
||||
#define MTFSF 1 /* Forward Space File mark */
|
||||
#define MTBSF 2 /* Backward Space File mark */
|
||||
#define MTFSR 3 /* Forward Space Record */
|
||||
#define MTBSR 4 /* Backward Space Record */
|
||||
#define MTREW 5 /* Rewind tape */
|
||||
#define MTOFFL 6 /* Rewind and take Offline */
|
||||
#define MTNOP 7 /* No-Operation, set status only */
|
||||
#define MTRETEN 8 /* Retension (completely wind and rewind) */
|
||||
#define MTERASE 9 /* Erase the tape and rewind */
|
||||
#define MTEOM 10 /* Position at End-Of-Media */
|
||||
#define MTMODE 11 /* Select tape density */
|
||||
#define MTBLKZ 12 /* Select tape block size */
|
||||
|
||||
/* Tape status: ioctl(fd, MTIOCGET, &struct mtget) */
|
||||
|
||||
struct mtget {
|
||||
short mt_type; /* Type of tape device. */
|
||||
|
||||
/* Device dependent "registers". */
|
||||
short mt_dsreg; /* Drive status register. */
|
||||
short mt_erreg; /* Error register. */
|
||||
short dummy; /* (alignment) */
|
||||
|
||||
/* Misc info. */
|
||||
off_t mt_resid; /* Residual count. */
|
||||
off_t mt_fileno; /* Current File Number. */
|
||||
off_t mt_blkno; /* Current Block Number within file. */
|
||||
off_t mt_blksize; /* Current block size. */
|
||||
};
|
||||
|
||||
#endif /* _SYS__MTIO_H */
|
||||
27
include/sys/ptrace.h
Executable file
27
include/sys/ptrace.h
Executable file
@@ -0,0 +1,27 @@
|
||||
/* <sys/ptrace.h>
|
||||
* definitions for ptrace(2)
|
||||
*/
|
||||
|
||||
#ifndef _PTRACE_H
|
||||
#define _PTRACE_H
|
||||
|
||||
#define T_STOP -1 /* stop the process */
|
||||
#define T_OK 0 /* enable tracing by parent for this process */
|
||||
#define T_GETINS 1 /* return value from instruction space */
|
||||
#define T_GETDATA 2 /* return value from data space */
|
||||
#define T_GETUSER 3 /* return value from user process table */
|
||||
#define T_SETINS 4 /* set value from instruction space */
|
||||
#define T_SETDATA 5 /* set value from data space */
|
||||
#define T_SETUSER 6 /* set value in user process table */
|
||||
#define T_RESUME 7 /* resume execution */
|
||||
#define T_EXIT 8 /* exit */
|
||||
#define T_STEP 9 /* set trace bit */
|
||||
|
||||
/* Function Prototypes. */
|
||||
#ifndef _ANSI_H
|
||||
#include <ansi.h>
|
||||
#endif
|
||||
|
||||
_PROTOTYPE( long ptrace, (int _req, pid_t _pid, long _addr, long _data) );
|
||||
|
||||
#endif /* _PTRACE_H */
|
||||
146
include/sys/sigcontext.h
Executable file
146
include/sys/sigcontext.h
Executable file
@@ -0,0 +1,146 @@
|
||||
#ifndef _SIGCONTEXT_H
|
||||
#define _SIGCONTEXT_H
|
||||
|
||||
/* The sigcontext structure is used by the sigreturn(2) system call.
|
||||
* sigreturn() is seldom called by user programs, but it is used internally
|
||||
* by the signal catching mechanism.
|
||||
*/
|
||||
|
||||
#ifndef _ANSI_H
|
||||
#include <ansi.h>
|
||||
#endif
|
||||
|
||||
#ifndef _CONFIG_H
|
||||
#include <minix/config.h>
|
||||
#endif
|
||||
|
||||
#if !defined(CHIP)
|
||||
#include "error, configuration is not known"
|
||||
#endif
|
||||
|
||||
/* The following structure should match the stackframe_s structure used
|
||||
* by the kernel's context switching code. Floating point registers should
|
||||
* be added in a different struct.
|
||||
*/
|
||||
#if (CHIP == INTEL)
|
||||
struct sigregs {
|
||||
#if _WORD_SIZE == 4
|
||||
short sr_gs;
|
||||
short sr_fs;
|
||||
#endif /* _WORD_SIZE == 4 */
|
||||
short sr_es;
|
||||
short sr_ds;
|
||||
int sr_di;
|
||||
int sr_si;
|
||||
int sr_bp;
|
||||
int sr_st; /* stack top -- used in kernel */
|
||||
int sr_bx;
|
||||
int sr_dx;
|
||||
int sr_cx;
|
||||
int sr_retreg;
|
||||
int sr_retadr; /* return address to caller of save -- used
|
||||
* in kernel */
|
||||
int sr_pc;
|
||||
int sr_cs;
|
||||
int sr_psw;
|
||||
int sr_sp;
|
||||
int sr_ss;
|
||||
};
|
||||
|
||||
struct sigframe { /* stack frame created for signalled process */
|
||||
_PROTOTYPE( void (*sf_retadr), (void) );
|
||||
int sf_signo;
|
||||
int sf_code;
|
||||
struct sigcontext *sf_scp;
|
||||
int sf_fp;
|
||||
_PROTOTYPE( void (*sf_retadr2), (void) );
|
||||
struct sigcontext *sf_scpcopy;
|
||||
};
|
||||
|
||||
#else
|
||||
#if (CHIP == M68000)
|
||||
struct sigregs {
|
||||
long sr_retreg; /* d0 */
|
||||
long sr_d1;
|
||||
long sr_d2;
|
||||
long sr_d3;
|
||||
long sr_d4;
|
||||
long sr_d5;
|
||||
long sr_d6;
|
||||
long sr_d7;
|
||||
long sr_a0;
|
||||
long sr_a1;
|
||||
long sr_a2;
|
||||
long sr_a3;
|
||||
long sr_a4;
|
||||
long sr_a5;
|
||||
long sr_a6;
|
||||
long sr_sp; /* also known as a7 */
|
||||
long sr_pc;
|
||||
short sr_psw;
|
||||
short sr_dummy; /* make size multiple of 4 for system.c */
|
||||
};
|
||||
#else
|
||||
#include "error, CHIP is not supported"
|
||||
#endif
|
||||
#endif /* CHIP == INTEL */
|
||||
|
||||
struct sigcontext {
|
||||
int sc_flags; /* sigstack state to restore */
|
||||
long sc_mask; /* signal mask to restore */
|
||||
struct sigregs sc_regs; /* register set to restore */
|
||||
};
|
||||
|
||||
#if (CHIP == INTEL)
|
||||
#if _WORD_SIZE == 4
|
||||
#define sc_gs sc_regs.sr_gs
|
||||
#define sc_fs sc_regs.sr_fs
|
||||
#endif /* _WORD_SIZE == 4 */
|
||||
#define sc_es sc_regs.sr_es
|
||||
#define sc_ds sc_regs.sr_ds
|
||||
#define sc_di sc_regs.sr_di
|
||||
#define sc_si sc_regs.sr_si
|
||||
#define sc_fp sc_regs.sr_bp
|
||||
#define sc_st sc_regs.sr_st /* stack top -- used in kernel */
|
||||
#define sc_bx sc_regs.sr_bx
|
||||
#define sc_dx sc_regs.sr_dx
|
||||
#define sc_cx sc_regs.sr_cx
|
||||
#define sc_retreg sc_regs.sr_retreg
|
||||
#define sc_retadr sc_regs.sr_retadr /* return address to caller of
|
||||
save -- used in kernel */
|
||||
#define sc_pc sc_regs.sr_pc
|
||||
#define sc_cs sc_regs.sr_cs
|
||||
#define sc_psw sc_regs.sr_psw
|
||||
#define sc_sp sc_regs.sr_sp
|
||||
#define sc_ss sc_regs.sr_ss
|
||||
#endif /* CHIP == INTEL */
|
||||
|
||||
#if (CHIP == M68000)
|
||||
#define sc_retreg sc_regs.sr_retreg
|
||||
#define sc_d1 sc_regs.sr_d1
|
||||
#define sc_d2 sc_regs.sr_d2
|
||||
#define sc_d3 sc_regs.sr_d3
|
||||
#define sc_d4 sc_regs.sr_d4
|
||||
#define sc_d5 sc_regs.sr_d5
|
||||
#define sc_d6 sc_regs.sr_d6
|
||||
#define sc_d7 sc_regs.sr_d7
|
||||
#define sc_a0 sc_regs.sr_a0
|
||||
#define sc_a1 sc_regs.sr_a1
|
||||
#define sc_a2 sc_regs.sr_a2
|
||||
#define sc_a3 sc_regs.sr_a3
|
||||
#define sc_a4 sc_regs.sr_a4
|
||||
#define sc_a5 sc_regs.sr_a5
|
||||
#define sc_fp sc_regs.sr_a6
|
||||
#define sc_sp sc_regs.sr_sp
|
||||
#define sc_pc sc_regs.sr_pc
|
||||
#define sc_psw sc_regs.sr_psw
|
||||
#endif /* CHIP == M68000 */
|
||||
|
||||
/* Values for sc_flags. Must agree with <minix/jmp_buf.h>. */
|
||||
#define SC_SIGCONTEXT 2 /* nonzero when signal context is included */
|
||||
#define SC_NOREGLOCALS 4 /* nonzero when registers are not to be
|
||||
saved and restored */
|
||||
|
||||
_PROTOTYPE( int sigreturn, (struct sigcontext *_scp) );
|
||||
|
||||
#endif /* _SIGCONTEXT_H */
|
||||
74
include/sys/stat.h
Executable file
74
include/sys/stat.h
Executable file
@@ -0,0 +1,74 @@
|
||||
/* The <sys/stat.h> header defines a struct that is used in the stat() and
|
||||
* fstat functions. The information in this struct comes from the i-node of
|
||||
* some file. These calls are the only approved way to inspect i-nodes.
|
||||
*/
|
||||
|
||||
#ifndef _STAT_H
|
||||
#define _STAT_H
|
||||
|
||||
#ifndef _TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
struct stat {
|
||||
dev_t st_dev; /* major/minor device number */
|
||||
ino_t st_ino; /* i-node number */
|
||||
mode_t st_mode; /* file mode, protection bits, etc. */
|
||||
short int st_nlink; /* # links; TEMPORARY HACK: should be nlink_t*/
|
||||
uid_t st_uid; /* uid of the file's owner */
|
||||
short int st_gid; /* gid; TEMPORARY HACK: should be gid_t */
|
||||
dev_t st_rdev;
|
||||
off_t st_size; /* file size */
|
||||
time_t st_atime; /* time of last access */
|
||||
time_t st_mtime; /* time of last data modification */
|
||||
time_t st_ctime; /* time of last file status change */
|
||||
};
|
||||
|
||||
/* Traditional mask definitions for st_mode. */
|
||||
/* The ugly casts on only some of the definitions are to avoid suprising sign
|
||||
* extensions such as S_IFREG != (mode_t) S_IFREG when ints are 32 bits.
|
||||
*/
|
||||
#define S_IFMT ((mode_t) 0170000) /* type of file */
|
||||
#define S_IFREG ((mode_t) 0100000) /* regular */
|
||||
#define S_IFBLK 0060000 /* block special */
|
||||
#define S_IFDIR 0040000 /* directory */
|
||||
#define S_IFCHR 0020000 /* character special */
|
||||
#define S_IFIFO 0010000 /* this is a FIFO */
|
||||
#define S_ISUID 0004000 /* set user id on execution */
|
||||
#define S_ISGID 0002000 /* set group id on execution */
|
||||
/* next is reserved for future use */
|
||||
#define S_ISVTX 01000 /* save swapped text even after use */
|
||||
|
||||
/* POSIX masks for st_mode. */
|
||||
#define S_IRWXU 00700 /* owner: rwx------ */
|
||||
#define S_IRUSR 00400 /* owner: r-------- */
|
||||
#define S_IWUSR 00200 /* owner: -w------- */
|
||||
#define S_IXUSR 00100 /* owner: --x------ */
|
||||
|
||||
#define S_IRWXG 00070 /* group: ---rwx--- */
|
||||
#define S_IRGRP 00040 /* group: ---r----- */
|
||||
#define S_IWGRP 00020 /* group: ----w---- */
|
||||
#define S_IXGRP 00010 /* group: -----x--- */
|
||||
|
||||
#define S_IRWXO 00007 /* others: ------rwx */
|
||||
#define S_IROTH 00004 /* others: ------r-- */
|
||||
#define S_IWOTH 00002 /* others: -------w- */
|
||||
#define S_IXOTH 00001 /* others: --------x */
|
||||
|
||||
/* The following macros test st_mode (from POSIX Sec. 5.6.1.1). */
|
||||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* is a reg file */
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* is a directory */
|
||||
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* is a char spec */
|
||||
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) /* is a block spec */
|
||||
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* is a pipe/FIFO */
|
||||
|
||||
|
||||
/* Function Prototypes. */
|
||||
_PROTOTYPE( int chmod, (const char *_path, Mode_t _mode) );
|
||||
_PROTOTYPE( int fstat, (int _fildes, struct stat *_buf) );
|
||||
_PROTOTYPE( int mkdir, (const char *_path, Mode_t _mode) );
|
||||
_PROTOTYPE( int mkfifo, (const char *_path, Mode_t _mode) );
|
||||
_PROTOTYPE( int stat, (const char *_path, struct stat *_buf) );
|
||||
_PROTOTYPE( mode_t umask, (Mode_t _cmask) );
|
||||
|
||||
#endif /* _STAT_H */
|
||||
16
include/sys/statfs.h
Normal file
16
include/sys/statfs.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/* Data for fstatfs() call. */
|
||||
|
||||
#ifndef _STATFS_H
|
||||
#define _STATFS_H
|
||||
|
||||
#ifndef _TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
struct statfs {
|
||||
off_t f_bsize; /* file system block size */
|
||||
};
|
||||
|
||||
_PROTOTYPE( int fstatfs, (int fd, struct statfs *st) );
|
||||
|
||||
#endif /* _STATFS_H */
|
||||
58
include/sys/svrctl.h
Executable file
58
include/sys/svrctl.h
Executable file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
sys/svrctl.h
|
||||
|
||||
Created: Feb 15, 1994 by Philip Homburg <philip@cs.vu.nl>
|
||||
*/
|
||||
|
||||
#ifndef _SYS__SVRCTL_H
|
||||
#define _SYS__SVRCTL_H
|
||||
|
||||
#ifndef _TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* Server control commands have the same encoding as the commands for ioctls. */
|
||||
#include <minix/ioctl.h>
|
||||
|
||||
/* MM controls. */
|
||||
#define MMSIGNON _IO ('M', 4)
|
||||
#define MMSWAPON _IOW('M', 5, struct mmswapon)
|
||||
#define MMSWAPOFF _IO ('M', 6)
|
||||
#define MMGETPARAM _IOW('M', 5, struct sysgetenv)
|
||||
|
||||
/* FS controls. */
|
||||
#define FSSIGNON _IOW('F', 2, struct fssignon)
|
||||
#define FSDEVMAP _IORW('F', 5, struct fsdevmap)
|
||||
|
||||
/* Kernel controls. */
|
||||
#define SYSSENDMASK _IO ('S', 4)
|
||||
#define SYSSIGNON _IOR('S', 2, struct systaskinfo)
|
||||
#define SYSGETENV _IOW('S', 5, struct sysgetenv)
|
||||
|
||||
struct mmswapon {
|
||||
u32_t offset; /* Starting offset within file. */
|
||||
u32_t size; /* Size of swap area. */
|
||||
char file[128]; /* Name of swap file/device. */
|
||||
};
|
||||
|
||||
/* TEMP!!! A proper system call must be created later. */
|
||||
#include "/usr/src/servers/fs/dmap.h"
|
||||
struct fssignon {
|
||||
dev_t dev; /* Device to manage. */
|
||||
enum dev_style style; /* Management style. */
|
||||
};
|
||||
|
||||
struct systaskinfo {
|
||||
int proc_nr; /* Process number of caller. */
|
||||
};
|
||||
|
||||
struct sysgetenv {
|
||||
char *key; /* Name requested. */
|
||||
size_t keylen; /* Length of name including \0. */
|
||||
char *val; /* Buffer for returned data. */
|
||||
size_t vallen; /* Size of return data buffer. */
|
||||
};
|
||||
|
||||
_PROTOTYPE( int svrctl, (int _request, void *_data) );
|
||||
|
||||
#endif /* _SYS__SVRCTL_H */
|
||||
25
include/sys/times.h
Executable file
25
include/sys/times.h
Executable file
@@ -0,0 +1,25 @@
|
||||
/* The <times.h> header is for time times() system call. */
|
||||
|
||||
#ifndef _TIMES_H
|
||||
#define _TIMES_H
|
||||
|
||||
#ifndef _CLOCK_T
|
||||
#define _CLOCK_T
|
||||
typedef long clock_t; /* unit for system accounting */
|
||||
#endif
|
||||
|
||||
struct tms {
|
||||
clock_t tms_utime;
|
||||
clock_t tms_stime;
|
||||
clock_t tms_cutime;
|
||||
clock_t tms_cstime;
|
||||
};
|
||||
|
||||
/* Function Prototypes. */
|
||||
#ifndef _ANSI_H
|
||||
#include <ansi.h>
|
||||
#endif
|
||||
|
||||
_PROTOTYPE( clock_t times, (struct tms *_buffer) );
|
||||
|
||||
#endif /* _TIMES_H */
|
||||
119
include/sys/types.h
Executable file
119
include/sys/types.h
Executable file
@@ -0,0 +1,119 @@
|
||||
/* The <sys/types.h> header contains important data type definitions.
|
||||
* It is considered good programming practice to use these definitions,
|
||||
* instead of the underlying base type. By convention, all type names end
|
||||
* with _t.
|
||||
*/
|
||||
|
||||
#ifndef _TYPES_H
|
||||
#define _TYPES_H
|
||||
|
||||
#ifndef _ANSI_H
|
||||
#include <ansi.h>
|
||||
#endif
|
||||
|
||||
/* The type size_t holds all results of the sizeof operator. At first glance,
|
||||
* it seems obvious that it should be an unsigned int, but this is not always
|
||||
* the case. For example, MINIX-ST (68000) has 32-bit pointers and 16-bit
|
||||
* integers. When one asks for the size of a 70K struct or array, the result
|
||||
* requires 17 bits to express, so size_t must be a long type. The type
|
||||
* ssize_t is the signed version of size_t.
|
||||
*/
|
||||
#ifndef _SIZE_T
|
||||
#define _SIZE_T
|
||||
typedef unsigned int size_t;
|
||||
#endif
|
||||
|
||||
#ifndef _SSIZE_T
|
||||
#define _SSIZE_T
|
||||
typedef int ssize_t;
|
||||
#endif
|
||||
|
||||
#ifndef _TIME_T
|
||||
#define _TIME_T
|
||||
typedef long time_t; /* time in sec since 1 Jan 1970 0000 GMT */
|
||||
#endif
|
||||
|
||||
#ifndef _CLOCK_T
|
||||
#define _CLOCK_T
|
||||
typedef long clock_t; /* unit for system accounting */
|
||||
#endif
|
||||
|
||||
#ifndef _SIGSET_T
|
||||
#define _SIGSET_T
|
||||
typedef unsigned long sigset_t;
|
||||
#endif
|
||||
|
||||
/* Types used in disk, inode, etc. data structures. */
|
||||
typedef short dev_t; /* holds (major|minor) device pair */
|
||||
typedef char gid_t; /* group id */
|
||||
typedef unsigned long ino_t; /* i-node number (V3 filesystem) */
|
||||
typedef unsigned short mode_t; /* file type and permissions bits */
|
||||
typedef short nlink_t; /* number of links to a file */
|
||||
typedef unsigned long off_t; /* offset within a file */
|
||||
typedef int pid_t; /* process id (must be signed) */
|
||||
typedef short uid_t; /* user id */
|
||||
typedef unsigned long zone_t; /* zone number */
|
||||
typedef unsigned long block_t; /* block number */
|
||||
typedef unsigned long bit_t; /* bit number in a bit map */
|
||||
typedef unsigned short zone1_t; /* zone number for V1 file systems */
|
||||
typedef unsigned short bitchunk_t; /* collection of bits in a bitmap */
|
||||
|
||||
typedef unsigned char u8_t; /* 8 bit type */
|
||||
typedef unsigned short u16_t; /* 16 bit type */
|
||||
typedef unsigned long u32_t; /* 32 bit type */
|
||||
|
||||
typedef char i8_t; /* 8 bit signed type */
|
||||
typedef short i16_t; /* 16 bit signed type */
|
||||
typedef long i32_t; /* 32 bit signed type */
|
||||
|
||||
typedef struct { u32_t _[2]; } u64_t;
|
||||
|
||||
/* The following types are needed because MINIX uses K&R style function
|
||||
* definitions (for maximum portability). When a short, such as dev_t, is
|
||||
* passed to a function with a K&R definition, the compiler automatically
|
||||
* promotes it to an int. The prototype must contain an int as the parameter,
|
||||
* not a short, because an int is what an old-style function definition
|
||||
* expects. Thus using dev_t in a prototype would be incorrect. It would be
|
||||
* sufficient to just use int instead of dev_t in the prototypes, but Dev_t
|
||||
* is clearer.
|
||||
*/
|
||||
typedef int Dev_t;
|
||||
typedef int Gid_t;
|
||||
typedef int Nlink_t;
|
||||
typedef int Uid_t;
|
||||
typedef int U8_t;
|
||||
typedef unsigned long U32_t;
|
||||
typedef int I8_t;
|
||||
typedef int I16_t;
|
||||
typedef long I32_t;
|
||||
|
||||
/* ANSI C makes writing down the promotion of unsigned types very messy. When
|
||||
* sizeof(short) == sizeof(int), there is no promotion, so the type stays
|
||||
* unsigned. When the compiler is not ANSI, there is usually no loss of
|
||||
* unsignedness, and there are usually no prototypes so the promoted type
|
||||
* doesn't matter. The use of types like Ino_t is an attempt to use ints
|
||||
* (which are not promoted) while providing information to the reader.
|
||||
*/
|
||||
|
||||
typedef unsigned long Ino_t;
|
||||
|
||||
#if _EM_WSIZE == 2
|
||||
/*typedef unsigned int Ino_t; Ino_t is now 32 bits */
|
||||
typedef unsigned int Zone1_t;
|
||||
typedef unsigned int Bitchunk_t;
|
||||
typedef unsigned int U16_t;
|
||||
typedef unsigned int Mode_t;
|
||||
|
||||
#else /* _EM_WSIZE == 4, or _EM_WSIZE undefined */
|
||||
/*typedef int Ino_t; Ino_t is now 32 bits */
|
||||
typedef int Zone1_t;
|
||||
typedef int Bitchunk_t;
|
||||
typedef int U16_t;
|
||||
typedef int Mode_t;
|
||||
|
||||
#endif /* _EM_WSIZE == 2, etc */
|
||||
|
||||
/* Signal handler type, e.g. SIG_IGN */
|
||||
typedef void _PROTOTYPE( (*sighandler_t), (int) );
|
||||
|
||||
#endif /* _TYPES_H */
|
||||
22
include/sys/utsname.h
Executable file
22
include/sys/utsname.h
Executable file
@@ -0,0 +1,22 @@
|
||||
/* The <sys/utsname.h> header gives the system name. */
|
||||
|
||||
#ifndef _UTSNAME_H
|
||||
#define _UTSNAME_H
|
||||
|
||||
#ifndef _ANSI_H
|
||||
#include <ansi.h>
|
||||
#endif
|
||||
|
||||
struct utsname {
|
||||
char sysname[15+1];
|
||||
char nodename[255+1];
|
||||
char release[11+1];
|
||||
char version[7+1];
|
||||
char machine[11+1];
|
||||
char arch[11+1];
|
||||
};
|
||||
|
||||
/* Function Prototypes. */
|
||||
_PROTOTYPE( int uname, (struct utsname *_name) );
|
||||
|
||||
#endif /* _UTSNAME_H */
|
||||
40
include/sys/wait.h
Executable file
40
include/sys/wait.h
Executable file
@@ -0,0 +1,40 @@
|
||||
/* The <sys/wait.h> header contains macros related to wait(). The value
|
||||
* returned by wait() and waitpid() depends on whether the process
|
||||
* terminated by an exit() call, was killed by a signal, or was stopped
|
||||
* due to job control, as follows:
|
||||
*
|
||||
* High byte Low byte
|
||||
* +---------------------+
|
||||
* exit(status) | status | 0 |
|
||||
* +---------------------+
|
||||
* killed by signal | 0 | signal |
|
||||
* +---------------------+
|
||||
* stopped (job control) | signal | 0177 |
|
||||
* +---------------------+
|
||||
*/
|
||||
|
||||
#ifndef _WAIT_H
|
||||
#define _WAIT_H
|
||||
|
||||
#ifndef _TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#define _LOW(v) ( (v) & 0377)
|
||||
#define _HIGH(v) ( ((v) >> 8) & 0377)
|
||||
|
||||
#define WNOHANG 1 /* do not wait for child to exit */
|
||||
#define WUNTRACED 2 /* for job control; not implemented */
|
||||
|
||||
#define WIFEXITED(s) (_LOW(s) == 0) /* normal exit */
|
||||
#define WEXITSTATUS(s) (_HIGH(s)) /* exit status */
|
||||
#define WTERMSIG(s) (_LOW(s) & 0177) /* sig value */
|
||||
#define WIFSIGNALED(s) (((unsigned int)(s)-1 & 0xFFFF) < 0xFF) /* signaled */
|
||||
#define WIFSTOPPED(s) (_LOW(s) == 0177) /* stopped */
|
||||
#define WSTOPSIG(s) (_HIGH(s) & 0377) /* stop signal */
|
||||
|
||||
/* Function Prototypes. */
|
||||
_PROTOTYPE( pid_t wait, (int *_stat_loc) );
|
||||
_PROTOTYPE( pid_t waitpid, (pid_t _pid, int *_stat_loc, int _options) );
|
||||
|
||||
#endif /* _WAIT_H */
|
||||
Reference in New Issue
Block a user