#include <signal.h>
#include <errno.h>
#include <linux/string.h>
-#include <sys/stat.h>
+#include <linux/stat.h>
#include <sys/ptrace.h>
#include <a.out.h>
#include <fcntl.h>
#include <errno.h>
#include <fcntl.h>
-#include <sys/stat.h>
+#include <linux/stat.h>
#include <asm/segment.h>
*/
#include <linux/string.h>
-#include <sys/stat.h>
+#include <linux/stat.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <errno.h>
-#include <sys/stat.h>
+#include <linux/stat.h>
#include <linux/sched.h>
int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
#include <linux/sched.h>
#include <linux/minix_fs.h>
#include <linux/tty.h>
+#include <linux/stat.h>
#include <errno.h>
#include <fcntl.h>
-#include <sys/stat.h>
/*
* Called every time a minix block special file is opened
#include <linux/sched.h>
#include <linux/minix_fs.h>
#include <linux/tty.h>
+#include <linux/stat.h>
#include <errno.h>
#include <fcntl.h>
-#include <sys/stat.h>
/*
* Called every time a minix character special file is opened
#include <errno.h>
-#include <sys/stat.h>
-
#include <asm/segment.h>
#include <linux/fs.h>
#include <linux/minix_fs.h>
+#include <linux/stat.h>
static int minix_readdir(struct inode *, struct file *, struct dirent *, int);
#include <fcntl.h>
#include <sys/dirent.h>
-#include <sys/stat.h>
#include <asm/segment.h>
#include <asm/system.h>
#include <linux/sched.h>
#include <linux/minix_fs.h>
#include <linux/kernel.h>
+#include <linux/stat.h>
#define NBUF 16
*/
#include <linux/string.h>
-#include <sys/stat.h>
-
+#include <linux/stat.h>
#include <linux/sched.h>
#include <linux/minix_fs.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/minix_fs.h>
#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/stat.h>
#include <asm/segment.h>
-#include <linux/string.h>
#include <fcntl.h>
#include <errno.h>
#include <const.h>
-#include <sys/stat.h>
/*
* comment out this line if you want names > MINIX_NAME_LEN chars to be
#include <errno.h>
-#include <sys/stat.h>
-
#include <asm/segment.h>
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/minix_fs.h>
+#include <linux/stat.h>
static int minix_readlink(struct inode *, char *, int);
static struct inode * minix_follow_link(struct inode *, struct inode *);
#include <linux/sched.h>
#include <linux/minix_fs.h>
#include <linux/tty.h>
+#include <linux/stat.h>
#include <errno.h>
#include <fcntl.h>
-#include <sys/stat.h>
/*
* Truncate has the most races in the whole filesystem: coding it is
#include <fcntl.h>
#include <errno.h>
#include <const.h>
-#include <sys/stat.h>
+#include <linux/stat.h>
struct inode * _namei(const char * filename, struct inode * base,
int follow_links);
#include <sys/types.h>
#include <utime.h>
-#include <sys/stat.h>
#include <sys/vfs.h>
+#include <linux/stat.h>
#include <linux/string.h>
#include <linux/sched.h>
#include <linux/kernel.h>
iput(inode);
if (current->uid == inode->i_uid)
res >>= 6;
- else if (current->gid == inode->i_gid)
- res >>= 6;
+ else if (in_group_p(inode->i_gid))
+ res >>= 3;
if ((res & 0007 & mode) == mode)
return 0;
/*
int fd[2];
int i,j;
+ verify_area(fildes,8);
j=0;
for(i=0;j<2 && i<NR_FILE;i++)
if (!file_table[i].f_count)
#include <errno.h>
#include <sys/types.h>
-#include <sys/stat.h>
#include <sys/dirent.h>
+#include <linux/stat.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/minix_fs.h>
#include <linux/tty.h>
#include <linux/sched.h>
#include <linux/string.h>
+#include <linux/stat.h>
#include <asm/segment.h>
#include <asm/system.h>
-#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
*/
#include <errno.h>
-#include <sys/stat.h>
+#include <linux/stat.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/segment.h>
-static void cp_stat(struct inode * inode, struct stat * statbuf)
+static void cp_old_stat(struct inode * inode, struct old_stat * statbuf)
{
- struct stat tmp;
- int i;
+ struct old_stat tmp;
- verify_area(statbuf,sizeof (struct stat));
+ if (inode->i_ino & 0xffff0000)
+ printk("Warning: using old stat() call on bigfs\n");
+ verify_area(statbuf,sizeof (*statbuf));
tmp.st_dev = inode->i_dev;
tmp.st_ino = inode->i_ino;
tmp.st_mode = inode->i_mode;
tmp.st_atime = inode->i_atime;
tmp.st_mtime = inode->i_mtime;
tmp.st_ctime = inode->i_ctime;
- for (i=0 ; i<sizeof (tmp) ; i++)
- put_fs_byte(((char *) &tmp)[i],i + (char *) statbuf);
+ memcpy_tofs(statbuf,&tmp,sizeof(tmp));
}
-int sys_stat(char * filename, struct stat * statbuf)
+static void cp_new_stat(struct inode * inode, struct new_stat * statbuf)
+{
+ struct new_stat tmp = {0, };
+
+ verify_area(statbuf,sizeof (*statbuf));
+ tmp.st_dev = inode->i_dev;
+ tmp.st_ino = inode->i_ino;
+ tmp.st_mode = inode->i_mode;
+ tmp.st_nlink = inode->i_nlink;
+ tmp.st_uid = inode->i_uid;
+ tmp.st_gid = inode->i_gid;
+ tmp.st_rdev = inode->i_rdev;
+ tmp.st_size = inode->i_size;
+ tmp.st_atime = inode->i_atime;
+ tmp.st_mtime = inode->i_mtime;
+ tmp.st_ctime = inode->i_ctime;
+ memcpy_tofs(statbuf,&tmp,sizeof(tmp));
+}
+
+int sys_stat(char * filename, struct old_stat * statbuf)
+{
+ struct inode * inode;
+
+ if (!(inode=namei(filename)))
+ return -ENOENT;
+ cp_old_stat(inode,statbuf);
+ iput(inode);
+ return 0;
+}
+
+int sys_newstat(char * filename, struct new_stat * statbuf)
{
struct inode * inode;
if (!(inode=namei(filename)))
return -ENOENT;
- cp_stat(inode,statbuf);
+ cp_new_stat(inode,statbuf);
iput(inode);
return 0;
}
-int sys_lstat(char * filename, struct stat * statbuf)
+int sys_lstat(char * filename, struct old_stat * statbuf)
{
struct inode * inode;
if (!(inode = lnamei(filename)))
return -ENOENT;
- cp_stat(inode,statbuf);
+ cp_old_stat(inode,statbuf);
iput(inode);
return 0;
}
-int sys_fstat(unsigned int fd, struct stat * statbuf)
+int sys_newlstat(char * filename, struct new_stat * statbuf)
+{
+ struct inode * inode;
+
+ if (!(inode = lnamei(filename)))
+ return -ENOENT;
+ cp_new_stat(inode,statbuf);
+ iput(inode);
+ return 0;
+}
+
+int sys_fstat(unsigned int fd, struct old_stat * statbuf)
+{
+ struct file * f;
+ struct inode * inode;
+
+ if (fd >= NR_OPEN || !(f=current->filp[fd]) || !(inode=f->f_inode))
+ return -EBADF;
+ cp_old_stat(inode,statbuf);
+ return 0;
+}
+
+int sys_newfstat(unsigned int fd, struct new_stat * statbuf)
{
struct file * f;
struct inode * inode;
if (fd >= NR_OPEN || !(f=current->filp[fd]) || !(inode=f->f_inode))
return -EBADF;
- cp_stat(inode,statbuf);
+ cp_new_stat(inode,statbuf);
return 0;
}
#include <linux/sched.h>
#include <linux/minix_fs.h>
#include <linux/kernel.h>
+#include <linux/stat.h>
#include <asm/system.h>
#include <asm/segment.h>
#include <errno.h>
-#include <sys/stat.h>
int sync_dev(int dev);
void wait_for_keypress(void);
pid_t l_pid;
};
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern int creat(const char * filename,mode_t mode);
extern int fcntl(int fildes,int cmd, ...);
extern int open(const char * filename, int flags, ...);
+#ifdef __cplusplus
+}
+#endif
+
#endif
-#define UTS_RELEASE "0.96a-10"
+#define UTS_RELEASE "0.96a-35"
-#define UTS_VERSION "05/22/92"
+#define UTS_VERSION "06/17/92"
};
struct inode {
- dev_t i_dev;
- ino_t i_ino;
- umode_t i_mode;
- nlink_t i_nlink;
- uid_t i_uid;
- gid_t i_gid;
- dev_t i_rdev;
- off_t i_size;
- time_t i_atime;
- time_t i_mtime;
- time_t i_ctime;
+ dev_t i_dev;
+ unsigned long i_ino;
+ umode_t i_mode;
+ nlink_t i_nlink;
+ uid_t i_uid;
+ gid_t i_gid;
+ dev_t i_rdev;
+ off_t i_size;
+ time_t i_atime;
+ time_t i_mtime;
+ time_t i_ctime;
unsigned long i_data[16];
struct inode_operations * i_op;
struct super_block * i_sb;
* function prototypes
*/
-extern void lp_init(void);
+extern long lp_init(long);
--- /dev/null
+#ifndef _LINUX_STAT_H
+#define _LINUX_STAT_H
+
+struct old_stat {
+ unsigned short st_dev;
+ unsigned short st_ino;
+ unsigned short st_mode;
+ unsigned short st_nlink;
+ unsigned short st_uid;
+ unsigned short st_gid;
+ unsigned short st_rdev;
+ unsigned long st_size;
+ unsigned long st_atime;
+ unsigned long st_mtime;
+ unsigned long st_ctime;
+};
+
+struct new_stat {
+ unsigned short st_dev;
+ unsigned short __pad1;
+ unsigned long st_ino;
+ unsigned short st_mode;
+ unsigned short st_nlink;
+ unsigned short st_uid;
+ unsigned short st_gid;
+ unsigned short st_rdev;
+ unsigned short __pad2;
+ unsigned long st_size;
+ unsigned long st_blksize;
+ unsigned long st_blocks;
+ unsigned long st_atime;
+ unsigned long __unused1;
+ unsigned long st_mtime;
+ unsigned long __unused2;
+ unsigned long st_ctime;
+ unsigned long __unused3;
+ unsigned long __unused4;
+ unsigned long __unused5;
+};
+
+#define S_IFMT 00170000
+#define S_IFSOCK 0140000
+#define S_IFLNK 0120000
+#define S_IFREG 0100000
+#define S_IFBLK 0060000
+#define S_IFDIR 0040000
+#define S_IFCHR 0020000
+#define S_IFIFO 0010000
+#define S_ISUID 0004000
+#define S_ISGID 0002000
+#define S_ISVTX 0001000
+
+#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+
+#define S_IRWXU 00700
+#define S_IRUSR 00400
+#define S_IWUSR 00200
+#define S_IXUSR 00100
+
+#define S_IRWXG 00070
+#define S_IRGRP 00040
+#define S_IWGRP 00020
+#define S_IXGRP 00010
+
+#define S_IRWXO 00007
+#define S_IROTH 00004
+#define S_IWOTH 00002
+#define S_IXOTH 00001
+
+#endif
extern int sys_syslog();
extern int sys_getitimer();
extern int sys_setitimer();
+extern int sys_newstat();
+extern int sys_newlstat();
+extern int sys_newfstat();
+extern int sys_newuname();
fn_ptr sys_call_table[] = { sys_setup, sys_exit, sys_fork, sys_read,
sys_write, sys_open, sys_close, sys_waitpid, sys_creat, sys_link,
sys_swapon, sys_reboot, sys_readdir, sys_mmap, sys_munmap,
sys_truncate, sys_ftruncate, sys_fchmod, sys_fchown, sys_getpriority,
sys_setpriority, sys_profil, sys_statfs, sys_fstatfs, sys_ioperm,
-sys_socketcall, sys_syslog, sys_setitimer, sys_getitimer };
+sys_socketcall, sys_syslog, sys_setitimer, sys_getitimer, sys_newstat,
+sys_newlstat, sys_newfstat, sys_newuname };
/* So we don't have to do any more manual updating.... */
int NR_syscalls = sizeof(sys_call_table)/sizeof(fn_ptr);
#include <asm/system.h>
-#define MAX_CONSOLES 8
+#define NR_CONSOLES 8
#define NR_SERIALS 4
#define NR_PTYS 4
-extern int NR_CONSOLES;
+/*
+ * This character is the same as _POSIX_VDISABLE: it cannot be used as
+ * a c_cc[] character, but indicates that a particular special character
+ * isn't in use (eg VINTR ahs no character etc)
+ */
+#define __DISABLED_CHAR '\0'
#include <termios.h>
*/
#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
-extern void rs_init(void);
-extern void lp_init(void);
-extern void con_init(void);
-extern void tty_init(void);
+extern long rs_init(long);
+extern long lp_init(long);
+extern long con_init(long);
+extern long tty_init(long);
extern void flush(struct tty_queue * queue);
#define __NR_chmod 15
#define __NR_chown 16
#define __NR_break 17
-#define __NR_stat 18
+#define __NR_oldstat 18
#define __NR_lseek 19
#define __NR_getpid 20
#define __NR_mount 21
#define __NR_stime 25
#define __NR_ptrace 26
#define __NR_alarm 27
-#define __NR_fstat 28
+#define __NR_oldfstat 28
#define __NR_pause 29
#define __NR_utime 30
#define __NR_stty 31
#define __NR_mpx 56
#define __NR_setpgid 57
#define __NR_ulimit 58
-#define __NR_uname 59
+#define __NR_olduname 59
#define __NR_umask 60
#define __NR_chroot 61
#define __NR_ustat 62
#define __NR_setgroups 81
#define __NR_select 82
#define __NR_symlink 83
-#define __NR_lstat 84
+#define __NR_oldlstat 84
#define __NR_readlink 85
#define __NR_uselib 86
#define __NR_swapon 87
#define __NR_ftruncate 93
#define __NR_fchmod 94
#define __NR_fchown 95
-/*
- * Not all of these are implemented yet, but these are the
- * numbers they will use.
- */
#define __NR_getpriority 96
#define __NR_setpriority 97
#define __NR_profil 98
#define __NR_ioperm 101
#define __NR_socketcall 102
#define __NR_syslog 103
-
-extern int errno;
-
#define __NR_setitimer 104
#define __NR_getitimer 105
+#define __NR_stat 106
+#define __NR_lstat 107
+#define __NR_fstat 108
+#define __NR_uname 109
+
+extern int errno;
/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
#define _syscall0(type,name) \
--- /dev/null
+#ifndef _LINUX_UTSNAME_H
+#define _LINUX_UTSNAME_H
+
+#define __OLD_UTS_LEN 8
+
+struct old_utsname {
+ char sysname[9];
+ char nodename[9];
+ char release[9];
+ char version[9];
+ char machine[9];
+};
+
+#define __NEW_UTS_LEN 64
+
+struct new_utsname {
+ char sysname[65];
+ char nodename[65];
+ char release[65];
+ char version[65];
+ char machine[65];
+};
+
+#endif
void (*sa_restorer)(void);
};
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void (*signal(int _sig, void (*_func)(int)))(int);
int raise(int sig);
int kill(pid_t pid, int sig);
int sigsuspend(sigset_t *sigmask);
int sigaction(int sig, struct sigaction *act, struct sigaction *oldact);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _SIGNAL_H */
#define TCSADRAIN 1
#define TCSAFLUSH 2
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern speed_t cfgetispeed(struct termios *termios_p);
extern speed_t cfgetospeed(struct termios *termios_p);
extern int cfsetispeed(struct termios *termios_p, speed_t speed);
extern int tcsetattr(int fildes, int optional_actions,
struct termios *termios_p);
+#ifdef __cplusplus
+}
+#endif
+
#endif
#define __isleap(year) \
((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
+#ifdef __cplusplus
+extern "C" {
+#endif
+
clock_t clock(void);
time_t time(time_t * tp);
double difftime(time_t time2, time_t time1);
size_t strftime(char * s, size_t smax, const char * fmt, const struct tm * tp);
void tzset(void);
+#ifdef __cplusplus
+}
+#endif
+
#endif
/* XXX - illegal. */
extern int errno;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* XXX - several non-POSIX functions here, and POSIX functions that are
* supposed to be declared elsewhere. Non-promotion of short types in
* prototypes may cause trouble. Arg names should be prefixed by
int select(int width, fd_set * readfds, fd_set * writefds,
fd_set * exceptfds, struct timeval * timeout);
int swapon(const char * specialfile);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif
time_t modtime;
};
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern int utime(const char *filename, struct utimbuf *times);
+#ifdef __cplusplus
+}
+#endif
+
#endif
extern int vsprintf();
extern void init(void);
extern void blk_dev_init(void);
-extern void chr_dev_init(void);
+extern long chr_dev_init(long);
extern void hd_init(void);
extern void floppy_init(void);
extern void sock_init(void);
#ifdef RAMDISK
main_memory_start += rd_init(main_memory_start, RAMDISK*1024);
#endif
- mem_init(main_memory_start,memory_end);
trap_init();
sched_init();
- chr_dev_init();
+ main_memory_start = chr_dev_init(main_memory_start);
blk_dev_init();
+ mem_init(main_memory_start,memory_end);
time_init();
printk("Linux version " UTS_RELEASE " " __DATE__ " " __TIME__ "\n");
buffer_init(buffer_memory_end);
* console.c
*
* This module implements the console io functions
- * 'void con_init(void)'
+ * 'long con_init(long)'
* 'void con_write(struct tty_queue * queue)'
* Hopefully this will be a rather complete VT102 implementation.
*
#define NPAR 16
-int NR_CONSOLES = 0;
-
extern void vt_init(void);
extern void keyboard_interrupt(void);
extern void set_leds(void);
unsigned char vc_kbdmode;
char * vc_translate;
/* additional information is in vt_kern.h */
-} vc_cons [MAX_CONSOLES];
+} vc_cons [NR_CONSOLES];
#define MEM_BUFFER_SIZE (2*80*50*8)
-unsigned short *vc_scrbuf[MAX_CONSOLES];
-unsigned short vc_scrmembuf[MEM_BUFFER_SIZE/2];
+unsigned short *vc_scrbuf[NR_CONSOLES];
+static unsigned short * vc_scrmembuf;
static int console_blanked = 0;
#define origin (vc_cons[currcons].vc_origin)
wake_up(&tty->write_q->proc_list);
currcons = tty - tty_table;
- if (currcons >= MAX_CONSOLES) {
+ if (currcons >= NR_CONSOLES) {
printk("con_write: illegal tty\n\r");
return;
}
}
/*
- * void con_init(void);
+ * long con_init(long);
*
* This routine initalizes console interrupts, and does nothing
* else. If you want the screen to clear, call tty_write with
* Reads the information preserved by setup.s to determine the current display
* type and sets everything accordingly.
*/
-void con_init(void)
+long con_init(long kmem_start)
{
register unsigned char a;
char *display_desc = "????";
int orig_x = ORIG_X;
int orig_y = ORIG_Y;
+ vc_scrmembuf = (unsigned short *) kmem_start;
video_num_columns = ORIG_VIDEO_COLS;
video_size_row = video_num_columns * 2;
video_num_lines = ORIG_VIDEO_LINES;
video_page = ORIG_VIDEO_PAGE;
video_erase_char = 0x0720;
+ screen_size = (video_num_lines * video_size_row);
+ kmem_start += NR_CONSOLES * screen_size;
timer_table[BLANK_TIMER].fn = blank_screen;
timer_table[BLANK_TIMER].expires = 0;
if (blankinterval) {
memsetw(vc_scrmembuf,video_erase_char,MEM_BUFFER_SIZE/2);
base = (long)vc_scrmembuf;
- screen_size = (video_num_lines * video_size_row);
- NR_CONSOLES = MEM_BUFFER_SIZE / screen_size;
- if (NR_CONSOLES > MAX_CONSOLES)
- NR_CONSOLES = MAX_CONSOLES;
- if (!NR_CONSOLES)
- NR_CONSOLES = 1;
-
+
/* Initialize the variables used for scrolling (mostly EGA/VGA) */
base = origin = video_mem_start = (long)vc_scrmembuf;
vc_cons[0].vc_bold_attr = -1;
gotoxy(currcons,orig_x,orig_y);
- for (currcons = 1; currcons<NR_CONSOLES; currcons++) {
+ for (currcons = 1 ; currcons < NR_CONSOLES ; currcons++) {
vc_cons[currcons] = vc_cons[0];
vt_cons[currcons] = vt_cons[0];
base += screen_size;
- origin = video_mem_start = base;
+ x = y = 0;
+ pos = origin = video_mem_start = base;
scr_end = video_mem_end = base + screen_size;
vc_scrbuf[currcons] = (unsigned short *) origin;
- gotoxy(currcons,0,0);
}
currcons = 0;
a=inb_p(0x61);
outb_p(a|0x80,0x61);
outb_p(a,0x61);
+ return kmem_start;
}
void kbdsave(int new_console)
verify_area(buf,2+video_num_columns*video_num_lines);
currcons = get_fs_byte(buf+1);
- if ((currcons<0) || (currcons>NR_CONSOLES))
+ if ((currcons<0) || (currcons>=NR_CONSOLES))
return -EIO;
put_fs_byte((char)(video_num_lines),buf++);
put_fs_byte((char)(video_num_columns),buf++);
lp_release
};
-void lp_init(void)
+long lp_init(long kmem_start)
{
int offset = 0;
unsigned int testvalue = 0;
}
if (count == 0)
printk("lp_init: no lp devices found\n");
+ return kmem_start;
}
NULL /* no special release code */
};
-void chr_dev_init(void)
+long chr_dev_init(long kmem_start)
{
chrdev_fops[1] = &mem_fops;
- tty_init();
- lp_init();
+ kmem_start = tty_init(kmem_start);
+ kmem_start = lp_init(kmem_start);
+ return kmem_start;
}
*
* This module implements the rs232 io functions
* void rs_write(struct tty_struct * queue);
- * void rs_init(void);
+ * long rs_init(long);
* and all interrupts pertaining to serial IO.
*/
PORT_UNKNOWN,
PORT_UNKNOWN,
PORT_UNKNOWN
-};
-
+};
static void modem_status_intr(unsigned line, unsigned port, struct tty_struct * tty)
{
if ((status & 0x88) == 0x08 && tty->pgrp > 0)
kill_pg(tty->pgrp,SIGHUP,1);
-
+#if 0
if ((status & 0x10) == 0x10)
tty->stopped = 0;
else
tty->stopped = 1;
+#endif
}
/*
static void receive_intr(unsigned line, unsigned port, struct tty_struct * tty)
{
- if (FULL(tty->read_q))
- return;
-
- outb_p((inb(port+4) & 0x0d), port+4);
-
- do {
+ while (!FULL(tty->read_q)) {
+ if (!(inb(port+5) & 1))
+ break;
PUTCH(inb(port),tty->read_q);
- } while ((inb(port+5) & 0x01 != 0) && !FULL(tty->read_q));
-
- outb_p((inb(port+4) | 0x02), port+4);
-
+ };
timer_active |= (1<<(SER1_TIMER-1))<<line;
}
}
/*
- * IRQ4 normally handles com1 and com2
+ * IRQ4 normally handles com1 and com3
*/
void do_IRQ4(void)
{
sti();
}
-void rs_init(void)
+long rs_init(long kmem_start)
{
/* SERx_TIMER timers are used for receiving: timeout is always 0 (immediate) */
timer_table[SER1_TIMER].fn = com1_timer;
init(tty_table[66].read_q->data, 3);
init(tty_table[67].read_q->data, 4);
outb(inb_p(0x21)&0xE7,0x21);
+ return kmem_start;
}
/*
* Kill-line thanks to John T Kohl, who also corrected VMIN = VTIME = 0.
*/
-#include <linux/ctype.h>
#include <errno.h>
#include <signal.h>
-#include <unistd.h>
#include <fcntl.h>
#define ALRMMASK (1<<(SIGALRM-1))
#include <linux/sched.h>
#include <linux/tty.h>
+#include <linux/ctype.h>
#include <asm/io.h>
#include <asm/segment.h>
#include <asm/system.h>
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
-#define QUEUES (3*(MAX_CONSOLES+NR_SERIALS+2*NR_PTYS))
-static struct tty_queue tty_queues[QUEUES];
+#define QUEUES (3*(NR_CONSOLES+NR_SERIALS+2*NR_PTYS))
+static struct tty_queue * tty_queues;
struct tty_struct tty_table[256];
#define con_queues tty_queues
-#define rs_queues ((3*MAX_CONSOLES) + tty_queues)
-#define mpty_queues ((3*(MAX_CONSOLES+NR_SERIALS)) + tty_queues)
-#define spty_queues ((3*(MAX_CONSOLES+NR_SERIALS+NR_PTYS)) + tty_queues)
+#define rs_queues ((3*NR_CONSOLES) + tty_queues)
+#define mpty_queues ((3*(NR_CONSOLES+NR_SERIALS)) + tty_queues)
+#define spty_queues ((3*(NR_CONSOLES+NR_SERIALS+NR_PTYS)) + tty_queues)
#define con_table tty_table
#define rs_table (64+tty_table)
* these are the tables used by the machine code handlers.
* you can implement virtual consoles.
*/
-struct tty_queue * table_list[]={
- con_queues + 0, con_queues + 1,
- rs_queues + 0, rs_queues + 1,
- rs_queues + 3, rs_queues + 4,
- rs_queues + 6, rs_queues + 7,
- rs_queues + 9, rs_queues + 10
-};
+struct tty_queue * table_list[] = { NULL, NULL };
void change_console(unsigned int new_console)
{
if (I_UCLC(tty))
c=tolower(c);
if (L_CANON(tty)) {
- if ((KILL_CHAR(tty) != _POSIX_VDISABLE) &&
+ if ((KILL_CHAR(tty) != __DISABLED_CHAR) &&
(c==KILL_CHAR(tty))) {
/* deal with killing the input line */
while(!(EMPTY(tty->secondary) ||
(c=LAST(tty->secondary))==10 ||
- ((EOF_CHAR(tty) != _POSIX_VDISABLE) &&
+ ((EOF_CHAR(tty) != __DISABLED_CHAR) &&
(c==EOF_CHAR(tty))))) {
if (L_ECHO(tty)) {
if (c<32) {
}
continue;
}
- if ((ERASE_CHAR(tty) != _POSIX_VDISABLE) &&
+ if ((ERASE_CHAR(tty) != __DISABLED_CHAR) &&
(c==ERASE_CHAR(tty))) {
if (EMPTY(tty->secondary) ||
(c=LAST(tty->secondary))==10 ||
- ((EOF_CHAR(tty) != _POSIX_VDISABLE) &&
+ ((EOF_CHAR(tty) != __DISABLED_CHAR) &&
(c==EOF_CHAR(tty))))
continue;
if (L_ECHO(tty)) {
}
}
if (I_IXON(tty)) {
- if ((STOP_CHAR(tty) != _POSIX_VDISABLE) &&
+ if ((STOP_CHAR(tty) != __DISABLED_CHAR) &&
(c==STOP_CHAR(tty))) {
tty->stopped=1;
continue;
}
- if ((START_CHAR(tty) != _POSIX_VDISABLE) &&
+ if ((START_CHAR(tty) != __DISABLED_CHAR) &&
(c==START_CHAR(tty))) {
tty->stopped=0;
TTY_WRITE_FLUSH(tty);
}
}
if (L_ISIG(tty)) {
- if ((INTR_CHAR(tty) != _POSIX_VDISABLE) &&
+ if ((INTR_CHAR(tty) != __DISABLED_CHAR) &&
(c==INTR_CHAR(tty))) {
kill_pg(tty->pgrp, SIGINT, 1);
continue;
}
- if ((QUIT_CHAR(tty) != _POSIX_VDISABLE) &&
+ if ((QUIT_CHAR(tty) != __DISABLED_CHAR) &&
(c==QUIT_CHAR(tty))) {
kill_pg(tty->pgrp, SIGQUIT, 1);
continue;
}
- if ((SUSPEND_CHAR(tty) != _POSIX_VDISABLE) &&
+ if ((SUSPEND_CHAR(tty) != __DISABLED_CHAR) &&
(c==SUSPEND_CHAR(tty))) {
if (!is_orphaned_pgrp(tty->pgrp))
kill_pg(tty->pgrp, SIGTSTP, 1);
continue;
}
}
- if (c==10 || (EOF_CHAR(tty) != _POSIX_VDISABLE &&
+ if (c==10 || (EOF_CHAR(tty) != __DISABLED_CHAR &&
c==EOF_CHAR(tty)))
tty->secondary->data++;
- if ((L_ECHO(tty) || L_ECHONL(tty)) && (c==10)) {
+ if ((L_ECHO(tty) || (L_CANON(tty) && L_ECHONL(tty))) && (c==10)) {
PUTCH(10,tty->write_q);
PUTCH(13,tty->write_q);
} else if (L_ECHO(tty)) {
sti();
do {
c = GETCH(tty->secondary);
- if ((EOF_CHAR(tty) != _POSIX_VDISABLE &&
+ if ((EOF_CHAR(tty) != __DISABLED_CHAR &&
c==EOF_CHAR(tty)) || c==10)
tty->secondary->data--;
- if ((EOF_CHAR(tty) != _POSIX_VDISABLE &&
+ if ((EOF_CHAR(tty) != __DISABLED_CHAR &&
c==EOF_CHAR(tty)) && L_CANON(tty))
break;
else {
tty_release
};
-void tty_init(void)
+long tty_init(long kmem_start)
{
int i;
+ tty_queues = (struct tty_queue *) kmem_start;
+ kmem_start += QUEUES * (sizeof (struct tty_queue));
+ table_list[0] = con_queues + 0;
+ table_list[1] = con_queues + 1;
chrdev_fops[4] = &ttyx_fops;
chrdev_fops[5] = &tty_fops;
for (i=0 ; i < QUEUES ; i++)
NULL, NULL, NULL, NULL
};
}
- con_init();
+ kmem_start = con_init(kmem_start);
for (i = 0 ; i<NR_CONSOLES ; i++) {
con_table[i] = (struct tty_struct) {
{ICRNL, /* change incoming CR to NL */
spty_queues+0+i*3,spty_queues+1+i*3,spty_queues+2+i*3
};
}
- rs_init();
+ kmem_start = rs_init(kmem_start);
printk("%d virtual consoles\n\r",NR_CONSOLES);
printk("%d pty's\n\r",NR_PTYS);
+ return kmem_start;
}
* console (vt and kd) routines, as defined by usl svr4 manual
*/
-struct vt_cons vt_cons[MAX_CONSOLES];
+struct vt_cons vt_cons[NR_CONSOLES];
-extern int NR_CONSOLES;
extern unsigned char kleds;
extern unsigned char kraw;
extern unsigned char ke0;
unsigned char vc_kbdraw;
unsigned char vc_kbde0;
unsigned char vc_kbdleds;
-} vt_cons[MAX_CONSOLES];
+} vt_cons[NR_CONSOLES];
#endif /* _VT_KERN_H */
}
if (!(child->flags & PF_PTRACED) || child->state != TASK_STOPPED)
return -ESRCH;
+ if (child->p_pptr != current)
+ return -ESRCH;
switch (request) {
/* when I and D space are seperate, these will need to be fixed. */
child->flags &= ~PF_PTRACED;
child->signal=0;
child->state = 0;
+ REMOVE_LINKS(child);
+ child->p_pptr = child->p_opptr;
+ SET_LINKS(child);
/* make sure the single step bit is not set. */
tmp = get_stack_long(child, 4*EFL-MAGICNUMBER) & ~TRAP_FLAG;
put_stack_long(child, 4*EFL-MAGICNUMBER,tmp);
#include <linux/config.h>
#include <asm/segment.h>
#include <sys/times.h>
-#include <sys/utsname.h>
+#include <linux/utsname.h>
#include <sys/param.h>
#include <sys/resource.h>
#include <linux/string.h>
return 0;
}
-static struct utsname thisname = {
+static struct new_utsname thisname = {
UTS_SYSNAME, UTS_NODENAME, UTS_RELEASE, UTS_VERSION, UTS_MACHINE
};
-int sys_uname(struct utsname * name)
+int sys_newuname(struct new_utsname * name)
{
- int i;
+ if (!name)
+ return -EFAULT;
+ verify_area(name, sizeof *name);
+ memcpy_tofs(name,&thisname,sizeof *name);
+ return 0;
+}
+int sys_uname(struct old_utsname * name)
+{
if (!name)
return -EINVAL;
verify_area(name,sizeof *name);
- for(i=0;i<sizeof *name;i++)
- put_fs_byte(((char *) &thisname)[i],i+(char *) name);
+ memcpy_tofs(&name->sysname,&thisname.sysname,__OLD_UTS_LEN);
+ put_fs_byte(0,name->sysname+__OLD_UTS_LEN);
+ memcpy_tofs(&name->nodename,&thisname.nodename,__OLD_UTS_LEN);
+ put_fs_byte(0,name->nodename+__OLD_UTS_LEN);
+ memcpy_tofs(&name->release,&thisname.release,__OLD_UTS_LEN);
+ put_fs_byte(0,name->release+__OLD_UTS_LEN);
+ memcpy_tofs(&name->version,&thisname.version,__OLD_UTS_LEN);
+ put_fs_byte(0,name->version+__OLD_UTS_LEN);
+ memcpy_tofs(&name->machine,&thisname.machine,__OLD_UTS_LEN);
+ put_fs_byte(0,name->machine+__OLD_UTS_LEN);
return 0;
}
if (!suser())
return -EPERM;
- if (len > MAXHOSTNAMELEN)
+ if (len > __NEW_UTS_LEN)
return -EINVAL;
for (i=0; i < len; i++) {
if ((thisname.nodename[i] = get_fs_byte(name+i)) == 0)
- break;
- }
- if (thisname.nodename[i]) {
- thisname.nodename[i>MAXHOSTNAMELEN ? MAXHOSTNAMELEN : i] = 0;
+ return 0;
}
+ thisname.nodename[__NEW_UTS_LEN] = 0;
return 0;
}
*/
#define __LIBRARY__
-#include <unistd.h>
+#include <linux/unistd.h>
volatile void _exit(int exit_code)
{
*/
#define __LIBRARY__
-#include <unistd.h>
+#include <linux/unistd.h>
_syscall1(int,close,int,fd)
*/
#define __LIBRARY__
-#include <unistd.h>
+#include <linux/unistd.h>
_syscall1(int,dup,int,fd)
*/
#define __LIBRARY__
-#include <unistd.h>
+#include <linux/unistd.h>
_syscall3(int,execve,const char *,file,char **,argv,char **,envp)
*/
#define __LIBRARY__
-#include <unistd.h>
+#include <linux/unistd.h>
#include <sys/time.h>
_syscall2(int,getitimer,int,which,struct itimerval *,value)
*/
#define __LIBRARY__
-#include <unistd.h>
+#include <linux/unistd.h>
#include <stdarg.h>
int open(const char * filename, int flag, ...)
*/
#define __LIBRARY__
-#include <unistd.h>
+#include <sys/types.h>
+#include <linux/unistd.h>
_syscall0(pid_t,setsid)
*/
#define __LIBRARY__
-#include <unistd.h>
+#include <linux/unistd.h>
#include <sys/wait.h>
_syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
*/
#define __LIBRARY__
-#include <unistd.h>
+#include <linux/unistd.h>
+#include <sys/types.h>
_syscall3(int,write,int,fd,const char *,buf,off_t,count)
{
int i;
+ end_mem &= 0xfffff000;
+ start_mem += 0xfff;
+ start_mem &= 0xfffff000;
swap_device = 0;
swap_file = NULL;
HIGH_MEMORY = end_mem;
*
* Written by obz.
*/
-#include <sys/stat.h>
+#include <linux/stat.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/segment.h>
*/
#include <errno.h>
-#include <sys/stat.h>
+#include <linux/stat.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/sched.h>
#include <errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
+#include <linux/stat.h>
#include <asm/system.h>
#include <asm/segment.h>
#include <sys/socket.h>
-#include <sys/stat.h>
#include <fcntl.h>
#include <termios.h>
#include "kern_sock.h"
#include <linux/string.h>
#include <linux/sched.h>
#include <linux/kernel.h>
+#include <linux/stat.h>
#include <asm/system.h>
#include <asm/segment.h>
#include <sys/socket.h>
#include <sys/un.h>
-#include <sys/stat.h>
#include <fcntl.h>
#include <termios.h>
#include "kern_sock.h"