]> git.neil.brown.name Git - history.git/commitdiff
32-bit inodes: patch4 0.96a-patch4
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:09:01 +0000 (15:09 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:09:01 +0000 (15:09 -0500)
Ok, patch4 implements 32-bit inode numbers (and thus the new
stat/lstat/fstat system calls), as well as correcting the bad
rs-performance on some machines that showed up in patch3. It's
currently only on banjo, but I'll copy it around eventually.

Again, you don't miss much if you don't use this patch: it's mainly for
(a) the serial problems and (b) for hlu etc that want to test out the
32-bit interface. It does some other magical tricks as well (uses less
memory in the low 1M region by moving the screen and tty buffer to high
memory), if anybody is interested.

            Linus

59 files changed:
.version
fs/exec.c
fs/fcntl.c
fs/inode.c
fs/ioctl.c
fs/minix/blkdev.c
fs/minix/chrdev.c
fs/minix/dir.c
fs/minix/file.c
fs/minix/inode.c
fs/minix/namei.c
fs/minix/symlink.c
fs/minix/truncate.c
fs/namei.c
fs/open.c
fs/pipe.c
fs/read_write.c
fs/select.c
fs/stat.c
fs/super.c
include/fcntl.h
include/linux/config_rel.h
include/linux/config_ver.h
include/linux/fs.h
include/linux/lp.h
include/linux/stat.h [new file with mode: 0644]
include/linux/sys.h
include/linux/tty.h
include/linux/unistd.h
include/linux/utsname.h [new file with mode: 0644]
include/signal.h
include/termios.h
include/time.h
include/unistd.h
include/utime.h
init/main.c
kernel/chr_drv/console.c
kernel/chr_drv/lp.c
kernel/chr_drv/mem.c
kernel/chr_drv/serial.c
kernel/chr_drv/tty_io.c
kernel/chr_drv/vt.c
kernel/chr_drv/vt_kern.h
kernel/ptrace.c
kernel/sys.c
lib/_exit.c
lib/close.c
lib/dup.c
lib/execve.c
lib/itimer.c
lib/open.c
lib/setsid.c
lib/wait.c
lib/write.c
mm/memory.c
mm/mmap.c
mm/swap.c
net/socket.c
net/unix.c

index f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2..8f92bfdd49766b1907d4aec8d3b0f9ed6129d0e6 100644 (file)
--- a/.version
+++ b/.version
@@ -1 +1 @@
-10
+35
index e8a58cbf903bbe9f045c8d4ef8a18d1caf2d7f24..992adc497df71ebdf2bd64504feda184efdc5088 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -20,7 +20,7 @@
 #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>
index bf2861d65bb84f9edff7c3078bfac0e3e4b77a8b..555c9017755475aa64b36301730f2373cf7de0f2 100644 (file)
@@ -7,7 +7,7 @@
 #include <errno.h>
 #include <fcntl.h>
 
-#include <sys/stat.h>
+#include <linux/stat.h>
 
 #include <asm/segment.h>
 
index 1f144c61212991aa2ad6fbef7e617d255a2bffb2..24c5316c941a4614b117895b32c771e325904b92 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #include <linux/string.h>
-#include <sys/stat.h>
+#include <linux/stat.h>
 
 #include <linux/sched.h>
 #include <linux/kernel.h>
index 7b2811674620a67397632c66eaafd6fb79831f75..7aedb2488910d4f5b3b836447a59be9976636820 100644 (file)
@@ -6,8 +6,8 @@
 
 #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)
index a70b513c769dc317c9040f728495b0f03872ce24..eec544d8a1813f97fb35bdef7f41fae8cab7ddf5 100644 (file)
@@ -7,10 +7,10 @@
 #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
index 8957eb4ad1d19077f464a8536e5dc2c43c4ceed2..da7e9fcf08170a7193928d633ba9a199df4ef311 100644 (file)
@@ -7,10 +7,10 @@
 #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
index 467d227cd11192bd98bc3f83db68a83c9f22abd8..bfa355123628d09dda2283aa3a38be21dd2878d5 100644 (file)
@@ -8,12 +8,11 @@
 
 #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);
 
index 7b6e033c58e92d3f8bd9225c8aeaee3943241524..6c6bf754a8010a3dcdfa02805f07be072388b223 100644 (file)
@@ -10,7 +10,6 @@
 #include <fcntl.h>
 
 #include <sys/dirent.h>
-#include <sys/stat.h>
 
 #include <asm/segment.h>
 #include <asm/system.h>
@@ -18,6 +17,7 @@
 #include <linux/sched.h>
 #include <linux/minix_fs.h>
 #include <linux/kernel.h>
+#include <linux/stat.h>
 
 #define        NBUF    16
 
index f52874353974b09671ac41094dbb0140482d1b55..485295ebf240576311325eb0dfebd52eab432fe8 100644 (file)
@@ -5,8 +5,7 @@
  */
 
 #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>
index 8682e9cedbfcf68df537c2636e2b1c0356e718bf..4df81df9ee14fde32e916c0216f3076d7c418ec2 100644 (file)
@@ -7,13 +7,13 @@
 #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
index 0b5c5dc5b5eb5f6db4cdb9eb91aa43528762cbd6..1f99b07f33f70eeac67c2f71d4852f8d8733a1c1 100644 (file)
@@ -8,13 +8,12 @@
 
 #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 *);
index 215daf36663aab1e37e6a1400b69e016c6de9f65..9b35e05669fd75df3e1fd613c96e229c7d7f249f 100644 (file)
@@ -7,10 +7,10 @@
 #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
index eccb04cea0e19ffdae75307b0805b4edebde3a6a..ef5131a6904fe58e7543d502ad0fa89e513f756f 100644 (file)
@@ -16,7 +16,7 @@
 #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);
index 33e395703b3a10679672e0dde28efe442f8a6254..8aef2fb9d8dc91736716fa96f8f7004cb3ce306a 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -9,9 +9,9 @@
 #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>
@@ -141,8 +141,8 @@ int sys_access(const char * filename,int mode)
        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;
        /*
index a3f48cd39f6e68deb98bf0027b6f99b3c55f92fe..c50895767a546a2f20d63484e99de2b9010f8f89 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -150,6 +150,7 @@ int sys_pipe(unsigned long * fildes)
        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)
index b28d7e7eeca403f82db1de6120b6fa673cff52e9..91d4bfa8d7a7ecfa3ecee9333f1c6910efb11a27 100644 (file)
@@ -6,9 +6,9 @@
 
 #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>
index efd65491958575209232b320c32f779dad079ca2..de2d1a3c34ebad9ec81763208a852fb0bd446226 100644 (file)
 #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>
 
index 029ec2ff7bf97fc83c5753ccdb07508e6a2e20fd..a169de55da6d5e25e4d74daa01542014f42ca200 100644 (file)
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -5,19 +5,20 @@
  */
 
 #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;
@@ -29,40 +30,91 @@ static void cp_stat(struct inode * inode, struct stat * statbuf)
        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;
 }
 
index 78f8b6c0a4ceaa35bd05d30d96241adfbc32a66d..a3b6802f41ea5a191bf1cd704981e66d74af4102 100644 (file)
 #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);
index 4bc0c10cf2b00cab186392ed064e02533d93b7d4..6d4bc22edf57edc79596a2f02c820bdacd604125 100644 (file)
@@ -48,8 +48,16 @@ struct flock {
        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
index e1998799de1161d893c225f9a4d714ea7ba72645..21d9dd837f42c017ebc78d8b480030e3401b65d6 100644 (file)
@@ -1 +1 @@
-#define UTS_RELEASE "0.96a-10"
+#define UTS_RELEASE "0.96a-35"
index dde55d7a44879db039460ac08ee73f96b99d7775..e80b945a70d5e1a8183613deeb0f2deac69545ae 100644 (file)
@@ -1 +1 @@
-#define UTS_VERSION "05/22/92"
+#define UTS_VERSION "06/17/92"
index 329f8ac78552f4504f4d130481548ea48dcfa66b..639f458218c1d0c7c8dc3060724a44a9b5f69a48 100644 (file)
@@ -88,17 +88,17 @@ struct buffer_head {
 };
 
 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;
index dd92cf09d541b1b5712bb8b409ed12e2aed37f04..785b17d178a830e46c5fb3f143cedbb965818286 100644 (file)
@@ -100,4 +100,4 @@ struct lp_struct lp_table[] = {
  * function prototypes
  */
 
-extern void lp_init(void);
+extern long lp_init(long);
diff --git a/include/linux/stat.h b/include/linux/stat.h
new file mode 100644 (file)
index 0000000..2e11b1c
--- /dev/null
@@ -0,0 +1,76 @@
+#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
index 79640f1c736220ea4e5b5e69e80d6d05e2ed9017..b3c2e3395aa95ee5b786a2a2eb9d65d94a137deb 100644 (file)
@@ -108,6 +108,10 @@ extern int sys_socketcall();
 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,
@@ -128,7 +132,8 @@ sys_select, sys_symlink, sys_lstat, sys_readlink, sys_uselib,
 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);
index 82dd517e845e667ab3acf24c008162aecd08ae5e..91c08d6849279533ae01ca5efda26f7062fcb3b5 100644 (file)
 
 #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>
 
@@ -173,10 +178,10 @@ extern unsigned long video_num_lines;
 */
 #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);
 
index a9e850100f5ae48e0aedeacc448353562a856a83..d741dfc0c48ac3c6c9a25f7e69052017293a2932 100644 (file)
@@ -24,7 +24,7 @@
 #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
@@ -34,7 +34,7 @@
 #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
@@ -65,7 +65,7 @@
 #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
@@ -90,7 +90,7 @@
 #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) \
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
new file mode 100644 (file)
index 0000000..4efd512
--- /dev/null
@@ -0,0 +1,24 @@
+#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
index 91df52e020df5f5e68732f48b63e9cd95b94e5b6..00ef5683f3534f99ef8305edef17f22f3e1cd836 100644 (file)
@@ -80,6 +80,10 @@ struct sigaction {
        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);
@@ -93,4 +97,8 @@ int sigprocmask(int how, sigset_t *set, sigset_t *oldset);
 int sigsuspend(sigset_t *sigmask);
 int sigaction(int sig, struct sigaction *act, struct sigaction *oldact);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _SIGNAL_H */
index 740f3d8b3f1b7d6b7ec2e00c9ec364666aa02609..42410aff694bc9a13c3618e6d07dc8f2a6c655a7 100644 (file)
@@ -211,6 +211,10 @@ struct termios {
 #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);
@@ -223,4 +227,8 @@ extern int tcsendbreak(int fildes, int duration);
 extern int tcsetattr(int fildes, int optional_actions,
        struct termios *termios_p);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
index f7e7ba1982ee4cf18c509d21307fc441c9d89d04..fa096d9d40c60c66145841d540ec63a3deaad629 100644 (file)
@@ -34,6 +34,10 @@ struct tm {
 #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);
@@ -46,4 +50,8 @@ struct tm *localtime(const time_t * tp);
 size_t strftime(char * s, size_t smax, const char * fmt, const struct tm * tp);
 void tzset(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
index e7a1c6ed9e655a05d2fd0caa9c44f8263adf51b7..041977bba3a77fdcd0f5d5c1e6675b2176cdd57f 100644 (file)
 /* 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
@@ -152,4 +156,9 @@ int setgroups(int gidsetlen, gid_t *gidset);
 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
index 83f07c7bbfe72a5807214c0c0b3ffc5ece519e04..a7b79b3300e169993a8f95c6dabd1bc7004cbfed 100644 (file)
@@ -8,6 +8,14 @@ struct utimbuf {
        time_t modtime;
 };
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern int utime(const char *filename, struct utimbuf *times);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
index 839161a0df968d29a8072ff81a0fabfe9c95e37b..80bbe0fad221c2bd9c8c8fb58d6b0329abf661c3 100644 (file)
@@ -53,7 +53,7 @@ static char printbuf[1024];
 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);
@@ -165,11 +165,11 @@ void start_kernel(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);
index 746692c382c3a67841916ea6d3e9eceb2815d727..9092aae9379afcce7867c2673fc383f879c2ba4a 100644 (file)
@@ -8,7 +8,7 @@
  *     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.
  *
@@ -77,8 +77,6 @@
 
 #define NPAR 16
 
-int NR_CONSOLES = 0;
-
 extern void vt_init(void);
 extern void keyboard_interrupt(void);
 extern void set_leds(void);
@@ -124,12 +122,12 @@ static struct {
        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)
@@ -577,7 +575,7 @@ void con_write(struct tty_struct * tty)
 
        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;
        }
@@ -867,7 +865,7 @@ return s;
 }
 
 /*
- *  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
@@ -876,7 +874,7 @@ return s;
  * 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 = "????";
@@ -886,11 +884,14 @@ void con_init(void)
        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) {
@@ -947,13 +948,7 @@ void con_init(void)
        
        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;
@@ -978,14 +973,14 @@ void con_init(void)
         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;   
        
@@ -1002,6 +997,7 @@ void con_init(void)
        a=inb_p(0x61);
        outb_p(a|0x80,0x61);
        outb_p(a,0x61);
+       return kmem_start;
 }
 
 void kbdsave(int new_console)
@@ -1108,7 +1104,7 @@ int do_screendump(int arg)
 
        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++);
index ed56ce15fbfaf5d3194eccac26914c59f817fa53..4643c27135e8affcf1d4253eb2e70daf899943e3 100644 (file)
@@ -122,7 +122,7 @@ static struct file_operations lp_fops = {
        lp_release
 };
 
-void lp_init(void)
+long lp_init(long kmem_start)
 {
        int offset = 0;
        unsigned int testvalue = 0;
@@ -145,4 +145,5 @@ void lp_init(void)
        }
        if (count == 0)
                printk("lp_init: no lp devices found\n");
+       return kmem_start;
 }
index db53a8ebaf4714d95472fc8aed70a4d556bfdf6b..1432c8493e78ba8bfe49ab8d5120d5e057436622 100644 (file)
@@ -241,9 +241,10 @@ static struct file_operations mem_fops = {
        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;
 }
index f0bb6527cd4d54117cb96ccef64e70534b8d8d53..b9113a367be5f9ef131bacb6ed459d2a637b2bbd 100644 (file)
@@ -9,7 +9,7 @@
  *
  * 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.
  */
 
@@ -39,8 +39,7 @@ int port_table[] = {
        PORT_UNKNOWN,
        PORT_UNKNOWN,
        PORT_UNKNOWN
-};
-       
+};     
 
 static void modem_status_intr(unsigned line, unsigned port, struct tty_struct * tty)
 {
@@ -48,11 +47,12 @@ static void modem_status_intr(unsigned line, unsigned port, struct tty_struct *
 
        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
 }
 
 /*
@@ -89,17 +89,11 @@ static void send_intr(unsigned line, unsigned port, struct tty_struct * tty)
 
 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;
 }
 
@@ -145,7 +139,7 @@ void do_IRQ3(void)
 }
 
 /*
- * IRQ4 normally handles com1 and com2
+ * IRQ4 normally handles com1 and com3
  */
 void do_IRQ4(void)
 {
@@ -291,7 +285,7 @@ void serial_open(unsigned line)
        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;
@@ -318,6 +312,7 @@ void rs_init(void)
        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;
 }
 
 /*
index e5cb171932223b7966fe6de3d37657489d9aed68..f2b88dfa3d743191e73d3e8db78b7f6556981197 100644 (file)
  * 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)
@@ -58,13 +57,7 @@ struct tty_struct * redirect = NULL;
  * 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)
 {
@@ -121,12 +114,12 @@ void copy_to_cooked(struct tty_struct * tty)
                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) {
@@ -143,11 +136,11 @@ void copy_to_cooked(struct tty_struct * tty)
                                }
                                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)) {
@@ -166,12 +159,12 @@ void copy_to_cooked(struct tty_struct * 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);
@@ -179,27 +172,27 @@ void copy_to_cooked(struct tty_struct * 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)) {
@@ -311,10 +304,10 @@ static int read_chan(unsigned int channel, struct file * file, char * buf, int n
                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 {
@@ -543,10 +536,14 @@ static struct file_operations ttyx_fops = {
        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++)
@@ -566,7 +563,7 @@ void tty_init(void)
                        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 */
@@ -637,7 +634,8 @@ void tty_init(void)
                        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;
 }
index 051460172c457fa798f725341f71dcc36989695a..d026a41edc9bd6ed9c10bc38d72e79fa43eb228d 100644 (file)
@@ -24,9 +24,8 @@
  * 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;
index 2c7116cb7d4dc56c704f5bcbfa8a667e4ba1d659..5d72a3a3164f1c948c20f8f811af7a699b4a5e88 100644 (file)
@@ -10,6 +10,6 @@ extern struct vt_cons {
        unsigned char   vc_kbdraw;
        unsigned char   vc_kbde0;
        unsigned char   vc_kbdleds;
-} vt_cons[MAX_CONSOLES];
+} vt_cons[NR_CONSOLES];
 
 #endif /* _VT_KERN_H */
index 7b6905d4f3df53f776c71e37aec978e297acb656..8e1fd2542b5ceb5482ac7ad9c3f9e51ee0af0a3b 100644 (file)
@@ -260,6 +260,8 @@ int sys_ptrace(long request, long pid, long addr, long data)
        }
        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. */
@@ -354,6 +356,9 @@ int sys_ptrace(long request, long pid, long addr, long data)
                        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);
index 75a86ba18d7ed30062c1cb7e2873588135622cc1..bb086fa95a37be51fc00e6460aa9a1ee8a741df7 100644 (file)
@@ -12,7 +12,7 @@
 #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>
@@ -443,19 +443,34 @@ int in_group_p(gid_t grp)
        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;
 }
 
@@ -468,15 +483,13 @@ int sys_sethostname(char *name, int len)
        
        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;
 }
 
index ac48d1aaf7b9d69ee08299a7ef7b65aafa32c590..4b1985a995da2004ef7a59e1a1d3dcda7c133900 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #define __LIBRARY__
-#include <unistd.h>
+#include <linux/unistd.h>
 
 volatile void _exit(int exit_code)
 {
index 3ef965d0c52e117fc1896399b0a344d702b5f66d..31bb780f6d0d8ab692b5f84027c57ff57970ebf1 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #define __LIBRARY__
-#include <unistd.h>
+#include <linux/unistd.h>
 
 _syscall1(int,close,int,fd)
 
index 495c6e3c5c0db8b20c1ad94c99698d6016086326..fddb3c3911c09b13c4fc2feee6465df0e71ed98c 100644 (file)
--- a/lib/dup.c
+++ b/lib/dup.c
@@ -5,7 +5,7 @@
  */
 
 #define __LIBRARY__
-#include <unistd.h>
+#include <linux/unistd.h>
 
 _syscall1(int,dup,int,fd)
 
index 7669b50d3f329a73a8a8439c54ce9653fb60d31b..996b0eae81ebef1c45dbef8f470fdb22621f3b57 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #define __LIBRARY__
-#include <unistd.h>
+#include <linux/unistd.h>
 
 _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
 
index 9692eeb7359e6c9e2f19243e9cbeb99d6ab752f7..69cf1eb2c1b44eedd3b109dcbd8f1fe81536402b 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #define __LIBRARY__
-#include <unistd.h>
+#include <linux/unistd.h>
 #include <sys/time.h>
 
 _syscall2(int,getitimer,int,which,struct itimerval *,value)
index 59728071612b0dab50e2c60adf9dee18f09e7848..55c82ece60c88f81aa888f608509126a6f51feea 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #define __LIBRARY__
-#include <unistd.h>
+#include <linux/unistd.h>
 #include <stdarg.h>
 
 int open(const char * filename, int flag, ...)
index 601fcfc3e0ec3566edad4800ee18b12d4f0b6204..f9f056f15b1f5b3899bc382b7a4c57e32226db57 100644 (file)
@@ -5,7 +5,8 @@
  */
 
 #define __LIBRARY__
-#include <unistd.h>
+#include <sys/types.h>
+#include <linux/unistd.h>
 
 _syscall0(pid_t,setsid)
 
index e02dfdf64ee1717a844da5b8793f200bce8412a9..114ef331a763900325103ce7589b93ae838a8b5c 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #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)
index 69d4ab37461694ac5907fd7ac9e20d9931c04e6a..5269cc68607326d2fb67c0b2de68b02e04e30a5e 100644 (file)
@@ -5,7 +5,8 @@
  */
 
 #define __LIBRARY__
-#include <unistd.h>
+#include <linux/unistd.h>
+#include <sys/types.h>
 
 _syscall3(int,write,int,fd,const char *,buf,off_t,count)
 
index 1417bc9c7a45cb51364cf0a0ea7b31a850a980b5..801dd15e8244caa25027e211a6cfe4ea3a9a0205 100644 (file)
@@ -716,6 +716,9 @@ void mem_init(long start_mem, long end_mem)
 {
        int i;
 
+       end_mem &= 0xfffff000;
+       start_mem += 0xfff;
+       start_mem &= 0xfffff000;
        swap_device = 0;
        swap_file = NULL;
        HIGH_MEMORY = end_mem;
index a8ea62805d3ab6a839d26ee8c8928b6508567b28..ae1fd664ba5d42a106b938fe65609f2be098920b 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3,7 +3,7 @@
  *
  * Written by obz.
  */
-#include <sys/stat.h>
+#include <linux/stat.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <asm/segment.h>
index fa933e3eafeb0a54a3054ef9c907130220e99e4d..f968e0518b5396e7b683567dae67d7614db849de 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -10,8 +10,8 @@
  */
 
 #include <errno.h>
-#include <sys/stat.h>
 
+#include <linux/stat.h>
 #include <linux/mm.h>
 #include <linux/string.h>
 #include <linux/sched.h>
index 70472b5695422204974f4b8775a19a5225bbde18..b5ba72ecd1161d1a350f0cf6a70b58c4a5a0b1b8 100644 (file)
@@ -2,10 +2,10 @@
 #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"
index 441d7097c32c5fb10ffd20231cc42b9479c8db73..4abe7902203de281795ec81e01e73be2dd31a549 100644 (file)
@@ -3,11 +3,11 @@
 #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"