From e44e9ad26100502335296e7710a56b63b9568c04 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Mon, 6 Jun 2005 11:40:32 +0000 Subject: [PATCH] small compile fixes; initial select() stubs; release.sh script doesn't need /tmp any more since 16MB root device; increase to 3.0.5 to make new CD with working FXP driver. (not tagged 3.0.5 yet as at driver bios-copy workaround hasn't been done.) --- commands/Makefile | 2 +- commands/simple/uname.c | 8 ++++---- drivers/printer/printer.c | 6 +++--- include/minix/callnr.h | 3 ++- include/minix/config.h | 2 +- include/minix/ipc.h | 9 +++++++++ include/minix/syslib.h | 2 ++ include/sys/select.h | 37 +++++++++++++++++++++++++++++++++++++ lib/posix/Makefile | 4 ++++ lib/posix/_select.c | 18 ++++++++++++++++++ servers/fs/Makefile | 4 ++-- servers/fs/proto.h | 4 ++++ servers/fs/select.c | 16 ++++++++++++++++ servers/fs/table.c | 1 + servers/pm/table.c | 1 + tools/release.sh | 17 ----------------- 16 files changed, 105 insertions(+), 29 deletions(-) create mode 100755 include/sys/select.h create mode 100755 lib/posix/_select.c create mode 100644 servers/fs/select.c diff --git a/commands/Makefile b/commands/Makefile index ff4b6974b..10ac054de 100755 --- a/commands/Makefile +++ b/commands/Makefile @@ -29,7 +29,7 @@ all install clean: cd ftpd && $(MAKE) $@ cd ibm && $(MAKE) $@ cd kermit && $(MAKE) $@ - cd kermit_211 && $(MAKE) $@ +# cd kermit_211 && $(MAKE) $@ cd m4 && $(MAKE) $@ cd make && $(MAKE) $@ cd mined && $(MAKE) $@ diff --git a/commands/simple/uname.c b/commands/simple/uname.c index d6ab16c8e..24b37bab2 100755 --- a/commands/simple/uname.c +++ b/commands/simple/uname.c @@ -24,7 +24,7 @@ #define NODENAME ((unsigned) 0x02) #define RELEASE ((unsigned) 0x04) #define VERSION ((unsigned) 0x08) -#define MACHINE ((unsigned) 0x10) +#define U_MACHINE ((unsigned) 0x10) #define ARCH ((unsigned) 0x20) _PROTOTYPE(int main, (int argc, char **argv )); @@ -75,7 +75,7 @@ char **argv; for (p = &argv[1][1]; *p; p++) { switch (*p) { case 'a': info |= ALL; break; - case 'm': info |= MACHINE; break; + case 'm': info |= U_MACHINE; break; case 'n': info |= NODENAME; break; case 'r': info |= RELEASE; break; case 's': info |= SYSNAME; break; @@ -113,13 +113,13 @@ char **argv; print(STDOUT_FILENO, " ", (char *) NULL); print(STDOUT_FILENO, un.version, (char *) NULL); } - if ((info & MACHINE) != 0) { + if ((info & U_MACHINE) != 0) { if ((info & (SYSNAME|NODENAME|RELEASE|VERSION)) != 0) print(STDOUT_FILENO, " ", (char *) NULL); print(STDOUT_FILENO, un.machine, (char *) NULL); } if ((info & ARCH) != 0) { - if ((info & (SYSNAME|NODENAME|RELEASE|VERSION|MACHINE)) != 0) + if ((info & (SYSNAME|NODENAME|RELEASE|VERSION|U_MACHINE)) != 0) print(STDOUT_FILENO, " ", (char *) NULL); print(STDOUT_FILENO, un.arch, (char *) NULL); } diff --git a/drivers/printer/printer.c b/drivers/printer/printer.c index dd1523d4d..d9a44a848 100644 --- a/drivers/printer/printer.c +++ b/drivers/printer/printer.c @@ -55,7 +55,7 @@ */ #define ASSERT_STROBE 0x1D /* strobe a character to the interface */ #define NEGATE_STROBE 0x1C /* enable interrupt on interface */ -#define SELECT 0x0C /* select printer bit */ +#define PR_SELECT 0x0C /* select printer bit */ #define INIT_PRINTER 0x08 /* init printer bits */ /* Status bits (in port_base + 2). @@ -285,7 +285,7 @@ PRIVATE void do_initialize() sys_outb(port_base + 2, INIT_PRINTER); tickdelay(1); /* easily satisfies Centronics minimum */ /* was 2 millisecs; now is ~17 millisecs */ - sys_outb(port_base + 2, SELECT); + sys_outb(port_base + 2, PR_SELECT); sys_irqsetpolicy(PRINTER_IRQ, 0, &irq_hook_id); sys_irqenable(&irq_hook_id); @@ -332,7 +332,7 @@ PRIVATE void do_printer_output() * when the printer is busy with a previous character, because the * interrupt status does not affect the printer. */ - sys_outb(port_base + 2, SELECT); + sys_outb(port_base + 2, PR_SELECT); sys_irqenable(&irq_hook_id); return; } diff --git a/include/minix/callnr.h b/include/minix/callnr.h index 82f0f628e..45249511d 100755 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -1,4 +1,4 @@ -#define NCALLS 85 /* number of system calls allowed */ +#define NCALLS 86 /* number of system calls allowed */ #define EXIT 1 #define FORK 2 @@ -73,3 +73,4 @@ #define FSTATFS 82 /* to FS */ #define ALLOCMEM 83 /* to PM */ #define FREEMEM 84 /* to PM */ +#define SELECT 85 /* to FS */ diff --git a/include/minix/config.h b/include/minix/config.h index 51d81f7ed..df20c96a7 100755 --- a/include/minix/config.h +++ b/include/minix/config.h @@ -3,7 +3,7 @@ /* Minix release and version numbers. */ #define OS_RELEASE "3" -#define OS_VERSION "0.4" +#define OS_VERSION "0.5" /* This file sets configuration parameters for the MINIX kernel, FS, and PM. * It is divided up into two main sections. The first section contains diff --git a/include/minix/ipc.h b/include/minix/ipc.h index aa6558c08..a3a64d4e2 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -19,6 +19,7 @@ typedef struct {short m5c1, m5c2; int m5i1, m5i2; long m5l1, m5l2, m5l3;}mess_5; typedef struct {int m6i1, m6i2, m6i3; long m6l1; char *m6c1;} mess_6; #endif typedef struct {int m7i1, m7i2, m7i3, m7i4; char *m7p1, *m7p2;} mess_7; +typedef struct {int m8i1, m8i2; char *m8p1, *m8p2, *m8p3, *m8p4;} mess_8; typedef struct { int m_source; /* who sent the message */ @@ -33,6 +34,7 @@ typedef struct { mess_6 m_m6; #endif mess_7 m_m7; + mess_8 m_m8; } m_u; } message; @@ -85,6 +87,13 @@ typedef struct { #define m7_p1 m_u.m_m7.m7p1 #define m7_p2 m_u.m_m7.m7p2 +#define m8_i1 m_u.m_m8.m8i1 +#define m8_i2 m_u.m_m8.m8i2 +#define m8_p1 m_u.m_m8.m8p1 +#define m8_p2 m_u.m_m8.m8p2 +#define m8_p3 m_u.m_m8.m8p3 +#define m8_p4 m_u.m_m8.m8p4 + /*==========================================================================* * Minix run-time system (IPC). * diff --git a/include/minix/syslib.h b/include/minix/syslib.h index 972104b71..6340cfb6f 100755 --- a/include/minix/syslib.h +++ b/include/minix/syslib.h @@ -34,6 +34,8 @@ /*==========================================================================* * Minix system library. * *==========================================================================*/ +_PROTOTYPE( int printf, (const char *fmt, ...) ); +_PROTOTYPE( void kputc, (int c) ); _PROTOTYPE( int _taskcall, (int who, int syscallnr, message *msgptr) ); _PROTOTYPE( int sys_abort, (int how, ...) ); diff --git a/include/sys/select.h b/include/sys/select.h new file mode 100755 index 000000000..ba9b226d5 --- /dev/null +++ b/include/sys/select.h @@ -0,0 +1,37 @@ + +#ifndef _SYS_SELECT_H +#define _SYS_SELECT_H 1 + +#ifdef _POSIX_SOURCE + +#include +#include +#include + +/* Use this datatype as basic storage unit in fd_set */ +typedef u32_t _fdsetword; + +/* This many bits fit in an fd_set word. */ +#define _FDSETBITSPERWORD (sizeof(_fdsetword)*8) + +/* We want to store OPEN_MAX fd bits. */ +#define _FDSETWORDS ((OPEN_MAX+_FDSETBITSPERWORD-1)/_FDSETBITSPERWORD) + +/* This means we can store all of OPEN_MAX. */ +#define FD_SETSIZE OPEN_MAX + +typedef struct { + _fdsetword _fdsetval[_FDSETWORDS]; +} fd_set; + +_PROTOTYPE( int select, (int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout) ); + +_PROTOTYPE( void FD_CLR, (int fd, fd_set *fdset)); +_PROTOTYPE( void FD_ISSET, (int fd, fd_set *fdset)); +_PROTOTYPE( void FD_SET, (int fd, fd_set *fdset)); +_PROTOTYPE( void FD_ZERO, (fd_set *fdset)); + +#endif /* _POSIX_SOURCE */ + +#endif /* _SYS_SELECT_H */ + diff --git a/lib/posix/Makefile b/lib/posix/Makefile index 10171c1b4..638ac71ac 100755 --- a/lib/posix/Makefile +++ b/lib/posix/Makefile @@ -64,6 +64,7 @@ OBJECTS = \ $(LIBRARY)(_rename.o) \ $(LIBRARY)(_rewinddir.o) \ $(LIBRARY)(_rmdir.o) \ + $(LIBRARY)(_select.o) \ $(LIBRARY)(_setgid.o) \ $(LIBRARY)(_setsid.o) \ $(LIBRARY)(_setuid.o) \ @@ -270,6 +271,9 @@ $(LIBRARY)(_rewinddir.o): _rewinddir.c $(LIBRARY)(_rmdir.o): _rmdir.c $(CC1) _rmdir.c +$(LIBRARY)(_select.o): _select.c + $(CC1) _select.c + $(LIBRARY)(_setgid.o): _setgid.c $(CC1) _setgid.c diff --git a/lib/posix/_select.c b/lib/posix/_select.c new file mode 100755 index 000000000..5d4cef4f1 --- /dev/null +++ b/lib/posix/_select.c @@ -0,0 +1,18 @@ + +#include +#include + +PUBLIC int select(int nfds, + fd_set *readfds, fd_set *writefds, fd_set *errorfds, + struct timeval *timeout) +{ + message m; + + m.m8_i1 = nfds; + m.m8_p1 = (char *) readfds; + m.m8_p2 = (char *) writefds; + m.m8_p3 = (char *) errorfds; + m.m8_p4 = (char *) timeout; + + return (_syscall(FS, SELECT, &m)); +} diff --git a/servers/fs/Makefile b/servers/fs/Makefile index e6251a3b0..c62f9040f 100644 --- a/servers/fs/Makefile +++ b/servers/fs/Makefile @@ -16,7 +16,7 @@ LIBS = -lsys -lutils OBJ = main.o open.o read.o write.o pipe.o dmap.o dmp.o \ device.o path.o mount.o link.o super.o inode.o \ cache.o cache2.o filedes.o stadir.o protect.o time.o \ - cmostime.o lock.o misc.o utility.o table.o + cmostime.o lock.o misc.o utility.o select.o table.o # build local binary all build: $(SERVER) @@ -35,7 +35,7 @@ clean: # dependencies a= fs.h $h/config.h $s/types.h $h/const.h $h/type.h \ - $i/limits.h $i/errno.h $i/ansi.h $h/syslib.h $h/utils.h \ + $i/limits.h $i/errno.h $i/ansi.h $h/syslib.h \ const.h type.h proto.h glo.h $s/dir.h cache.o: $a diff --git a/servers/fs/proto.h b/servers/fs/proto.h index 92235c153..4dfec6e1f 100644 --- a/servers/fs/proto.h +++ b/servers/fs/proto.h @@ -171,3 +171,7 @@ _PROTOTYPE( void clear_zone, (struct inode *rip, off_t pos, int flag) ); _PROTOTYPE( int do_write, (void) ); _PROTOTYPE( struct buf *new_block, (struct inode *rip, off_t position) ); _PROTOTYPE( void zero_block, (struct buf *bp) ); + +/* select.c */ +_PROTOTYPE( int do_select, (void) ); + diff --git a/servers/fs/select.c b/servers/fs/select.c new file mode 100644 index 000000000..5bf065d94 --- /dev/null +++ b/servers/fs/select.c @@ -0,0 +1,16 @@ +/* Implement entry point to select system call. + * + * The entry points into this file are + * do_select: perform the SELECT system call + */ + +#include "fs.h" + +/*===========================================================================* + * do_select * + *===========================================================================*/ +PUBLIC int do_select(void) +{ + return OK; +} + diff --git a/servers/fs/table.c b/servers/fs/table.c index 76155ef30..5505bda0a 100644 --- a/servers/fs/table.c +++ b/servers/fs/table.c @@ -102,6 +102,7 @@ PUBLIC _PROTOTYPE (int (*call_vec[]), (void) ) = { do_fstatfs, /* 82 = fstatfs */ no_sys, /* 83 = memalloc */ no_sys, /* 84 = memfree */ + do_select, /* 85 = select */ }; /* This should not fail with "array size is negative": */ extern int dummy[sizeof(call_vec) == NCALLS * sizeof(call_vec[0]) ? 1 : -1]; diff --git a/servers/pm/table.c b/servers/pm/table.c index b812a10e7..8bb49cf58 100644 --- a/servers/pm/table.c +++ b/servers/pm/table.c @@ -101,6 +101,7 @@ _PROTOTYPE (int (*call_vec[NCALLS]), (void) ) = { no_sys, /* 82 = fstatfs */ do_allocmem, /* 83 = memalloc */ do_freemem, /* 84 = memfree */ + no_sys, /* 85 = select */ }; /* This should not fail with "array size is negative": */ extern int dummy[sizeof(call_vec) == NCALLS * sizeof(call_vec[0]) ? 1 : -1]; diff --git a/tools/release.sh b/tools/release.sh index ace29ed50..f822cf74e 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -21,26 +21,13 @@ echo -n "Device: /dev/" read dev || exit 1 TMPDISK=/dev/$dev -echo "Temporary (sub)partition to use for storage in /tmp?" -echo "It will be mkfsed!" -echo -n "Device: /dev/" -read tmpdev || exit 1 -TMPTMPDISK=/dev/$tmpdev - if [ -b $TMPDISK ] then : else echo "$TMPDISK is not a block device.." exit 1 fi -if [ -b $TMPTMPDISK ] -then : -else echo "$TMPDISK is not a block device.." - exit 1 -fi - umount $TMPDISK -umount $TMPTMPDISK umount $RAM ( cd .. && make clean ) @@ -51,9 +38,6 @@ echo " * mounting $RAM as $RELEASEDIR" mount $RAM $RELEASEDIR || exit mkdir -m 755 $RELEASEDIR/usr mkdir -m 1777 $RELEASEDIR/tmp -umount $TMPTMPDISK -mkfs $TMPTMPDISK || exit -mount $TMPTMPDISK $RELEASEDIR/tmp || exit 1 mkfs -B 1024 $TMPDISK || exit echo " * mounting $TMPDISK as $RELEASEDIR/usr" @@ -69,7 +53,6 @@ chroot $RELEASEDIR '/bin/sh -x /usr/src/tools/chrootmake.sh' || exit 1 echo " * Chroot build done" cp issue.install $RELEASEDIR/etc/issue umount $TMPDISK || exit -umount $TMPTMPDISK || exit umount $RAM || exit cp $RAM $ROOTIMAGE make programs image