ls -l$flag $* | \
sed -e '/^total/d' \
+ -e '/^l/d' \
-e '/^[^bc]/s/.* /BAD BAD /' \
-e '/^[bc]/s/.* \([0-9][0-9]*\), *\([0-9][0-9]*\).* /\1 \2 /' \
| {
;;
1,3) des="null device, data sink" dev=null
;;
+ 1,4) des="boot device loaded from boot image" dev=boot
+ ;;
+ 1,5) des="null byte stream generator" dev=zero
+ ;;
+ 1,6) des="boot image RAM disk" dev=imgrd
+ ;;
+ 1,[789]|1,1[012])
+ ramdisk=`expr $minor - 7`
+ des="RAM disk $ramdisk" dev=ram$ramdisk
+ ;;
2,*) drive=`expr $minor % 4`
case `expr $minor - $drive` in
0) des='auto density' dev="fd$drive"
line=`expr $minor - 16`
des="serial line $line" dev=tty0$line
;;
+ 4,125) des="video output" dev=video
+ ;;
+ 4,126) des="auxiliary input" dev=kbdaux
+ ;;
+ 4,127) des="keyboard input" dev=kbd
+ ;;
4,12[89]|4,1[3-8]?|4,19[01])
p=`expr \\( $minor - 128 \\) / 16 | tr '0123' 'pqrs'`
n=`expr $minor % 16`
d=`expr $minor % 8`
n=`expr $minor / 8`
case $d in
- 0) case $name in
+ 0) des="IP stat" dev=ipstat
+ ;;
+ 1) case $name in
psip*)
des="Pseudo IP #$n" dev=psip
;;
*) des="raw ethernet #$n" dev=eth
esac
;;
- 1) des="raw IP #$n" dev=ip
+ 2) des="raw IP #$n" dev=ip
;;
- 2) des="TCP/IP #$n" dev=tcp
+ 3) des="TCP/IP #$n" dev=tcp
;;
- 3) des="UDP #$n" dev=udp
+ 4) des="UDP #$n" dev=udp
esac
case $d in
[0123])
fi
esac
;;
+ 11,0)
+ des="block filter" dev=filter
+ ;;
13,0)
des="audio" dev=audio
;;
14,0)
des="audio mixer" dev=mixer
;;
+ 15,0)
+ des="kernel log" dev=klog
+ ;;
+ 16,0)
+ des="pseudo random number generator" dev=urandom
+ ;;
BAD,BAD)
des= dev=
;;
ttypa ttypb ttypc ttypd ttype ttypf \
ttyq0 ttyq1 ttyq2 ttyq3 ttyq4 ttyq5 ttyq6 ttyq7 ttyq8 ttyq9 \
ttyqa ttyqb ttyqc ttyqd ttyqe ttyqf \
- eth klog random rescue filter
+ eth klog random filter
;;
0:|1:-\?)
cat >&2 <<EOF
random # Make /dev/random, /dev/urandom
kbd # Make /dev/kbd
kbdaux # Make /dev/kbdaux
- rescue # Make /dev/rescue
filter # Make /dev/filter
video # Make /dev/video
std # All standard devices
$e mknod urandom c 16 0; $e chmod 644 urandom
$e chgrp operator random urandom
;;
- rescue)
- # rescue device
- $e mknod rescue b 9 0
- $e chmod 644 rescue
- ;;
klog)
# logging device.
$e mknod klog c 15 0
/usr/bin/binsizes \
/usr/bin/datasizes \
/usr/bin/rotate \
- /usr/bin/floppysetup \
/usr/bin/packit \
/usr/bin/packman \
/usr/bin/poweroff \
/usr/bin/mkdist: mkdist.sh
install -m 755 -c -o bin $? $@
-/usr/bin/floppysetup: floppysetup.sh
- install -m 755 -c -o bin $? $@
-
/usr/bin/rotate: rotate.sh
install -m 755 -c -o bin $? $@
+++ /dev/null
-#!/bin/sh
-#
-# setup 4.1 - install a Minix distribution Author: Kees J. Bot
-# 20 Dec 1994
-
-PATH=/bin:/usr/bin
-export PATH
-
-usage()
-{
- cat >&2 <<'EOF'
-Usage: setup # Install a skeleton system on the hard disk.
- setup /usr # Install the rest of the system (binaries or sources).
-
- # To install from other things then floppies:
-
- urlget http://... | setup /usr # Read from a web site.
- urlget ftp://... | setup /usr # Read from an FTP site.
- mtools copy c0d0p0:... - | setup /usr # Read from the C: drive.
- dosread c0d0p0 ... | setup /usr # Likewise if no mtools.
-EOF
- exit 1
-}
-
-# No options.
-while getopts '' opt; do usage; done
-shift `expr $OPTIND - 1`
-
-# Installing a floppy set?
-case $# in
-0) # No, we're installing a skeleton system on the hard disk.
- ;;
-1)
- cd "$1" || exit
-
- # Annoying message still there?
- grep "'setup /usr'" /etc/issue >/dev/null 2>&1 && rm -f /etc/issue
-
- if [ -t 0 ]
- then
- size=bad
- while [ "$size" = bad ]
- do
- echo -n "\
-What is the size of the images on the diskettes? [all] "; read size
-
- case $size in
- ''|360|720|1200|1440)
- ;;
- *) echo "Sorry, I don't believe \"$size\", try again." >&2
- size=bad
- esac
- done
-
- drive=
- while [ -z "$drive" ]
- do
- echo -n "What floppy drive to use? [0] "; read drive
-
- case $drive in
- '') drive=0
- ;;
- [01])
- ;;
- *) echo "It must be 0 or 1, not \"$drive\"."
- drive=
- esac
- done
-
- vol -r $size /dev/fd$drive | uncompress | tar xvfp -
- else
- # Standard input is where we can get our files from.
- uncompress | tar xvfp -
- fi
-
- echo Done.
- exit
- ;;
-*)
- usage
-esac
-
-# Installing Minix on the hard disk.
-# Must be in / or we can't mount or umount.
-if [ ! -f /CD ]
-then
- case "`pwd`" in
- /?*)
- echo "Please type 'cd /' first, you are locking up `pwd`" >&2
- exit 1
- esac
-fi
-
-case "$0" in
-/tmp/*)
- rm -f "$0"
- ;;
-*) cp -p "$0" /tmp/setup
- exec /tmp/setup
-esac
-
-# Find out what we are running from.
-exec 9<&0 </etc/mtab # Mounted file table.
-read thisroot rest # Current root (/dev/ram or /dev/fd?)
-read fdusr rest # USR (/dev/fd? or /dev/fd?p2)
-exec 0<&9 9<&-
-
-# What do we know about ROOT?
-case $thisroot:$fdusr in
-/dev/ram:/dev/fd0p2) fdroot=/dev/fd0 # Combined ROOT+USR in drive 0
- ;;
-/dev/ram:/dev/fd1p2) fdroot=/dev/fd1 # Combined ROOT+USR in drive 1
- ;;
-/dev/ram:/dev/fd*) fdroot=unknown # ROOT is some other floppy
- ;;
-/dev/fd*:/dev/fd*) fdroot=$thisroot # ROOT is mounted directly
- ;;
-*) fdroot=$thisroot # ?
- if [ -f /CD ]
- then
- :
- else
- echo -n "\
-It looks like Minix has been installed on disk already. Are you sure you
-know what you are doing? [n] "
- read yn
- case "$yn" in
- [yY]*|sure) ;;
- *) exit
- esac
- fi
-esac
-
-echo -n "\
-This is the Minix installation script.
-
-Note 1: If the screen blanks suddenly then hit CTRL+F3 to select \"software
- scrolling\".
-
-Note 2: If things go wrong then hit DEL and start over.
-
-Note 3: The installation procedure is described in the manual page
- usage(8). It will be hard without it.
-
-Note 4: Some questions have default answers, like this: [y]
- Simply hit RETURN (or ENTER) if you want to choose that answer.
-
-Note 5: If you see a colon (:) then you should hit RETURN to continue.
-:"
-read ret
-
-echo "
-What type of keyboard do you have? You can choose one of:
-"
-ls -C /usr/lib/keymaps | sed -e 's/\.map//g' -e 's/^/ /'
-echo -n "
-Keyboard type? [us-std] "; read keymap
-test -n "$keymap" && loadkeys "/usr/lib/keymaps/$keymap.map"
-
-echo -n "
-Minix needs one primary partition of at about 210 MB for a full install
-with sources. (The full install also fits in about 180 MB, but it
-needs more if fully recompiled. Add more space to taste.)
-
- * Minix currently only understands filesystems up to 4GB, so don't make
- it bigger.
-
-If there is no free space on your disk then you have to back up one of the
-other partitions, shrink, and reinstall. See the appropriate manuals of the
-the operating systems currently installed. Restart your Minix installation
-after you have made space.
-
-To make this partition you will be put in the editor \"part\". Follow the
-advice under the '!' key to make a new partition of type MINIX. Do not
-touch an existing partition unless you know precisely what you are doing!
-Please note the name of the partition (e.g. c0d0p1, c0d1p3, c1d1p0) you
-make. (See the devices section in usage(8) on Minix device names.)
-:"
-read ret
-
-primary=
-while [ -z "$primary" ]
-do
- part || exit
-
- echo -n "
-Please finish the name of the primary partition you have created:
-(Just type RETURN if you want to rerun \"part\") /dev/"
- read primary
-done
-
-root=${primary}s0
-swap=${primary}s1
-usr=${primary}s2
-
-hex2int()
-{
- # Translate hexadecimal to integer.
- local h d i
-
- h=$1
- i=0
- while [ -n "$h" ]
- do
- d=$(expr $h : '\(.\)')
- h=$(expr $h : '.\(.*\)')
- d=$(expr \( 0123456789ABCDEF : ".*$d" \) - 1)
- i=$(expr $i \* 16 + $d)
- done
- echo $i
-}
-
-# Ask user about networking
-echo ""
-echo "Minix currently supports the Intel Pro/100 and RealTek 8139 "
-echo "Ethernet cards. Please choose: "
-echo ""
-echo "0. No Ethernet card (no networking)"
-echo "1. An Intel Pro/100 Ethernet card is installed"
-echo "2. A Realtek 8139 Ethernet card is installed"
-echo "3. A different Ethernet card is installed (no networking)"
-echo ""
-echo "You can always change your mind after the install."
-echo ""
-echo "Choice? "
-read eth
-driver=""
-inetparams=""
-case "$eth" in
- 1) driver=FXP; inetparams="servers=inet;" ;;
- 2) driver=RTL8139; inetparams="servers=inet;" ;;
-esac
-
-# Compute the amount of memory available to Minix.
-memsize=0
-ifs="$IFS"
-IFS=','
-set -- $(sysenv memory)
-IFS="$ifs"
-
-for mem
-do
- mem=$(expr $mem : '.*:\(.*\)')
- memsize=$(expr $memsize + $(hex2int $mem) / 1024)
-done
-
-# Compute an advised swap size.
-swapadv=0
-case `arch` in
-i86)
- test $memsize -lt 4096 && swapadv=$(expr 4096 - $memsize)
- ;;
-*) test $memsize -lt 6144 && swapadv=$(expr 6144 - $memsize)
-esac
-
-echo -n "
-How much swap space would you like? Swapspace is only needed if this
-system is memory starved, like a 16-bit system with less then 2M, or a
-32-bit system with less then 4M. Minix swapping isn't very good yet, so
-there is no need for it otherwise.
- Size in kilobytes? [$swapadv] "
-swapsize=
-read swapsize
-test -z "$swapsize" && swapsize=$swapadv
-
-echo -n "
-You have created a partition named: /dev/$primary
-The following subpartitions are about to be created on /dev/$primary:
-
- Root subpartition: /dev/$root 16 MB
- Swap subpartition: /dev/$swap $swapsize kb
- /usr subpartition: /dev/$usr rest of $primary
-
-Hit return if everything looks fine, or hit DEL to bail out if you want to
-think it over. The next step will destroy /dev/$primary.
-:"
-read ret
- # Secondary master bootstrap.
-installboot -m /dev/$primary /usr/mdec/masterboot >/dev/null || exit
-
- # Partition the primary.
-p3=0:0
-test "$swapsize" -gt 0 && p3=81:`expr $swapsize \* 2`
-partition /dev/$primary 1 81:32768* $p3 81:0+ || exit
-
-if [ "$swapsize" -gt 0 ]
-then
- # We must have that swap, now!
- mkswap -f /dev/$swap || exit
- mount -s /dev/$swap || exit
-else
- # Forget about swap.
- swap=
-fi
-
-echo "
-Migrating to disk...
-"
-
-mkfs /dev/$usr
-echo "\
-Scanning /dev/$usr for bad blocks. (Hit DEL to stop the scan if you are
-absolutely sure that there can not be any bad blocks. Otherwise just wait.)"
-trap ': nothing' 2
-readall -b /dev/$usr | sh
-sleep 2
-trap 2
-
-mount /dev/$usr /mnt || exit # Mount the intended /usr.
-
-cpdir -v /usr /mnt || exit # Copy the usr floppy.
-
-umount /dev/$usr || exit # Unmount the intended /usr.
-
-umount $fdusr # Unmount the /usr floppy.
-
-mount /dev/$usr /usr || exit # A new /usr
-
-if [ $fdroot = unknown ]
-then
- echo "
-By now the floppy USR has been copied to /dev/$usr, and it is now in use as
-/usr. Please insert the installation ROOT floppy in a floppy drive."
-
- drive=
- while [ -z "$drive" ]
- do
- echo -n "What floppy drive is it in? [0] "; read drive
-
- case $drive in
- '') drive=0
- ;;
- [01])
- ;;
- *) echo "It must be 0 or 1, not \"$drive\"."
- drive=
- esac
- done
- fdroot=/dev/fd$drive
-fi
-
-echo "
-Copying $fdroot to /dev/$root
-"
-
-mkfs /dev/$root || exit
-mount /dev/$root /mnt || exit
-if [ -d /boot ]
-then
- # Running from the floppy itself (or installation CD).
- cpdir -vx / /mnt || exit
- chmod 555 /mnt/usr
-else
- # Running from the RAM disk, root image is on a floppy.
- mount $fdroot /root || exit
- cpdir -v /root /mnt || exit
- umount $fdroot || exit
- cpdir -f /dev /mnt/dev # Copy any extra MAKEDEV'd devices
-fi
-
-# CD remnants that aren't for the installed system
-rm /mnt/etc/issue /mnt/CD 2>/dev/null
- # Change /etc/fstab.
-echo >/mnt/etc/fstab "\
-# Poor man's File System Table.
-
-root=/dev/$root
-${swap:+swap=/dev/$swap}
-usr=/dev/$usr"
-
- # National keyboard map.
-test -n "$keymap" && cp -p "/usr/lib/keymaps/$keymap.map" /mnt/etc/keymap
-
-# Set inet.conf to correct driver
-if [ -n "$driver" ]
-then echo "eth0 $driver 0 { default; };" >/mnt/etc/inet.conf
-fi
-
-umount /dev/$root || exit # Unmount the new root.
-
-# Compute size of the second level file block cache.
-case `arch` in
-i86)
- cache=`expr "0$memsize" - 1024`
- test $cache -lt 32 && cache=0
- test $cache -gt 512 && cache=512
- ;;
-*)
- cache=`expr "0$memsize" - 2560`
- test $cache -lt 64 && cache=0
- test $cache -gt 1024 && cache=1024
-esac
-echo "Second level file system block cache set to $cache kb."
-if [ $cache -eq 0 ]; then cache=; else cache="ramsize=$cache"; fi
-
- # Make bootable.
-installboot -d /dev/$root /usr/mdec/bootblock /boot/boot >/dev/null || exit
-edparams /dev/$root "rootdev=$root; ramimagedev=$root; $cache; $inetparams; save" || exit
-pfile="/usr/src/tools/fdbootparams"
-echo "Remembering boot parameters in ${pfile}."
-echo "rootdev=$root; ramimagedev=$root; $cache; save" >$pfile || exit
-sync
-
-echo "
-Please type 'halt' to exit Minix.
-You can type 'boot $primary' to try the newly installed Minix system. See
-\"TESTING\" in the usage manual."
-
bin/mkdir
bin/mkfs
bin/mknod
-bin/mkswap
bin/mv
bin/od
bin/part
# CD remnants that aren't for the installed system
rm /mnt/etc/issue /mnt/CD /mnt/.* 2>/dev/null
- # Change /etc/fstab. (No swap.)
- # ${swap:+swap=/dev/$swap}
echo >/mnt/etc/fstab "\
# Poor man's File System Table.
mkfs \
mknod \
mkproto \
- mkswap \
modem \
mount \
mt \
$(CCLD) -o $@ $<
@install -S 20kw $@
-mkswap: mkswap.c
- $(CCLD) -I$(SYS) -o $@ $<
- @install -S 4kw $@
-
modem: modem.c
$(CCLD) -o $@ $<
@install -S 4kw $@
/usr/bin/mkfs \
/usr/bin/mknod \
/usr/bin/mkproto \
- /usr/bin/mkswap \
/usr/bin/modem \
/usr/bin/mount \
/usr/bin/mt \
/usr/bin/mkproto: mkproto
install -cs -o bin $< $@
-/usr/bin/mkswap: mkswap
- install -cs -o bin $< $@
-
/usr/bin/modem: modem
install -cs -o bin $< $@
+++ /dev/null
-/* mkswap 1.0 - Initialize a swap partition or file
- * Author: Kees J. Bot
- * 6 Jan 2001
- */
-#define nil ((void*)0)
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <minix/config.h>
-#include <minix/const.h>
-#include <minix/type.h>
-#include <minix/u64.h>
-#include <minix/partition.h>
-#include <minix/swap.h>
-#include <servers/mfs/const.h>
-#include <servers/mfs/type.h>
-#include <servers/mfs/super.h>
-
-static void usage(void)
-{
- fprintf(stderr, "Usage: mkswap [-f] device-or-file [size[km]]\n");
- exit(1);
-}
-
-int main(int argc, char **argv)
-{
- int first;
- int i;
- char *file;
- unsigned long offset, size, devsize;
- int fd;
- struct stat st;
- ssize_t r;
- struct super_block super;
- swap_hdr_t swap_hdr;
- static u8_t block[_MAX_BLOCK_SIZE];
-
- first= 0;
- i= 1;
- while (i < argc && argv[i][0] == '-') {
- char *opt= argv[i++]+1;
-
- if (opt[0] == '-' && opt[1] == 0) break; /* -- */
-
- while (*opt != 0) switch (*opt++) {
- case 'f': first= 1; break;
- default: usage();
- }
- }
- if (i == argc) usage();
- file= argv[i++];
-
- size= 0;
- if (i < argc) {
- char *end;
- unsigned long m;
-
- size= strtoul(argv[i], &end, 10);
- if (end == argv[i]) usage();
- m= 1024;
- if (*end != 0) {
- switch (*end) {
- case 'm': case 'M': m *= 1024; /*FALL THROUGH*/
- case 'k': case 'K': end++; break;
- }
- }
- if (*end != 0 || size == -1
- || (size * m) / m != size || (size *= m) <= SWAP_OFFSET
- ) {
- fprintf(stderr, "mkswap: %s: Bad size\n", argv[i]);
- exit(1);
- }
- i++;
- }
- if (i != argc) usage();
-
- /* Open the device or file. */
- if ((fd= open(file, O_RDWR | O_CREAT | O_TRUNC, 0600)) < 0) {
- fprintf(stderr, "mkswap: Can't open %s: %s\n", file, strerror(errno));
- exit(1);
- }
-
- /* File or device? */
- (void) fstat(fd, &st);
- if (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode)) {
- struct partition part;
-
- /* How big is the partition? */
- if (ioctl(fd, DIOCGETP, &part) < 0) {
- fprintf(stderr, "mkswap: Can't determine the size of %s: %s\n",
- file, strerror(errno));
- exit(1);
- }
- devsize= cv64ul(part.size);
- offset= 0;
-
- if (!first) {
- /* Is there a file system? */
- r= -1;
- if (lseek(fd, SUPER_BLOCK_BYTES, SEEK_SET) == -1
- || (r= read(fd, block, _STATIC_BLOCK_SIZE)) < _STATIC_BLOCK_SIZE
- ) {
- fprintf(stderr, "mkswap: %s: %s\n",
- file, r >= 0 ? "End of file" : strerror(errno));
- exit(1);
- }
- memcpy(&super, block, sizeof(super));
- if (super.s_magic == SUPER_MAGIC) {
- offset= (unsigned long) super.s_nzones * _STATIC_BLOCK_SIZE;
- } else
- if (super.s_magic == SUPER_V2) {
- offset= (unsigned long) super.s_zones * _STATIC_BLOCK_SIZE;
- } else if (super.s_magic == SUPER_V3) {
- offset= (unsigned long) super.s_zones * super.s_block_size;
- } else {
- first= 1;
- }
- }
- if (size == 0) size= devsize - offset;
- if (size == 0 || offset + size > devsize) {
- fprintf(stderr, "mkswap: There is no room on %s for ", file);
- if (size > 0) fprintf(stderr, "%lu kilobytes of ", size/1024);
- fprintf(stderr, "swapspace\n");
- if (offset > 0) {
- fprintf(stderr, "(Use the -f flag to wipe the file system)\n");
- }
- exit(1);
- }
- } else
- if (S_ISREG(st.st_mode)) {
- /* Write to the swap file to guarantee space for MM. */
- unsigned long n;
-
- if (size == 0) {
- fprintf(stderr, "mkswap: No size specified for %s\n", file);
- usage();
- }
-
- memset(block, 0, sizeof(block));
- for (n= 0; n < size; n += r) {
- r= size > sizeof(block) ? sizeof(block) : size;
- if ((r= write(fd, block, r)) <= 0) {
- fprintf(stderr, "mkswap: %s: %s\n",
- file, r == 0 ? "End of file" : strerror(errno));
- exit(1);
- }
- }
- first= 1;
- } else {
- fprintf(stderr, "mkswap: %s is not a device or a file\n", file);
- exit(1);
- }
-
- if (offset < SWAP_OFFSET) {
- offset += SWAP_OFFSET;
- if (size < SWAP_OFFSET) size= 0; else size -= SWAP_OFFSET;
- }
- swap_hdr.sh_magic[0]= SWAP_MAGIC0;
- swap_hdr.sh_magic[1]= SWAP_MAGIC1;
- swap_hdr.sh_magic[2]= SWAP_MAGIC2;
- swap_hdr.sh_magic[3]= SWAP_MAGIC3;
- swap_hdr.sh_version= SH_VERSION;
- swap_hdr.sh_priority= 0;
- swap_hdr.sh_offset= offset;
- swap_hdr.sh_swapsize= size;
-
- r= -1;
- if (lseek(fd, SWAP_BOOTOFF, SEEK_SET) == -1
- || (r= read(fd, block, sizeof(block))) < sizeof(block)
- ) {
- fprintf(stderr, "mkswap: %s: %s\n", file,
- file, r >= 0 ? "End of file" : strerror(errno));
- exit(1);
- }
-
- r= (first ? SWAP_BOOTOFF : OPTSWAP_BOOTOFF) - SWAP_BOOTOFF;
- memcpy(block + r, &swap_hdr, sizeof(swap_hdr));
-
- r= -1;
- if (lseek(fd, SWAP_BOOTOFF, SEEK_SET) == -1
- || (r= write(fd, block, sizeof(block))) < sizeof(block)
- ) {
- fprintf(stderr, "mkswap: %s: %s\n", file,
- file, r >= 0 ? "End of file" : strerror(errno));
- exit(1);
- }
- printf("%s: swapspace at offset %lu, size %lu kilobytes\n",
- file, offset / 1024, size / 1024);
- return 0;
-}
#include <minix/config.h>
#include <minix/const.h>
#include <minix/minlib.h>
-#include <minix/swap.h>
#include <sys/svrctl.h>
#include <stdio.h>
#include "../../servers/mfs/const.h"
_PROTOTYPE(void list, (void));
_PROTOTYPE(void usage, (void));
_PROTOTYPE(void tell, (char *this));
-_PROTOTYPE(void swapon, (char *file));
-
-static u8_t MAGIC[] = { SWAP_MAGIC0, SWAP_MAGIC1, SWAP_MAGIC2, SWAP_MAGIC3 };
int main(argc, argv)
int argc;
char *argv[];
{
- int i, swap, n, v, mountflags;
+ int i, n, v, mountflags;
char **ap, *vs, *opt, *err, *type, *args;
char special[PATH_MAX+1], mounted_on[PATH_MAX+1], version[10], rw_flag[10];
if (argc == 1) list(); /* just list /etc/mtab */
mountflags = 0;
- swap = 0;
type = NULL;
args = NULL;
ap = argv+1;
opt = argv[i]+1;
while (*opt != 0) switch (*opt++) {
case 'r': mountflags |= MS_RDONLY; break;
- case 's': swap = 1; break;
case 't': if (++i == argc) usage();
type = argv[i];
break;
*ap = NULL;
argc = (ap - argv);
- if (mountflags & MS_RDONLY && swap) usage();
-
- if (swap) {
- if (argc != 2) usage();
- swapon(argv[1]);
- tell(argv[1]);
- tell(" is swapspace\n");
- } else {
- if (argc != 3) usage();
- if (mount(argv[1], argv[2], mountflags, type, args) < 0) {
- err = strerror(errno);
- std_err("mount: Can't mount ");
- std_err(argv[1]);
- std_err(" on ");
- std_err(argv[2]);
- std_err(": ");
- std_err(err);
- std_err("\n");
- exit(1);
- }
- /* The mount has completed successfully. Tell the user. */
- tell(argv[1]);
- tell(" is read-");
- tell(mountflags & MS_RDONLY ? "only" : "write");
- tell(" mounted on ");
- tell(argv[2]);
- tell("\n");
+ if (argc != 3) usage();
+ if (mount(argv[1], argv[2], mountflags, type, args) < 0) {
+ err = strerror(errno);
+ std_err("mount: Can't mount ");
+ std_err(argv[1]);
+ std_err(" on ");
+ std_err(argv[2]);
+ std_err(": ");
+ std_err(err);
+ std_err("\n");
+ exit(1);
}
+ /* The mount has completed successfully. Tell the user. */
+ tell(argv[1]);
+ tell(" is read-");
+ tell(mountflags & MS_RDONLY ? "only" : "write");
+ tell(" mounted on ");
+ tell(argv[2]);
+ tell("\n");
/* Update /etc/mtab. */
n = load_mtab("mount");
exit(1);
}
}
- if (swap) {
- vs = "swap";
+ /* For MFS, use a version number. Otherwise, use the FS type name. */
+ if (type == NULL || !strcmp(type, MINIX_FS_TYPE)) {
+ v = fsversion(argv[1], "mount");
+ if (v == 1)
+ vs = "1";
+ else if (v == 2)
+ vs = "2";
+ else if (v == 3)
+ vs = "3";
+ else
+ vs = "0";
} else {
- /* For MFS, use a version number. Otherwise, use the FS type name. */
- if (type == NULL || !strcmp(type, MINIX_FS_TYPE)) {
- v = fsversion(argv[1], "mount");
- if (v == 1)
- vs = "1";
- else if (v == 2)
- vs = "2";
- else if (v == 3)
- vs = "3";
- else
- vs = "0";
- } else {
- /* Keep the version field sufficiently short. */
- if (strlen(type) < sizeof(version))
- vs = type;
- else
- vs = "-";
- }
+ /* Keep the version field sufficiently short. */
+ if (strlen(type) < sizeof(version))
+ vs = type;
+ else
+ vs = "-";
}
- n = put_mtab_entry(argv[1], swap ? "swap" : argv[2], vs,
+ n = put_mtab_entry(argv[1], argv[2], vs,
(mountflags & MS_RDONLY ? "ro" : "rw") );
if (n < 0) {
std_err("mount: /etc/mtab has grown too large\n");
n = get_mtab_entry(special, mounted_on, version, rw_flag);
if (n < 0) break;
write(1, special, strlen(special));
- if (strcmp(version, "swap") == 0) {
- tell(" is swapspace\n");
- } else {
- tell(" is read-");
- tell(strcmp(rw_flag, "rw") == 0 ? "write" : "only");
- tell(" mounted on ");
- tell(mounted_on);
- tell("\n");
- }
+ tell(" is read-");
+ tell(strcmp(rw_flag, "rw") == 0 ? "write" : "only");
+ tell(" mounted on ");
+ tell(mounted_on);
+ tell("\n");
}
exit(0);
}
void usage()
{
- std_err("Usage: mount [-r] [-t type] [-o options] special name\n"
- " mount -s special\n");
+ std_err("Usage: mount [-r] [-t type] [-o options] special name\n");
exit(1);
}
{
write(1, this, strlen(this));
}
-
-void swapon(file)
-char *file;
-{
- u32_t super[2][_MAX_BLOCK_SIZE / 2 / sizeof(u32_t)];
- swap_hdr_t *sp;
- struct mmswapon mmswapon;
- int fd, r;
- char *err;
-
- if ((fd = open(file, O_RDWR)) < 0
- || lseek(fd, SUPER_BLOCK_BYTES, SEEK_SET) == -1
- || (r = read(fd, super, _STATIC_BLOCK_SIZE)) < 0
- ) {
- err = strerror(errno);
- std_err("mount: ");
- std_err(file);
- std_err(": ");
- std_err(err);
- std_err("\n");
- exit(1);
- }
- sp = (swap_hdr_t *) &super[0];
- if (memcmp(sp->sh_magic, MAGIC, sizeof(MAGIC)) != 0)
- sp = (swap_hdr_t *) &super[1];
- if (r == _STATIC_BLOCK_SIZE && memcmp(sp->sh_magic, MAGIC, sizeof(MAGIC)) != 0
- || sp->sh_version > SH_VERSION) {
- std_err("mount: ");
- std_err(file);
- std_err(" is not swapspace\n");
- exit(1);
- }
- close(fd);
- mmswapon.offset = sp->sh_offset;
- mmswapon.size = sp->sh_swapsize;
- strncpy(mmswapon.file, file, sizeof(mmswapon.file));
- mmswapon.file[sizeof(mmswapon.file)-1] = 0;
- if (svrctl(MMSWAPON, &mmswapon) < 0) {
- err = strerror(errno);
- std_err("mount: ");
- std_err(file);
- std_err(": ");
- std_err(err);
- std_err("\n");
- exit(1);
- }
-}
IMGRD=imgrd_s.o
#IMGRD=imgrd.c
-OBJ = memory.o allocmem.o $(IMGRD)
+OBJ = memory.o $(IMGRD)
# build local binary
all build: $(DRIVER)
+++ /dev/null
-#include <lib.h>
-#include <unistd.h>
-
-PUBLIC int allocmem(size, base)
-phys_bytes size; /* size of mem chunk requested */
-phys_bytes *base; /* return base address */
-{
- message m;
- m.m4_l1 = size;
- if (_syscall(MM, ALLOCMEM, &m) < 0) return(-1);
- *base = m.m4_l2;
- return(0);
-}
-
* /dev/null - null device (data sink)
* /dev/boot - boot device loaded from boot image
* /dev/zero - null byte stream generator
+ * /dev/imgrd - boot image RAM disk
*
* Changes:
* Apr 29, 2005 added null byte generator (Jorrit N. Herder)
}
if (Wflag) wflag = 1; /* -W implies -w */
-#if 0
- /* The hardware clock may run in a different time zone, likely GMT or
- * winter time. Select that time zone.
- */
- strcpy(clocktz, "TZ=");
- sysgetenv.key = "TZ";
- sysgetenv.keylen = 2+1;
- sysgetenv.val = clocktz+3;
- sysgetenv.vallen = sizeof(clocktz)-3;
- if (svrctl(SYSGETENV, &sysgetenv) == 0) {
- putenv(clocktz);
- tzset();
- }
-#endif
-
/* Read the CMOS real time clock. */
for (i = 0; i < 10; i++) {
get_time(&time1);
USRETC=/usr/etc/
FILES1=fstab group hostname.file inet.conf motd.install mtab passwd profile \
protocols rc services termcap ttytab utmp rc.cd binary_sizes \
- binary_sizes.big binary_sizes.xxl rc.rescue syslog.conf \
- rc.daemons.dist rs.inet rs.single make.conf system.conf
+ binary_sizes.big binary_sizes.xxl syslog.conf rc.daemons.dist \
+ rs.inet rs.single make.conf system.conf
FILES2=shadow
FILES3=daily dhcptags.conf rc
755 root operator /lib/i386
755 root operator /boot
755 root operator /boot/image
-755 root operator /boot/rescue
555 root operator /mnt
700 root operator /root
1777 root operator /tmp
# /etc/fstab lists the root, tmp and usr devices.
. /etc/fstab
- # Any swapspace on a device?
- test "$swap" : '/dev/' && mount -s $swap
-
# Use MFS binary only from kernel image?
if [ "`sysenv bin_img`" = 1 ]
then
intr sh
fi
- # Any swapspace on a file?
- test -n "$swap" -a ! "$swap" : '/dev/' && mount -s $swap
-
-
case "`printroot -r`":$bootcd in
/dev/ram:)
# Remove boot-only things to make space,
# Further initialization.
test -f /usr/etc/rc && sh /usr/etc/rc $action
test -f /usr/local/etc/rc && sh /usr/local/etc/rc $action
-#test -f /etc/rc.rescue && sh /etc/rc.rescue $action
# Any messages?
test "$action" = start -a -f /etc/issue && cat /etc/issue
+++ /dev/null
-#!/bin/sh
-DRIVERS=/sbin
-RESCUE=/boot/rescue
-
-if [ "$1" != start ]
-then exit
-fi
-
-set -e
-service up $DRIVERS/rescue -dev /dev/rescue -args 128 -period 4HZ
-mkfs /dev/rescue
-mount /dev/rescue $RESCUE
-cd $DRIVERS
-cp -p at_wini floppy bios_wini $RESCUE
-service rescue $RESCUE
#define EXEC_RESTART 102 /* to PM: final part of exec for RS */
#define PROCSTAT 103 /* to PM */
#define GETPROCNR 104 /* to PM */
-#define ALLOCMEM 105 /* to PM */
-#if 0
-#define FREEMEM 106 /* to PM, not used, not implemented */
-#endif
+
#define GETEPINFO 107 /* to PM: get pid/uid/gid of an endpoint */
#define ADDDMA 108 /* to PM: inform PM about a region of memory
* that is used for bus-master DMA
* any longer
*/
-#define DEVCTL 120 /* to FS, map or unmap a device */
#define TASK_REPLY 121 /* to FS: reply code from drivers, not
* really a standalone call.
*/
*/
#define NOTIFY_MESSAGE 0x1000
/* FIXME will be is_notify(a) ((a) == NOTIFY_MESSAGE) */
-#define is_notify(a) ((a) & NOTIFY_MESSAGE)
+#define is_notify(a) ((unsigned) ((a) - NOTIFY_MESSAGE) < 0x100)
#define NOTIFY_FROM(p_nr) (NOTIFY_MESSAGE | ((p_nr) + NR_TASKS))
/* Shorthands for message parameters passed with notifications. */
# define SYS_UMAP (KERNEL_CALL + 14) /* sys_umap() */
# define SYS_VIRCOPY (KERNEL_CALL + 15) /* sys_vircopy() */
# define SYS_PHYSCOPY (KERNEL_CALL + 16) /* sys_physcopy() */
-# define SYS_VIRVCOPY (KERNEL_CALL + 17) /* sys_virvcopy() */
-# define SYS_PHYSVCOPY (KERNEL_CALL + 18) /* sys_physvcopy() */
# define SYS_IRQCTL (KERNEL_CALL + 19) /* sys_irqctl() */
# define SYS_INT86 (KERNEL_CALL + 20) /* sys_int86() */
# define SYS_CPROF (KERNEL_CALL + 37) /* sys_cprof() */
# define SYS_PROFBUF (KERNEL_CALL + 38) /* sys_profbuf() */
-# define SYS_STIME (KERNEL_CALL + 39) /* sys_stime() */
+# define SYS_STIME (KERNEL_CALL + 39) /* sys_stime() */
-# define SYS_MAPDMA (KERNEL_CALL + 42) /* sys_mapdma() */
-# define SYS_VMCTL (KERNEL_CALL + 43) /* sys_vmctl() */
-# define SYS_SYSCTL (KERNEL_CALL + 44) /* sys_sysctl() */
+# define SYS_MAPDMA (KERNEL_CALL + 42) /* sys_mapdma() */
+# define SYS_VMCTL (KERNEL_CALL + 43) /* sys_vmctl() */
+# define SYS_SYSCTL (KERNEL_CALL + 44) /* sys_sysctl() */
# define SYS_VTIMER (KERNEL_CALL + 45) /* sys_vtimer() */
# define SYS_RUNCTL (KERNEL_CALL + 46) /* sys_runctl() */
#define NR_SYS_CALLS 47 /* number of system calls */
-/* Subfunctions for SYS_PRIVCTL */
-#define SYS_PRIV_ALLOW 1 /* Allow process to run */
-#define SYS_PRIV_DISALLOW 2 /* Disallow process to run */
-#define SYS_PRIV_SET_SYS 3 /* Set a system privilege structure */
-#define SYS_PRIV_SET_USER 4 /* Set a user privilege structure */
-#define SYS_PRIV_ADD_IO 5 /* Add I/O range (struct io_range) */
-#define SYS_PRIV_ADD_MEM 6 /* Add memory range (struct mem_range)
- */
-#define SYS_PRIV_ADD_IRQ 7 /* Add IRQ */
-#define SYS_PRIV_QUERY_MEM 8 /* Verify memory privilege. */
-
-/* Subfunctions for SYS_SETGRANT */
-#define SYS_PARAM_SET_GRANT 1 /* Set address and size of grant table */
-
-/* Field names for SYS_MEMSET, SYS_SEGCTL. */
+/* Field names for SYS_MEMSET. */
#define MEM_PTR m2_p1 /* base */
#define MEM_COUNT m2_l1 /* count */
#define MEM_PATTERN m2_l2 /* pattern to write */
-#define MEM_CHUNK_BASE m4_l1 /* physical base address */
-#define MEM_CHUNK_SIZE m4_l2 /* size of mem chunk */
-#define MEM_TOT_SIZE m4_l3 /* total memory size */
-#define MEM_CHUNK_TAG m4_l4 /* tag to identify chunk of mem */
/* Field names for SYS_DEVIO, SYS_VDEVIO, SYS_SDEVIO. */
#define DIO_REQUEST m2_i3 /* device in or output */
# define _DIO_SAFEMASK 0xf00
# define DIO_INPUT_BYTE (_DIO_INPUT|_DIO_BYTE)
# define DIO_INPUT_WORD (_DIO_INPUT|_DIO_WORD)
+# define DIO_INPUT_LONG (_DIO_INPUT|_DIO_LONG)
# define DIO_OUTPUT_BYTE (_DIO_OUTPUT|_DIO_BYTE)
# define DIO_OUTPUT_WORD (_DIO_OUTPUT|_DIO_WORD)
+# define DIO_OUTPUT_LONG (_DIO_OUTPUT|_DIO_LONG)
# define DIO_SAFE_INPUT_BYTE (_DIO_INPUT|_DIO_BYTE|_DIO_SAFE)
# define DIO_SAFE_INPUT_WORD (_DIO_INPUT|_DIO_WORD|_DIO_SAFE)
+# define DIO_SAFE_INPUT_LONG (_DIO_INPUT|_DIO_LONG|_DIO_SAFE)
# define DIO_SAFE_OUTPUT_BYTE (_DIO_OUTPUT|_DIO_BYTE|_DIO_SAFE)
# define DIO_SAFE_OUTPUT_WORD (_DIO_OUTPUT|_DIO_WORD|_DIO_SAFE)
+# define DIO_SAFE_OUTPUT_LONG (_DIO_OUTPUT|_DIO_LONG|_DIO_SAFE)
#define DIO_PORT m2_l1 /* single port address */
#define DIO_VALUE m2_l2 /* single I/O value */
#define DIO_VEC_ADDR m2_p1 /* address of buffer or (p,v)-pairs */
#define DIO_VEC_ENDPT m2_i2 /* number of process where vector is */
#define DIO_OFFSET m2_i1 /* offset from grant */
-/* Field names for SYS_SIGNARLM, SYS_FLAGARLM, SYS_SYNCALRM. */
+/* Field names for SYS_SETALARM. */
#define ALRM_EXP_TIME m2_l1 /* expire time for the alarm call */
#define ALRM_ABS_TIME m2_i2 /* set to 1 to use absolute alarm time */
#define ALRM_TIME_LEFT m2_l1 /* how many ticks were remaining */
-#define ALRM_ENDPT m2_i1 /* which process wants the alarm? */
-#define ALRM_FLAG_PTR m2_p1 /* virtual address of timeout flag */
/* Field names for SYS_IRQCTL. */
#define IRQ_REQUEST m5_c1 /* what to do? */
#define SEG_SIZE m4_l4 /* segment size */
#define SEG_INDEX m4_l5 /* segment index in remote map */
-/* Field names for SYS_VIDCOPY. */
-#define VID_REQUEST m4_l1 /* what to do? */
-# define VID_VID_COPY 1 /* request vid_vid_copy() */
-# define MEM_VID_COPY 2 /* request mem_vid_copy() */
-#define VID_SRC_ADDR m4_l2 /* virtual address in memory */
-#define VID_SRC_OFFSET m4_l3 /* offset in video memory */
-#define VID_DST_OFFSET m4_l4 /* offset in video memory */
-#define VID_CP_COUNT m4_l5 /* number of words to be copied */
-
/* Field names for SYS_ABORT. */
#define ABRT_HOW m1_i1 /* RBT_REBOOT, RBT_HALT, etc. */
#define ABRT_MON_ENDPT m1_i2 /* process where monitor params are */
#define CP_DST_ADDR m5_l2 /* address where data go to */
#define CP_NR_BYTES m5_l3 /* number of bytes to copy */
-/* Field names for SYS_VCOPY and SYS_VVIRCOPY. */
-#define VCP_NR_OK m1_i2 /* number of successfull copies */
-#define VCP_VEC_SIZE m1_i3 /* size of copy vector */
-#define VCP_VEC_ADDR m1_p1 /* pointer to copy vector */
-
/* Field names for SYS_GETINFO. */
#define I_REQUEST m7_i3 /* what info to get */
# define GET_KINFO 0 /* get kernel information structure */
# define GET_WHOAMI 19 /* get own name and endpoint */
# define GET_RANDOMNESS_BIN 20 /* get one randomness bin */
# define GET_IDLETSC 21 /* get cumulative idle time stamp counter */
-# define GET_AOUTHEADER 22 /* get a.out headers from the boot image */
-#define I_ENDPT m7_i4 /* calling process */
+# define GET_AOUTHEADER 22 /* get a.out headers from the boot image */
+#define I_ENDPT m7_i4 /* calling process (may only be SELF) */
#define I_VAL_PTR m7_p1 /* virtual address at caller */
#define I_VAL_LEN m7_i1 /* max length of value */
#define I_VAL_PTR2 m7_p2 /* second virtual address */
#define T_BOOTTIME m4_l3 /* Boottime in seconds (also for SYS_STIME) */
#define T_BOOT_TICKS m4_l5 /* number of clock ticks since boot time */
-/* vm_map */
-#define VM_MAP_ENDPT m4_l1
-#define VM_MAP_MAPUNMAP m4_l2
-#define VM_MAP_BASE m4_l3
-#define VM_MAP_SIZE m4_l4
-#define VM_MAP_ADDR m4_l5
-
/* Field names for SYS_TRACE, SYS_PRIVCTL. */
-#define CTL_ENDPT m2_i1 /* process number of the caller */
+#define CTL_ENDPT m2_i1 /* process number of the caller */
#define CTL_REQUEST m2_i2 /* server control request */
#define CTL_ARG_PTR m2_p1 /* pointer to argument */
#define CTL_ADDRESS m2_l1 /* address at traced process' space */
#define CTL_PHYSSTART m2_l1 /* physical memory start in bytes*/
#define CTL_PHYSLEN m2_l2 /* length in bytes */
+/* Subfunctions for SYS_PRIVCTL */
+#define SYS_PRIV_ALLOW 1 /* Allow process to run */
+#define SYS_PRIV_DISALLOW 2 /* Disallow process to run */
+#define SYS_PRIV_SET_SYS 3 /* Set a system privilege structure */
+#define SYS_PRIV_SET_USER 4 /* Set a user privilege structure */
+#define SYS_PRIV_ADD_IO 5 /* Add I/O range (struct io_range) */
+#define SYS_PRIV_ADD_MEM 6 /* Add memory range (struct mem_range)
+ */
+#define SYS_PRIV_ADD_IRQ 7 /* Add IRQ */
+#define SYS_PRIV_QUERY_MEM 8 /* Verify memory privilege. */
+
/* Field names for SYS_SETGRANT */
#define SG_ADDR m2_p1 /* address */
#define SG_SIZE m2_i2 /* no. of entries */
-/* Field names for SYS_KILL, SYS_SIGCTL */
-#define SIG_REQUEST m2_l2 /* PM signal control request */
-#define S_GETSIG 0 /* get pending kernel signal */
-#define S_ENDSIG 1 /* finish a kernel signal */
-#define S_SENDSIG 2 /* POSIX style signal handling */
-#define S_SIGRETURN 3 /* return from POSIX handling */
-#define S_KILL 4 /* servers kills process with signal */
-#define SIG_ENDPT m2_i1 /* process number for inform */
+/* Field names for SYS_GETKSIG, _ENDKSIG, _KILL, _SIGSEND, _SIGRETURN. */
+#define SIG_ENDPT m2_i1 /* process number for inform */
#define SIG_NUMBER m2_i2 /* signal number to send */
#define SIG_FLAGS m2_i3 /* signal flags field */
#define SIG_MAP m2_l1 /* used by kernel to pass signal bit map */
#define SIG_CTXT_PTR m2_p1 /* pointer to info to restore signal context */
/* Field names for SYS_FORK, _EXEC, _EXIT, _NEWMAP. */
-#define PR_ENDPT m1_i1 /* indicates a process */
-#define PR_PRIORITY m1_i2 /* process priority */
-#define PR_SLOT m1_i2 /* indicates a process slot */
-#define PR_PID m1_i3 /* process id at process manager */
-#define PR_STACK_PTR m1_p1 /* used for stack ptr in sys_exec, sys_getsp */
-#define PR_TRACING m1_i3 /* flag to indicate tracing is on/ off */
-#define PR_NAME_PTR m1_p2 /* tells where program name is for dmp */
-#define PR_IP_PTR m1_p3 /* initial value for ip after exec */
-#define PR_MEM_PTR m1_p1 /* tells where memory map is for sys_newmap
+#define PR_ENDPT m1_i1 /* indicates a process */
+#define PR_PRIORITY m1_i2 /* process priority */
+#define PR_SLOT m1_i2 /* indicates a process slot */
+#define PR_STACK_PTR m1_p1 /* used for stack ptr in sys_exec, sys_getsp */
+#define PR_NAME_PTR m1_p2 /* tells where program name is for dmp */
+#define PR_IP_PTR m1_p3 /* initial value for ip after exec */
+#define PR_MEM_PTR m1_p1 /* tells where memory map is for sys_newmap
* and sys_fork
*/
-#define PR_FORK_FLAGS m1_i3
-#define PR_FORK_MSGADDR m1_p1
-
-/* Field names for SYS_INT86 */
-#define INT86_REG86 m1_p1 /* pointer to registers */
+#define PR_FORK_FLAGS m1_i3 /* optional flags for fork operation */
+#define PR_FORK_MSGADDR m1_p1 /* reply message address of forked child */
/* Flags for PR_FORK_FLAGS. */
#define PFF_VMINHIBIT 0x01 /* Don't schedule until release by VM. */
+/* Field names for SYS_INT86 */
+#define INT86_REG86 m1_p1 /* pointer to registers */
+
/* Field names for SYS_SAFECOPY* */
#define SCP_FROM_TO m2_i1 /* from/to whom? */
-#define SCP_INFO m2_i2 /* byte: DDDDSSSS Dest and Src seg */
+#define SCP_SEG m2_i2 /* my own segment */
#define SCP_GID m2_i3 /* grant id */
#define SCP_OFFSET m2_l1 /* offset within grant */
#define SCP_ADDRESS m2_p1 /* my own address */
#define VSCP_VEC_ADDR m2_p1 /* start of vector */
#define VSCP_VEC_SIZE m2_l2 /* elements in vector */
-/* For the SCP_INFO field: encoding and decoding. */
-#define SCP_MAKEINFO(seg) ((seg) & 0xffff)
-#define SCP_INFO2SEG(info) ((info) & 0xffff)
-
-/* Field names for SELECT (FS). */
-#define SEL_NFDS m8_i1
-#define SEL_READFDS m8_p1
-#define SEL_WRITEFDS m8_p2
-#define SEL_ERRORFDS m8_p3
-#define SEL_TIMEOUT m8_p4
-
/* Field names for SYS_SPROF, _CPROF, _PROFBUF. */
#define PROF_ACTION m7_i1 /* start/stop/reset/get */
#define PROF_MEM_SIZE m7_i2 /* available memory for data */
#define PROF_CTL_PTR m7_p1 /* location of info struct */
#define PROF_MEM_PTR m7_p2 /* location of profiling data */
-/* Field names for GETSYSINFO_UP (PM). */
-#define SIU_WHAT m2_i1
-#define SIU_LEN m2_i2
-#define SIU_WHERE m2_p1
-
-/* Message for SYS_READBIOS */
+/* Field names for SYS_READBIOS. */
#define RDB_SIZE m2_i1
#define RDB_ADDR m2_l1
#define RDB_BUF m2_p1
#define VMMF_UNCACHED (1L << 0)
-/* Codes and field names for SYS_SYSCTL. */
-#define SYSCTL_CODE m1_i1 /* SYSCTL_CODE_* below */
-#define SYSCTL_ARG1 m1_p1
-#define SYSCTL_ARG2 m1_i2
-#define SYSCTL_CODE_DIAG 1 /* Print diagnostics. */
-#define SYSCTL_CODE_STACKTRACE 2 /* Print process stack. */
-#define DIAG_BUFSIZE (80*25)
-
/* Values for SVMCTL_PARAM. */
#define VMCTL_I386_SETCR3 10
#define VMCTL_GET_PAGEFAULT 11
#define VMCTL_KERN_PHYSMAP 27
#define VMCTL_KERN_MAP_REPLY 28
+/* Codes and field names for SYS_SYSCTL. */
+#define SYSCTL_CODE m1_i1 /* SYSCTL_CODE_* below */
+#define SYSCTL_ARG1 m1_p1
+#define SYSCTL_ARG2 m1_i2
+#define SYSCTL_CODE_DIAG 1 /* Print diagnostics. */
+#define SYSCTL_CODE_STACKTRACE 2 /* Print process stack. */
+#define DIAG_BUFSIZE (80*25)
+
/* Field names for SYS_VTIMER. */
#define VT_WHICH m2_i1 /* which timer to set/retrieve */
# define VT_VIRTUAL 1 /* the ITIMER_VIRTUAL timer */
#define PM_RS_BASE 0x980
/* Requests from PM to VFS */
+#define PM_INIT (PM_RQ_BASE + 0) /* Process table exchange */
#define PM_SETUID (PM_RQ_BASE + 1) /* Set new user ID */
#define PM_SETGID (PM_RQ_BASE + 2) /* Set group ID */
#define PM_SETSID (PM_RQ_BASE + 3) /* Set session leader */
#define PM_SETGROUPS (PM_RQ_BASE + 11) /* Tell VFS about setgroups */
/* Replies from VFS to PM */
-#define PM_SETUID_REPLY (PM_RS_BASE + 21)
-#define PM_SETGID_REPLY (PM_RS_BASE + 22)
-#define PM_SETSID_REPLY (PM_RS_BASE + 23)
-#define PM_EXIT_REPLY (PM_RS_BASE + 24)
-#define PM_CORE_REPLY (PM_RS_BASE + 25)
-#define PM_EXEC_REPLY (PM_RS_BASE + 26)
-#define PM_FORK_REPLY (PM_RS_BASE + 27)
-#define PM_FORK_NB_REPLY (PM_RS_BASE + 28)
-#define PM_UNPAUSE_REPLY (PM_RS_BASE + 29)
-#define PM_REBOOT_REPLY (PM_RS_BASE + 30)
-#define PM_SETGROUPS_REPLY (PM_RS_BASE + 31)
+#define PM_SETUID_REPLY (PM_RS_BASE + 1)
+#define PM_SETGID_REPLY (PM_RS_BASE + 2)
+#define PM_SETSID_REPLY (PM_RS_BASE + 3)
+#define PM_EXIT_REPLY (PM_RS_BASE + 4)
+#define PM_CORE_REPLY (PM_RS_BASE + 5)
+#define PM_EXEC_REPLY (PM_RS_BASE + 6)
+#define PM_FORK_REPLY (PM_RS_BASE + 7)
+#define PM_FORK_NB_REPLY (PM_RS_BASE + 8)
+#define PM_UNPAUSE_REPLY (PM_RS_BASE + 9)
+#define PM_REBOOT_REPLY (PM_RS_BASE + 10)
+#define PM_SETGROUPS_REPLY (PM_RS_BASE + 11)
/* Standard parameters for all requests and replies, except PM_REBOOT */
-# define PM_PROC m1_i1 /* process */
+# define PM_PROC m1_i1 /* process endpoint */
+
+/* Additional parameters for PM_INIT */
+# define PM_SLOT m1_i2 /* process slot number */
+# define PM_PID m2_i3 /* process pid */
/* Additional parameters for PM_SETUID and PM_SETGID */
# define PM_EID m1_i2 /* effective user/group id */
# define PM_RID m1_i3 /* real user/group id */
/* Additional parameter for PM_SETGROUPS */
-#define PM_GROUP_NO m1_i2 /* number of groups */
-#define PM_GROUP_ADDR m1_p1 /* struct holding group data */
-
+# define PM_GROUP_NO m1_i2 /* number of groups */
+# define PM_GROUP_ADDR m1_p1 /* struct holding group data */
/* Additional parameters for PM_EXEC */
# define PM_PATH m1_p1 /* executable */
# define PM_PATH_LEN m1_i2 /* length of path including
- * terminating nul
+ * terminating null character
*/
# define PM_FRAME m1_p2 /* arguments and environment */
# define PM_FRAME_LEN m1_i3 /* size of frame */
# define PM_STATUS m1_i2 /* OK or failure */
/* Additional parameters for PM_FORK and PM_FORK_NB */
-# define PM_PPROC m1_i2 /* parent process */
+# define PM_PPROC m1_i2 /* parent process endpoint */
# define PM_CPID m1_i3 /* child pid */
/* Parameters for the EXEC_NEWMEM call */
# define VMVC_FD m1_i1
# define VMVC_ENDPOINT m1_i2
+/*===========================================================================*
+ * Miscellaneous field names *
+ *===========================================================================*/
+
/* PM field names */
/* BRK */
#define PMBRK_ADDR m1_p1
#define PM_ENDPT m1_i1
#define PM_PENDPT m1_i2
+/* Field names for GETSYSINFO_UP (PM). */
+#define SIU_WHAT m2_i1
+#define SIU_LEN m2_i2
+#define SIU_WHERE m2_p1
+
+/* Field names for SELECT (FS). */
+#define SEL_NFDS m8_i1
+#define SEL_READFDS m8_p1
+#define SEL_WRITEFDS m8_p2
+#define SEL_ERRORFDS m8_p3
+#define SEL_TIMEOUT m8_p4
+
/*===========================================================================*
* Messages for VM server *
*===========================================================================*/
# define VMUM_ADDR m1_p1
# define VMUM_LEN m1_i1
-#define VM_ALLOCMEM (VM_RQ_BASE+18)
-# define VMAM_BYTES m1_p1
-# define VMAM_MEMBASE m1_i1
-
#define VM_MUNMAP_TEXT (VM_RQ_BASE+19)
/* Calls from VFS. */
#define SUPER_USER (uid_t) 0 /* uid_t of superuser */
#define NULL ((void *)0) /* null pointer */
-#define CPVEC_NR 16 /* max # of entries in a SYS_VCOPY request */
-#define CPVVEC_NR 64 /* max # of entries in a SYS_VCOPY request */
#define SCPVEC_NR 64 /* max # of entries in a SYS_VSAFECOPY* request */
#define NR_IOREQS 64
/* maximum number of entries in an iorequest */
#define INET_MAJOR 7 /* major device for inet */
-#define RESCUE_MAJOR 9 /* major device for rescue */
-
#define FILTER_MAJOR 11 /* major device for filter driver */
#define LOG_MAJOR 15 /* major device for log driver */
+++ /dev/null
-/*
-minix/swap.h
-
-Defines the super block of swap partitions and some useful constants.
-
-Created: Aug 2, 1992 by Philip Homburg
-*/
-
-#ifndef _MINIX__SWAP_H
-#define _MINIX__SWAP_H
-
-/* Two possible layouts for a partition with swapspace:
- *
- * Sector Swap partition FS+swap partition
- *
- * 0 - 1 bootblock bootblock
- * 2 swap header FS header
- * 3 blank swap header
- * 4 - m swapspace file system
- * m+1 - n - swapspace
- */
-
-#define SWAP_MAGIC0 0x9D
-#define SWAP_MAGIC1 0xC3
-#define SWAP_MAGIC2 0x01
-#define SWAP_MAGIC3 0x82
-
-typedef struct swap_hdr
-{
- u8_t sh_magic[4];
- u8_t sh_version;
- u8_t sh_dummy[3];
- u32_t sh_offset;
- u32_t sh_swapsize;
- i32_t sh_priority;
-} swap_hdr_t;
-
-#define SWAP_BOOTOFF 1024
-#define SWAP_OFFSET 2048
-#define OPTSWAP_BOOTOFF (1024+512)
-#define SH_VERSION 1
-#define SH_PRIORITY 0
-
-#endif /* _MINIX__SWAP_H */
-
-/*
- * $PchId: swap.h,v 1.6 1996/04/10 20:25:48 philip Exp $
- */
_PROTOTYPE(int sys_memset, (unsigned long pattern,
phys_bytes base, phys_bytes bytes));
-
-/* Vectored virtual / physical copy calls. */
-#if DEAD_CODE /* library part not yet implemented */
-_PROTOTYPE(int sys_virvcopy, (phys_cp_req *vec_ptr,int vec_size,int *nr_ok));
-_PROTOTYPE(int sys_physvcopy, (phys_cp_req *vec_ptr,int vec_size,int *nr_ok));
-#endif
-
_PROTOTYPE(int sys_umap, (endpoint_t proc_ep, int seg, vir_bytes vir_addr,
vir_bytes bytes, phys_bytes *phys_addr));
_PROTOTYPE(int sys_umap_data_fb, (endpoint_t proc_ep, vir_bytes vir_addr,
_PROTOTYPE( void *vm_map_phys, (endpoint_t who, void *physaddr, size_t len));
_PROTOTYPE( int vm_unmap_phys, (endpoint_t who, void *vaddr, size_t len));
-_PROTOTYPE( int vm_allocmem, (phys_clicks memclicks, phys_clicks *retmembase));
_PROTOTYPE( int vm_notify_sig, (endpoint_t ep, endpoint_t ipc_ep));
_PROTOTYPE( int vm_ctl, (int what, int param));
_PROTOTYPE( int vm_set_priv, (int procnr, void *buf));
/* 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)
+/* PM controls. */
#define MMGETPARAM _IOW('M', 5, struct sysgetenv)
#define MMSETPARAM _IOR('M', 7, struct sysgetenv)
/* FS controls. */
#define FSSIGNON _IOW('F', 2, struct fssignon)
-#define FSDEVUNMAP _IOW('F', 6, struct fsdevunmap)
-
-/* Kernel controls. */
-#define SYSSENDMASK _IO ('S', 4)
-#define SYSSIGNON _IOR('S', 2, struct systaskinfo)
-#define SYSGETENV _IOW('S', 1, 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. */
-};
-
-struct svrqueryparam {
- char *param; /* Names of parameters to query. */
- size_t psize; /* Length of param[]. */
- char *value; /* To return values. */
- size_t vsize;
-};
/* A proper system call must be created later. */
#include <minix/dmap.h>
enum dev_style style; /* Management style. */
};
-struct fsdevunmap {
- dev_t dev; /* Device to unmap. */
-};
-
-struct systaskinfo {
- int proc_nr; /* Process number of caller. */
-};
-
struct sysgetenv {
char *key; /* Name requested. */
size_t keylen; /* Length of name including \0. */
_PROTOTYPE( int ttyslot, (void) );
_PROTOTYPE( int fttyslot, (int _fd) );
_PROTOTYPE( char *crypt, (const char *_key, const char *_salt) );
-_PROTOTYPE( int getsysinfo, (endpoint_t who, int what, void *where) );
+_PROTOTYPE( int getsysinfo, (endpoint_t who, int what, void *where) );
_PROTOTYPE( int getsigset, (sigset_t *sigset) );
_PROTOTYPE( int getprocnr, (void) );
_PROTOTYPE( int getnprocnr, (pid_t pid) );
_PROTOTYPE( int getpprocnr, (void) );
_PROTOTYPE( int _pm_findproc, (char *proc_name, int *proc_nr) );
-_PROTOTYPE( int allocmem, (phys_bytes size, phys_bytes *base) );
-_PROTOTYPE( int freemem, (phys_bytes size, phys_bytes base) );
-#define DEV_MAP 1
-#define DEV_UNMAP 2
-#define mapdriver(driver, device, style, force) \
- devctl(DEV_MAP, driver, device, style, force)
-#define unmapdriver(device) devctl(DEV_UNMAP, 0, device, 0)
-_PROTOTYPE( int devctl, (int ctl_req, int driver, int device, int style,
- int force) );
-_PROTOTYPE( int mapdriver5, (char *label, size_t len, int major,
- int style, int force) );
+_PROTOTYPE( int mapdriver, (char *label, int major, int style,
+ int force) );
_PROTOTYPE(int adddma, (endpoint_t proc_e,
phys_bytes start, phys_bytes size) );
_PROTOTYPE(int deldma, (endpoint_t proc_e,
#define USE_NICE 1 /* change scheduling priority */
#define USE_UMAP 1 /* map virtual to physical address */
#define USE_VIRCOPY 1 /* copy using virtual addressing */
-#define USE_VIRVCOPY 1 /* vector with virtual copy requests */
#define USE_PHYSCOPY 1 /* copy using physical addressing */
-#define USE_PHYSVCOPY 1 /* vector with physical copy requests */
#define USE_MEMSET 1 /* write char to a given memory area */
#define USE_RUNCTL 1 /* control stop flags of a process */
*/
#define NR_IRQ_HOOKS 16 /* number of interrupt hooks */
#define VDEVIO_BUF_SIZE 64 /* max elements per VDEVIO request */
-#define VCOPY_VEC_SIZE 16 /* max elements per VCOPY request */
/* How many bytes for the kernel stack. Space allocated in mpx.s. */
#define K_STACK_BYTES 1024
map(SYS_UMAP, do_umap); /* map virtual to physical address */
map(SYS_VIRCOPY, do_vircopy); /* use pure virtual addressing */
map(SYS_PHYSCOPY, do_copy); /* use physical addressing */
- map(SYS_VIRVCOPY, do_virvcopy); /* vector with copy requests */
- map(SYS_PHYSVCOPY, do_vcopy); /* vector with copy requests */
map(SYS_SAFECOPYFROM, do_safecopy); /* copy with pre-granted permission */
map(SYS_SAFECOPYTO, do_safecopy); /* copy with pre-granted permission */
map(SYS_VSAFECOPY, do_vsafecopy); /* vectored safecopy */
* Jul 09, 2005 updated SYS_KILL to signal services (Jorrit N. Herder)
* Jun 21, 2005 created SYS_NICE for nice(2) kernel call (Ben J. Gras)
* Jun 21, 2005 created SYS_MEMSET to speed up exec(2) (Ben J. Gras)
- * Apr 12, 2005 updated SYS_VCOPY for virtual_copy() (Jorrit N. Herder)
* Jan 20, 2005 updated SYS_COPY for virtual_copy() (Jorrit N. Herder)
* Oct 24, 2004 created SYS_GETKSIG to support PM (Jorrit N. Herder)
* Oct 10, 2004 created handler for unused calls (Jorrit N. Herder)
#define do_copy do_unused
#endif
-_PROTOTYPE( int do_vcopy, (message *m_ptr) );
-#define do_virvcopy do_vcopy
-#if ! (USE_VIRVCOPY || USE_PHYSVCOPY)
-#define do_vcopy do_unused
-#endif
-
_PROTOTYPE( int do_umap, (message *m_ptr) );
#if ! USE_UMAP
#define do_umap do_unused
$(SYSTEM)(do_devio.o) \
$(SYSTEM)(do_vdevio.o) \
$(SYSTEM)(do_copy.o) \
- $(SYSTEM)(do_vcopy.o) \
$(SYSTEM)(do_umap.o) \
$(SYSTEM)(do_memset.o) \
$(SYSTEM)(do_setgrant.o) \
$(SYSTEM)(do_copy.o): do_copy.c
$(CC) do_copy.c
-$(SYSTEM)(do_vcopy.o): do_vcopy.c
- $(CC) do_vcopy.c
-
$(SYSTEM)(do_umap.o): do_umap.c
$(CC) do_umap.c
*
* The parameters for this kernel call are:
* SCP_FROM_TO other endpoint
- * SCP_INFO encoded: caller's own src/dst segment
+ * SCP_SEG segment in own address space
* SCP_GID grant id
* SCP_OFFSET offset within granted space
* SCP_ADDRESS address in own address space
{
static int access, src_seg, dst_seg;
- /* Set src and dst parameters.
- * The caller's seg is encoded in the SCP_INFO field.
- */
+ /* Set src and dst parameters. */
if(sys_call_code == SYS_SAFECOPYFROM) {
src_seg = D;
- dst_seg = SCP_INFO2SEG(m_ptr->SCP_INFO);
+ dst_seg = m_ptr->SCP_SEG;
access = CPF_READ;
} else if(sys_call_code == SYS_SAFECOPYTO) {
- src_seg = SCP_INFO2SEG(m_ptr->SCP_INFO);
+ src_seg = m_ptr->SCP_SEG;
dst_seg = D;
access = CPF_WRITE;
} else minix_panic("Impossible system call nr. ", sys_call_code);
+++ /dev/null
-/* The kernel call implemented in this file:
- * m_type: SYS_VIRVCOPY, SYS_PHYSVCOPY
- *
- * The parameters for this kernel call are:
- * m1_i3: VCP_VEC_SIZE size of copy request vector
- * m1_p1: VCP_VEC_ADDR address of vector at caller
- * m1_i2: VCP_NR_OK number of successfull copies
- */
-
-#include "../system.h"
-#include <minix/type.h>
-
-#if (USE_VIRVCOPY || USE_PHYSVCOPY)
-
-/* Buffer to hold copy request vector from user. */
-PRIVATE struct vir_cp_req vir_cp_req[VCOPY_VEC_SIZE];
-
-/*===========================================================================*
- * do_vcopy *
- *===========================================================================*/
-PUBLIC int do_vcopy(m_ptr)
-register message *m_ptr; /* pointer to request message */
-{
-/* Handle sys_virvcopy() and sys_physvcopy() that pass a vector with copy
- * requests. Although a single handler function is used, there are two
- * different kernel calls so that permissions can be checked.
- */
- int nr_req, r;
- vir_bytes caller_vir;
- phys_bytes bytes;
- int i,s;
- struct vir_cp_req *req;
- struct vir_addr src, dst;
- struct proc *pr;
-
- { static int first=1;
- if (first)
- {
- first= 0;
- kprintf("do_vcopy: got request from %d\n", m_ptr->m_source);
- }
- }
-
- if(!(pr = endpoint_lookup(who_e)))
- minix_panic("do_vcopy: caller doesn't exist", who_e);
-
- /* Check if request vector size is ok. */
- nr_req = (unsigned) m_ptr->VCP_VEC_SIZE;
- if (nr_req > VCOPY_VEC_SIZE) return(EINVAL);
- bytes = nr_req * sizeof(struct vir_cp_req);
-
- /* Calculate physical addresses and copy (port,value)-pairs from user. */
- src.segment = dst.segment = D;
- src.proc_nr_e = who_e;
- dst.proc_nr_e = SYSTEM;
- dst.offset = (vir_bytes) vir_cp_req;
- src.offset = (vir_bytes) m_ptr->VCP_VEC_ADDR;
-
- if((r=virtual_copy_vmcheck(&src, &dst, bytes)) != OK)
- return r;
-
- /* Assume vector with requests is correct. Try to copy everything. */
- m_ptr->VCP_NR_OK = 0;
- for (i=0; i<nr_req; i++) {
-
- req = &vir_cp_req[i];
-
- /* Check if physical addressing is used without SYS_PHYSVCOPY. */
- if (((req->src.segment | req->dst.segment) & PHYS_SEG) &&
- m_ptr->m_type != SYS_PHYSVCOPY) return(EPERM);
- if ((s=virtual_copy_vmcheck(&req->src, &req->dst, req->count)) != OK)
- return(s);
- m_ptr->VCP_NR_OK ++;
- }
- return(OK);
-}
-
-#endif /* (USE_VIRVCOPY || USE_PHYSVCOPY) */
-
_brk.c \
_cprofile.c \
_deldma.c \
- _devctl.c \
_getdents.c \
_getdma.c \
_getnpid.c \
_getsigset.c \
_getsysinfo.c \
_lseek64.c \
- _mapdriver5.c \
+ _mapdriver.c \
_mount.c \
_reboot.c \
_sbrk.c \
+++ /dev/null
-#include <lib.h>
-#define devctl _devctl
-#include <unistd.h>
-
-
-PUBLIC int devctl(int ctl_req, int proc_nr, int dev_nr, int dev_style,
- int force)
-{
- message m;
- m.m4_l1 = ctl_req;
- m.m4_l2 = proc_nr;
- m.m4_l3 = dev_nr;
- m.m4_l4 = dev_style;
- m.m4_l5 = force;
- if (_syscall(FS, DEVCTL, &m) < 0) return(-1);
- return(0);
-}
-
#include <lib.h>
-#define mapdriver5 _mapdriver5
+#define mapdriver _mapdriver
+#include <string.h>
#include <unistd.h>
-PUBLIC int mapdriver5(label, len, major, dev_style, force)
+PUBLIC int mapdriver(label, major, dev_style, force)
char *label;
-size_t len;
int major;
int dev_style;
int force;
{
message m;
m.m2_p1 = label;
- m.m2_l1 = len;
+ m.m2_l1 = strlen(label);
m.m2_i1 = major;
m.m2_i2 = dev_style;
m.m2_i3 = force;
cprofile.s \
creat.s \
deldma.s \
- devctl.s \
dup.s \
dup2.s \
execl.s \
lseek.s \
lseek64.s \
lstat.s \
- mapdriver5.s \
+ mapdriver.s \
mkdir.s \
mkfifo.s \
mknod.s \
+++ /dev/null
-.sect .text
-.extern __devctl
-.define _devctl
-.align 2
-
-_devctl:
- jmp __devctl
--- /dev/null
+.sect .text
+.extern __mapdriver
+.define _mapdriver
+.align 2
+
+_mapdriver:
+ jmp __mapdriver
+++ /dev/null
-.sect .text
-.extern __mapdriver5
-.define _mapdriver5
-.align 2
-
-_mapdriver5:
- jmp __mapdriver5
sys_vtimer.c \
taskcall.c \
ds.c \
- vm_allocmem.c \
vm_brk.c \
vm_ctl.c \
vm_exec_newmem.c \
message copy_mess;
copy_mess.SCP_FROM_TO = src_e;
- copy_mess.SCP_INFO = SCP_MAKEINFO(my_seg);
+ copy_mess.SCP_SEG = my_seg;
copy_mess.SCP_GID = gr_id;
copy_mess.SCP_OFFSET = (long) offset;
copy_mess.SCP_ADDRESS = (char *) address;
message copy_mess;
copy_mess.SCP_FROM_TO = dst_e;
- copy_mess.SCP_INFO = SCP_MAKEINFO(my_seg);
+ copy_mess.SCP_SEG = my_seg;
copy_mess.SCP_GID = gr_id;
copy_mess.SCP_OFFSET = (long) offset;
copy_mess.SCP_ADDRESS = (char *) address;
+++ /dev/null
-
-#include "syslib.h"
-
-#include <minix/vm.h>
-
-/*===========================================================================*
- * vm_allocmem *
- *===========================================================================*/
-PUBLIC int vm_allocmem(phys_clicks bytes, phys_clicks *retmembase)
-{
- message m;
- int result;
-
- m.VMAM_BYTES = (char *) bytes;
- result = _taskcall(VM_PROC_NR, VM_ALLOCMEM, &m);
- if(result == OK)
- *retmembase = m.VMAM_MEMBASE;
-
- return result;
-}
-
if (ticks <= 0) return OK; /* check for robustness */
- m.ALRM_ENDPT = SELF; /* SELF means this process nr */
m.ALRM_EXP_TIME = ticks; /* request message after ticks */
m.ALRM_ABS_TIME = 0; /* ticks are relative to now */
s = _taskcall(SYSTASK, SYS_SETALARM, &m);
.SH SYNOPSIS
\fBmount [\fB\-r\fR] [\fB\-t \fItype\fR] [\fB\-o \fIoptions\fR] \fIspecial \fIfile\fR
.br
-\fBmount [\fB\-s\fR] \fIswapfile\fR
-.br
.de FL
.TP
\\fB\\$1\\fR
.FL "\-r" "File system is mounted read-only"
.FL "\-t" "File system type"
.FL "\-o" "Options passed to FS server"
-.FL "\-s" "Mount swap space"
.SH EXAMPLES
.EX "mount /dev/fd1 /user" "Mount diskette 1 on \fI/user\fP"
.SH DESCRIPTION
.B \-o
flag may be used to pass options to the file system server.
The interpretation of these options is up to the server.
-.PP
-With the
-.B \-s
-flag a device or file is mounted as swap space.
.SH "SEE ALSO"
.BR df (1),
.BR mkfs (1),
.BR fsck (1),
-.BR mkswap (8),
.BR umount (1),
.BR mount (2),
.BR fstab (5).
.fi
.SH DESCRIPTION
.B Svrctl
-allows root to control the kernel in various ways, or implements some very
-MINIX 3 specific system calls that don't deserve their own system call number.
+implements some very MINIX 3 specific system calls that don't deserve their own
+system call number.
.PP
-This system call makes it easy to add new ways of setting and getting kernel
+This system call makes it easy to add new ways of setting and getting system
parameters, but at the same time, backwards compatibility is not guaranteed.
-Read the <sys/svrctl.h> include file to see what the struct's mentioned below
+Read the <sys/svrctl.h> include file to see what the structures mentioned below
look like. Most calls are root-only, unless specified otherwise.
.PP
The only way to know how to properly use these calls is to study the
-associated kernel or server code, or the programs that already use these
+associated server code, or the programs that already use these
calls.
.PP
Current requests are:
.TP 5
-.B MMSIGNON
-Inform MM that the current process wants to become a server.
-.TP
-.B MMSWAPON
-Instruct MM to mount a file or device as swapspace.
+.B MMGETPARAM
+Request the value of one or all boot parameters. Can be used by non-root.
.TP
-.B MMSWAPOFF
-Tell MM to stop using swapspace.
+.B MMSETPARAM
+Set an override for a value of a boot parameter. Can be used by non-root.
.TP
.B FSSIGNON
Register a new device with FS.
-.TP
-.B SYSSIGNON
-Inform the kernel that the process want to become a server.
-The processes task number is filled-in in a \fBstruct systaskinfo\fP.
-.TP
-.B SYSGETENV
-Request the value of one or all boot parameters. Can be used by non-root.
.SH "RETURN VALUES"
.B Svrctl
returns 0 upon success and -1 upon failure.
for disk 0 on controller 0. To make things interesting you can also place a
partition table in the first sector of a MINIX 3 partition, which divides the
partition into up to four subpartitions. Normally MINIX 3 is installed into a
-single partition, with the root, swap and /usr file systems in subpartitions.
+single partition, with the root, /home, and /usr file systems in subpartitions.
.PP
If a partition is an extended partition then it contains a linked list of
partition tables each of which may specify a logical partition. Up to four
.B /etc/fstab
is not read by
.B mount
-as it should be. It is instead a simple shell script listing the two or
-three devices that MINIX 3 needs to operate: The device names of the root
-file system, the swap file system (optional), and the file system for
+as it should be. It is instead a simple shell script listing the
+three devices that MINIX 3 needs to operate: the device names of the root
+file system, the file system for
+.BR /home ,
+and the file system for
.BR /usr .
.PP
.B /etc/mtab
.BR 1 ,
.BR 2 ,
or
-.BR swap ,
-indicating a V1 or a V2 file system, or swap space.
+.BR 3 ,
+indicating a V1, a V2, or a V3 file system.
.RE
.sp
.B options
.PP
\fBservice refresh\fR \fI<pid>\fR
.PP
-\fBservice rescue\fR \fI<dir>\fR
-.PP
\fBservice shutdown\fR
.br
.de FL
.PP
Stopping a system service requires the process id of a running system service. Issuing a kill command from the shell will not work, since the reincarnation server interprets this as an unexpected exit and will automatically restart a fresh copy of the process. The clean way to restart a process is using the refresh option of the service utility.
.PP
-The rescue call can be used to set the current working directory of the reincarnation server. By using a trusted rescue driver to shadow certain binaries in RAM the reincarnation server can check that rescue directory for binaries if the normal execution of the absolute path fails. This allows recovery from failures of the root file system driver.
-.PP
If the system is to be shutdown, the reincarnation server should know about this event to prevent it from restarting services that are killed during the shutdown
sequence.
.SH EXAMPLES
MB memory. See sections 16 and 17 on "low memory" issues.
.SS "3. MINIX INSTALLATION BACKGROUND"
The objective of the installation is to create a partition on your disk
-and to put MINIX into it. MINIX really requires at least two partitions
-however, so the single "primary" partition is split into two or three
-subpartitions.
+and to put MINIX into it. MINIX really requires three partitions
+however, so the single "primary" partition is split into three subpartitions.
The
.B s0
subpartition will contain the root file system, the
.B s1
-subpartition may optionally contain swapspace, and the
+subpartition will contain the
+.B /home
+file system, and the
.B s2
subpartition will contain the
.B /usr
/dev/c0d0p0 Windows C: drive
/dev/c0d0p1 MINIX primary partition
/dev/c0d0p1s0 MINIX root partition
-/dev/c0d0p1s1 MINIX swap partition (optional)
+/dev/c0d0p1s1 MINIX /home partition
/dev/c0d0p1s2 MINIX /usr partition
.in -8n
.fi
.PP
/dev/c0d0 is the sum of a partition table, /dev/c0d0p0 and /dev/c0d0p1.
-Likewise is /dev/c0d0p1 the sum of a subpartition table, /dev/c0d0p1s0 and
-/dev/c0d0p1s2. Read the "DEVICES" sections for more information on MINIX
-devices.
+Likewise is /dev/c0d0p1 the sum of a subpartition table, /dev/c0d0p1s0,
+/dev/c0d0p1s1, and /dev/c0d0p1s2.
+Read the "DEVICES" sections for more information on MINIX devices.
.SS "4. INSTALLATION"
.ig \" Only relevant when on CD-ROM.
If you have not already copied MINIX to floppy disks, please read
partition name is probably still visible on the screen. Combined with the
drive name you have to type c0d0p1, c0d2p0 or something.
.PP
-The next question is the amount of swapspace you want to give MINIX. There
-will be a suggested value based on the amount of memory your system has.
-If you have more then enough memory then don't bother with swap. MINIX
-doesn't handle it very well yet, or ever, only memory starved systems need it
-so that
-.B "make world"
-can run.
+The next question is the size of the /home partition that you want. There
+will be a suggested value based on the amount of disk space available.
.PP
The new partition table is reloaded into the disk driver, and the
-new MINIX partition is carved up into two or three subpartitions, a 1440 kb
-root, maybe some amount of swap, and the rest for /usr.
+new MINIX partition is carved up into two or three subpartitions, a
+root, the chosen amount for /home, and the rest for /usr.
.PP
After making /usr, it is immediately put to use to replace the installation
/usr file system so that you can remove the \s-2USR\s+2 diskette and insert
.B part
to make partitions to load the system into. The best thing to do is to make
one large primary partition of type "MINIX" and to carve this partition up
-into three subpartitions for root, swap and /usr. The assumption is that you
+into three subpartitions for root, /home, and /usr. The assumption is that you
will use the second partition on the first hard disk,
.BR /dev/c0d0p1 ,
and that
.B c0d0p1s0
is the root subpartition,
.B c0d0p1s1
-is swap and
+is /home, and
.B c0d0p1s2
is /usr. If you want to use the first partition on
the second hard disk for instance, then substitute c0d1p0 and c0d1p0s[012] for
outgrow a floppy. (The \s-2ROOT\s+2 diskette is a copy of a root file
system, and will be used to fill your root subpartition.)
.PP
-The second subpartition is for swapspace. You can use it to enlarge the
-amount of total memory (real + swap) if your system has less than 2M
-(16-bit mode) or 4M (32-bit mode). Note that only one MINIX swap partition
-is needed on your system, so if you have another MINIX partition then you can
-use its swap partition instead.
+The second subpartition is for the /home subpartition. You may choose to store
+your personal files there.
.PP
Use the rest of the partition for
.BR s2 ,
When you are done check that /dev/c0d0p1s0 is active (the * after the partition
number) so you can boot from it later.
.PP
-If your disk has bad blocks then don't put the root or swap subpartition
-on top of them. Make sure the inode tables in the other partitions don't
-have bad blocks either. You can put the subpartitions out of order on the
-disk if that helps. Subpartition tables, unlike the main partition
-table, are not sorted by the driver.
-.PP
After making the partitions you do not have to reboot. The disk driver
reloads the partition tables on the next access if the disk is not in use.
(Open or mounted.)
.PP
will put it there for sure.
.PP
-Let's start by initializing the swap partition first, if you allocated one.
-We may need it already, so mount it.
+Next make a file system for on-disk /home. Leave it empty for now.
.PP
-.XB "mkswap\0/dev/c0d0p1s1"
-.XB "mount\0\-s\0/dev/c0d0p1s1"
+.XB "mkfs\0/dev/c0d0p1s1"
.PP
Next make a file system for on-disk /usr and copy the floppy /usr on to it.
.PP
should look like this:
.PP
.XB "root=/dev/c0d0p1s0"
-.XB "swap=/dev/c0d0p1s1"
+.XB "home=/dev/c0d0p1s1"
.XB "usr=/dev/c0d0p1s2"
.PP
Unmount the new root:
PRIVATE time_t prev_time;
PRIVATE timer_t *timer_chain;
PRIVATE time_t next_timeout;
-#ifdef __minix_vmd
-PRIVATE int clck_tasknr= ANY;
-#endif
FORWARD _PROTOTYPE( void clck_fast_release, (timer_t *timer) );
FORWARD _PROTOTYPE( void set_timer, (void) );
prev_time= 0;
next_timeout= 0;
timer_chain= 0;
-
-#ifdef __minix_vmd
- r= sys_findproc(CLOCK_NAME, &clck_tasknr, 0);
- if (r != OK)
- ip_panic(( "unable to find clock task: %d\n", r ));
-#endif
}
PUBLIC time_t get_time()
{
if (!curr_time)
{
-#ifdef __minix_vmd
- static message mess;
-
- mess.m_type= GET_UPTIME;
- if (sendrec (clck_tasknr, &mess) < 0)
- ip_panic(("unable to sendrec"));
- if (mess.m_type != OK)
- ip_panic(("can't read clock"));
- curr_time= mess.NEW_TIME;
-#else /* Minix 3 */
int s;
if ((s=getuptime(&curr_time)) != OK)
ip_panic(("can't read clock"));
-#endif
assert(curr_time >= prev_time);
}
return curr_time;
if (next_timeout == 0 || new_time < next_timeout)
{
-#ifdef __minix_vmd
- static message mess;
-
- next_timeout= new_time;
-
- new_time -= curr_time;
-
- mess.m_type= SET_SYNC_AL;
- mess.CLOCK_PROC_NR= this_proc;
- mess.DELTA_TICKS= new_time;
- if (sendrec (clck_tasknr, &mess) < 0)
- ip_panic(("unable to sendrec"));
- if (mess.m_type != OK)
- ip_panic(("can't set timer"));
-#else /* Minix 3 */
next_timeout= new_time;
new_time -= curr_time;
if (sys_setalarm(new_time, 0) != OK)
ip_panic(("can't set timer"));
-#endif
}
}
int this_proc; /* Process number of this server. */
-#ifdef __minix_vmd
-static int synal_tasknr= ANY;
-#endif
-
/* Killing Solaris */
int killer_inet= 0;
int source, m_type, timerand, fd;
u32_t tasknr;
struct fssignon device;
-#ifdef __minix_vmd
- struct systaskinfo info;
-#endif
u8_t randbits[32];
struct timeval tv;
if (timerand)
{
printf("inet: using current time for random-number seed\n");
-#ifdef __minix_vmd
- r= sysutime(UTIME_TIMEOFDAY, &tv);
-#else /* Minix 3 */
r= gettimeofday(&tv, NULL);
-#endif
if (r == -1)
{
printf("sysutime failed: %s\n", strerror(errno));
}
init_rand256(randbits);
-#ifdef __minix_vmd
- if (svrctl(SYSSIGNON, (void *) &info) == -1) pause();
-
- /* Our new identity as a server. */
- this_proc = info.proc_nr;
-#else /* Minix 3 */
-
/* Our new identity as a server. */
r= ds_retrieve_u32("inet", &tasknr);
if (r != OK)
ip_panic(("inet: ds_retrieve_u32 failed for 'inet': %d", r));
this_proc= tasknr;
-#endif
/* Register the device group. */
device.dev= ip_dev;
killer_inet= 1;
}
-#ifdef __minix_vmd
- r= sys_findproc(SYN_AL_NAME, &synal_tasknr, 0);
- if (r != OK)
- ip_panic(( "unable to find synchronous alarm task: %d\n", r ));
-#endif
-
nw_init();
while (TRUE)
{
{
sr_rec(mq);
}
-#ifdef __minix_vmd
- else if (source == synal_tasknr)
- {
- clck_tick (&mq->mq_mess);
- mq_free(mq);
- }
-#else /* Minix 3 */
else if (is_notify(m_type))
{
if (_ENDPOINT_P(source) == CLOCK)
mq_free(mq);
}
}
-#endif
else if (m_type == DL_CONF_REPLY || m_type == DL_TASK_REPLY ||
m_type == DL_NAME_REPLY || m_type == DL_STAT_REPLY)
{
{
printf("\ninet stacktrace: ");
util_stacktrace();
-#ifdef __minix_vmd
- sys_abort(RBT_PANIC);
-#else /* Minix 3 */
(panic)("INET","aborted due to a panic",NO_NUM);
-#endif
for(;;);
}
#include <stdlib.h>
#include <string.h>
-#ifdef __minix_vmd
-
-#include <minix/ansi.h>
-#include <minix/cfg_public.h>
-#include <minix/type.h>
-
-#else /* Assume at least Minix 3.x */
-
#include <unistd.h>
#include <sys/ioc_file.h>
#include <sys/time.h>
typedef int ioreq_t;
-#endif
-
#include <minix/const.h>
#include <minix/com.h>
#include <minix/syslib.h>
}
eth_port->etp_osdep.etp_rd_vec_grant= gid;
-#ifdef __minix_vmd
- r= sys_findproc(ecp->ec_task, &tasknr, 0);
-#else /* Minix 3 */
r= ds_retrieve_u32(ecp->ec_task, &tasknr);
if (r != OK && r != ESRCH)
{
printf("inet: ds_retrieve_u32 failed for '%s': %d\n",
ecp->ec_task, r);
}
-#endif
if (r != OK)
{
/* Eventually, we expect ethernet drivers to be
#include "generic/assert.h"
#include <sys/svrctl.h>
-#ifdef __minix_vmd
-#include <minix/queryparam.h>
-#else /* Minix 3 */
#include <minix3/queryparam.h>
-#endif
#include "generic/buf.h"
#include "generic/clock.h"
*
* Requests:
*
- * m_type NDEV_MINOR NDEV_PROC NDEV_REF NDEV_MODE
- * -------------------------------------------------------------
- * | DEV_OPEN |minor dev | proc nr | fd | mode |
- * |-------------+-----------+-----------+-----------+----------+
- * | DEV_CLOSE |minor dev | proc nr | fd | |
- * |-------------+-----------+-----------+-----------+----------+
+ * m_type DEVICE IO_ENDPT COUNT
+ * --------------------------------------------------
+ * | DEV_OPEN | minor dev | proc nr | mode |
+ * |-------------+-----------+-----------+----------+
+ * | DEV_CLOSE | minor dev | proc nr | |
+ * |-------------+-----------+-----------+----------+
*
- * m_type NDEV_MINOR NDEV_PROC NDEV_REF NDEV_COUNT NDEV_BUFFER
- * ---------------------------------------------------------------------------
- * | DEV_READ |minor dev | proc nr | fd | count | buf ptr |
- * |-------------+-----------+-----------+-----------+-----------+-----------|
- * | DEV_WRITE |minor dev | proc nr | fd | count | buf ptr |
- * |-------------+-----------+-----------+-----------+-----------+-----------|
+ * m_type DEVICE IO_ENDPT COUNT IO_GRANT
+ * ---------------------------------------------------------------
+ * | DEV_READ_S | minor dev | proc nr | count | grant ID |
+ * |-------------+-----------+-----------+-----------+-----------|
+ * | DEV_WRITE_S | minor dev | proc nr | count | grant ID |
+ * |-------------+-----------+-----------+-----------+-----------|
+ * | DEV_IOCTL_S | minor dev | proc nr | command | grant ID |
+ * |-------------+-----------+-----------+-----------+-----------|
+ * | DEV_SELECT | minor dev | ops | | |
+ * |-------------+-----------+-----------+-----------+-----------|
*
- * m_type NDEV_MINOR NDEV_PROC NDEV_REF NDEV_IOCTL NDEV_BUFFER
- * ---------------------------------------------------------------------------
- * | DEV_IOCTL3 |minor dev | proc nr | fd | command | buf ptr |
- * |-------------+-----------+-----------+-----------+-----------+-----------|
- *
- * m_type NDEV_MINOR NDEV_PROC NDEV_REF NDEV_OPERATION
- * -------------------------------------------------------------------|
- * | DEV_CANCEL |minor dev | proc nr | fd | which operation|
- * |-------------+-----------+-----------+-----------+----------------|
+ * m_type
+ * --------------|
+ * | DEV_STATUS |
+ * |-------------|
+ *
+ * m_type DEVICE IO_ENDPT COUNT
+ * --------------------------------------------------|
+ * | CANCEL | minor dev | proc nr | mode |
+ * |-------------+-----------+-----------+-----------|
*
* Replies:
*
- * m_type REP_PROC_NR REP_STATUS REP_REF REP_OPERATION
- * ----------------------------------------------------------------------|
- * | DEVICE_REPLY | proc nr | status | fd | which operation |
- * |--------------+-------------+------------+---------+-----------------|
+ * m_type REP_ENDPT REP_STATUS REP_IO_GRANT
+ * -------------------------------------------------------|
+ * | TASK_REPLY | proc nr | status | grant ID |
+ * |---------------+-----------+-----------+--------------|
+ *
+ * m_type REP_ENDPT REP_STATUS REP_IO_GRANT
+ * ----------------+-----------+--------------------------|
+ * | DEV_REVIVE | proc nr | | grant ID |
+ * |---------------+-----------+-----------+--------------|
+ * | DEV_IO_READY | minor dev | sel ops | |
+ * |---------------+-----------+-----------+--------------|
+ * | DEV_NO_STATUS | | | |
+ * |---------------+-----------+-----------+--------------|
*/
#include "inet.h"
-#ifndef __minix_vmd /* Minix 3 */
-#include <sys/select.h>
-#endif
#include <sys/svrctl.h>
#include <minix/callnr.h>
#include "generic/sr.h"
#include "sr_int.h"
-#ifndef __minix_vmd /* Minix 3 */
-#define DEV_CANCEL NW_CANCEL
-#define DEVICE_REPLY TASK_REPLY
-#define DEV_IOCTL3 DEV_IOCTL
-#define NDEV_BUFFER ADDRESS
-#define NDEV_COUNT COUNT
-#define NDEV_IOCTL REQUEST
-#define NDEV_MINOR DEVICE
-#define NDEV_PROC IO_ENDPT
-#endif
-
THIS_FILE
PUBLIC sr_fd_t sr_fd_table[FD_NR];
PRIVATE mq_t *repl_queue, *repl_queue_tail;
-#ifdef __minix_vmd
-PRIVATE cpvec_t cpvec[CPVEC_NR];
-#else /* Minix 3 */
-PRIVATE struct vir_cp_req vir_cp_req[CPVEC_NR];
-PRIVATE struct vscp_vec s_cp_req[CPVEC_NR];
-#endif
+PRIVATE struct vscp_vec s_cp_req[SCPVEC_NR];
FORWARD _PROTOTYPE ( int sr_open, (message *m) );
FORWARD _PROTOTYPE ( void sr_close, (message *m) );
FORWARD _PROTOTYPE ( int sr_rwio, (mq_t *m) );
-FORWARD _PROTOTYPE ( int sr_rwio_s, (mq_t *m) );
FORWARD _PROTOTYPE ( int sr_restart_read, (sr_fd_t *fdp) );
FORWARD _PROTOTYPE ( int sr_restart_write, (sr_fd_t *fdp) );
FORWARD _PROTOTYPE ( int sr_restart_ioctl, (sr_fd_t *fdp) );
FORWARD _PROTOTYPE ( int sr_cancel, (message *m) );
-#ifndef __minix_vmd /* Minix 3 */
FORWARD _PROTOTYPE ( int sr_select, (message *m) );
FORWARD _PROTOTYPE ( void sr_status, (message *m) );
-#endif
FORWARD _PROTOTYPE ( void sr_reply_, (mq_t *m, int reply, int is_revive) );
FORWARD _PROTOTYPE ( sr_fd_t *sr_getchannel, (int minor));
FORWARD _PROTOTYPE ( acc_t *sr_get_userdata, (int fd, size_t offset,
size_t count, int for_ioctl) );
FORWARD _PROTOTYPE ( int sr_put_userdata, (int fd, size_t offset,
acc_t *data, int for_ioctl) );
-#ifdef __minix_vmd
-#define sr_select_res 0
-#else /* Minix 3 */
FORWARD _PROTOTYPE (void sr_select_res, (int fd, unsigned ops) );
-#endif
FORWARD _PROTOTYPE ( int sr_repl_queue, (int proc, int ref, int operation) );
FORWARD _PROTOTYPE ( int walk_queue, (sr_fd_t *sr_fd, mq_t **q_head_ptr,
mq_t **q_tail_ptr, int type, int proc_nr, int ref, int first_flag) );
FORWARD _PROTOTYPE ( void process_req_q, (mq_t *mq, mq_t *tail,
mq_t **tail_ptr) );
FORWARD _PROTOTYPE ( void sr_event, (event_t *evp, ev_arg_t arg) );
-FORWARD _PROTOTYPE ( int cp_u2b, (int proc, char *src, acc_t **var_acc_ptr,
- int size) );
-FORWARD _PROTOTYPE ( int cp_b2u, (acc_t *acc_ptr, int proc, char *dest) );
-FORWARD _PROTOTYPE ( int cp_u2b_s, (int proc, int gid, vir_bytes offset,
+FORWARD _PROTOTYPE ( int cp_u2b, (int proc, int gid, vir_bytes offset,
acc_t **var_acc_ptr, int size) );
-FORWARD _PROTOTYPE ( int cp_b2u_s, (acc_t *acc_ptr, int proc, int gid,
+FORWARD _PROTOTYPE ( int cp_b2u, (acc_t *acc_ptr, int proc, int gid,
vir_bytes offset) );
PUBLIC void sr_init()
if (repl_queue)
{
- if (m->mq_mess.m_type == DEV_CANCEL)
+ if (m->mq_mess.m_type == CANCEL)
{
-#ifdef __minix_vmd
- result= sr_repl_queue(m->mq_mess.NDEV_PROC,
- m->mq_mess.NDEV_REF,
- m->mq_mess.NDEV_OPERATION);
-#else /* Minix 3 */
result= sr_repl_queue(m->mq_mess.IO_ENDPT,
(int)m->mq_mess.IO_GRANT, 0);
-#endif
+
if (result)
{
mq_free(m);
send_reply= 1;
free_mess= 1;
break;
-#ifdef DEV_READ
- case DEV_READ:
- case DEV_WRITE:
- case DEV_IOCTL3:
- result= sr_rwio(m);
- assert(result == OK || result == SUSPEND);
- send_reply= (result == SUSPEND);
- free_mess= 0;
- break;
-#endif
case DEV_READ_S:
case DEV_WRITE_S:
case DEV_IOCTL_S:
- result= sr_rwio_s(m);
+ result= sr_rwio(m);
assert(result == OK || result == SUSPEND);
send_reply= (result == SUSPEND);
free_mess= 0;
break;
- case DEV_CANCEL:
+ case CANCEL:
result= sr_cancel(&m->mq_mess);
assert(result == OK || result == EINTR);
send_reply= (result == EINTR);
free_mess= 1;
-#ifdef __minix_vmd
- m->mq_mess.m_type= m->mq_mess.NDEV_OPERATION;
-#else /* Minix 3 */
m->mq_mess.m_type= 0;
-#endif
break;
-#ifndef __minix_vmd /* Minix 3 */
case DEV_SELECT:
result= sr_select(&m->mq_mess);
send_reply= 1;
send_reply= 0;
free_mess= 1;
break;
-#endif
default:
ip_panic(("unknown message, from %d, type %d",
m->mq_mess.m_source, m->mq_mess.m_type));
{
sr_fd_t *sr_fd;
- int minor= m->NDEV_MINOR;
+ int minor= m->DEVICE;
int i, fd;
if (minor<0 || minor>FD_NR)
{
sr_fd_t *sr_fd;
- sr_fd= sr_getchannel(m->NDEV_MINOR);
+ sr_fd= sr_getchannel(m->DEVICE);
assert (sr_fd);
if (sr_fd->srf_flags & SFF_BUSY)
ioreq_t request;
size_t size;
- sr_fd= sr_getchannel(m->mq_mess.NDEV_MINOR);
- assert (sr_fd);
-
- switch(m->mq_mess.m_type)
- {
-#ifdef DEV_READ
- case DEV_READ:
- q_head_ptr= &sr_fd->srf_read_q;
- q_tail_ptr= &sr_fd->srf_read_q_tail;
- ip_flag= SFF_READ_IP;
- susp_flag= SFF_READ_SUSP;
- first_flag= SFF_READ_FIRST;
- break;
- case DEV_WRITE:
- q_head_ptr= &sr_fd->srf_write_q;
- q_tail_ptr= &sr_fd->srf_write_q_tail;
- ip_flag= SFF_WRITE_IP;
- susp_flag= SFF_WRITE_SUSP;
- first_flag= SFF_WRITE_FIRST;
- break;
- case DEV_IOCTL3:
- q_head_ptr= &sr_fd->srf_ioctl_q;
- q_tail_ptr= &sr_fd->srf_ioctl_q_tail;
- ip_flag= SFF_IOCTL_IP;
- susp_flag= SFF_IOCTL_SUSP;
- first_flag= SFF_IOCTL_FIRST;
- break;
-#endif
- default:
- ip_panic(("illegal case entry"));
- }
-
- if (sr_fd->srf_flags & ip_flag)
- {
- assert(sr_fd->srf_flags & susp_flag);
- assert(*q_head_ptr);
-
- (*q_tail_ptr)->mq_next= m;
- *q_tail_ptr= m;
- return SUSPEND;
- }
- assert(!*q_head_ptr);
-
- *q_tail_ptr= *q_head_ptr= m;
- sr_fd->srf_flags |= ip_flag;
- assert(!(sr_fd->srf_flags & first_flag));
- sr_fd->srf_flags |= first_flag;
-
- switch(m->mq_mess.m_type)
- {
-#ifdef DEV_READ
- case DEV_READ:
- r= (*sr_fd->srf_read)(sr_fd->srf_fd,
- m->mq_mess.NDEV_COUNT);
- break;
- case DEV_WRITE:
- r= (*sr_fd->srf_write)(sr_fd->srf_fd,
- m->mq_mess.NDEV_COUNT);
- break;
- case DEV_IOCTL3:
- request= m->mq_mess.NDEV_IOCTL;
- size= (request >> 16) & _IOCPARM_MASK;
- if (size>MAX_IOCTL_S)
- {
- DBLOCK(1, printf("replying EINVAL\n"));
- r= sr_put_userdata(sr_fd-sr_fd_table, EINVAL,
- NULL, 1);
- assert(r == OK);
- assert(sr_fd->srf_flags & first_flag);
- sr_fd->srf_flags &= ~first_flag;
- return OK;
- }
- r= (*sr_fd->srf_ioctl)(sr_fd->srf_fd, request);
- break;
-#endif
- default:
- ip_panic(("illegal case entry"));
- }
-
- assert(sr_fd->srf_flags & first_flag);
- sr_fd->srf_flags &= ~first_flag;
-
- assert(r == OK || r == SUSPEND ||
- (printf("r= %d\n", r), 0));
- if (r == SUSPEND)
- sr_fd->srf_flags |= susp_flag;
- else
- mq_free(m);
- return r;
-}
-
-PRIVATE int sr_rwio_s(m)
-mq_t *m;
-{
- sr_fd_t *sr_fd;
- mq_t **q_head_ptr, **q_tail_ptr;
- int ip_flag, susp_flag, first_flag;
- int r;
- ioreq_t request;
- size_t size;
-
- sr_fd= sr_getchannel(m->mq_mess.NDEV_MINOR);
+ sr_fd= sr_getchannel(m->mq_mess.DEVICE);
assert (sr_fd);
switch(m->mq_mess.m_type)
{
case DEV_READ_S:
r= (*sr_fd->srf_read)(sr_fd->srf_fd,
- m->mq_mess.NDEV_COUNT);
+ m->mq_mess.COUNT);
break;
case DEV_WRITE_S:
r= (*sr_fd->srf_write)(sr_fd->srf_fd,
- m->mq_mess.NDEV_COUNT);
+ m->mq_mess.COUNT);
break;
case DEV_IOCTL_S:
- request= m->mq_mess.NDEV_IOCTL;
+ request= m->mq_mess.REQUEST;
size= (request >> 16) & _IOCPARM_MASK;
if (size>MAX_IOCTL_S)
{
sr_fd->srf_flags |= SFF_READ_IP;
r= (*sr_fd->srf_read)(sr_fd->srf_fd,
- mp->mq_mess.NDEV_COUNT);
+ mp->mq_mess.COUNT);
assert(r == OK || r == SUSPEND ||
(printf("r= %d\n", r), 0));
sr_fd->srf_flags |= SFF_WRITE_IP;
r= (*sr_fd->srf_write)(sr_fd->srf_fd,
- mp->mq_mess.NDEV_COUNT);
+ mp->mq_mess.COUNT);
assert(r == OK || r == SUSPEND ||
(printf("r= %d\n", r), 0));
sr_fd->srf_flags |= SFF_IOCTL_IP;
r= (*sr_fd->srf_ioctl)(sr_fd->srf_fd,
- mp->mq_mess.NDEV_COUNT);
+ mp->mq_mess.COUNT);
assert(r == OK || r == SUSPEND ||
(printf("r= %d\n", r), 0));
int proc_nr, ref, operation;
result=EINTR;
- proc_nr= m->NDEV_PROC;
-#ifdef __minix_vmd
- ref= m->NDEV_REF;
- operation= m->NDEV_OPERATION;
-#else /* Minix 3 */
+ proc_nr= m->IO_ENDPT;
ref= (int)m->IO_GRANT;
operation= 0;
-#endif
- sr_fd= sr_getchannel(m->NDEV_MINOR);
+ sr_fd= sr_getchannel(m->DEVICE);
assert (sr_fd);
-#ifdef __minix_vmd
- if (operation == CANCEL_ANY || operation == DEV_IOCTL3)
-#endif
- {
- result= walk_queue(sr_fd, &sr_fd->srf_ioctl_q,
- &sr_fd->srf_ioctl_q_tail, SR_CANCEL_IOCTL,
- proc_nr, ref, SFF_IOCTL_FIRST);
- if (result != EAGAIN)
- return result;
- }
-#ifdef __minix_vmd
- if (operation == CANCEL_ANY || operation == DEV_READ)
-#endif
- {
- result= walk_queue(sr_fd, &sr_fd->srf_read_q,
- &sr_fd->srf_read_q_tail, SR_CANCEL_READ,
- proc_nr, ref, SFF_READ_FIRST);
- if (result != EAGAIN)
- return result;
- }
-#ifdef __minix_vmd
- if (operation == CANCEL_ANY || operation == DEV_WRITE)
-#endif
- {
- result= walk_queue(sr_fd, &sr_fd->srf_write_q,
- &sr_fd->srf_write_q_tail, SR_CANCEL_WRITE,
- proc_nr, ref, SFF_WRITE_FIRST);
- if (result != EAGAIN)
- return result;
- }
-#ifdef __minix_vmd
- ip_panic((
-"request not found: from %d, type %d, MINOR= %d, PROC= %d, REF= %d OPERATION= %ld",
- m->m_source, m->m_type, m->NDEV_MINOR,
- m->NDEV_PROC, m->NDEV_REF, m->NDEV_OPERATION));
-#else /* Minix 3 */
+ result= walk_queue(sr_fd, &sr_fd->srf_ioctl_q,
+ &sr_fd->srf_ioctl_q_tail, SR_CANCEL_IOCTL,
+ proc_nr, ref, SFF_IOCTL_FIRST);
+ if (result != EAGAIN)
+ return result;
+
+ result= walk_queue(sr_fd, &sr_fd->srf_read_q,
+ &sr_fd->srf_read_q_tail, SR_CANCEL_READ,
+ proc_nr, ref, SFF_READ_FIRST);
+ if (result != EAGAIN)
+ return result;
+
+ result= walk_queue(sr_fd, &sr_fd->srf_write_q,
+ &sr_fd->srf_write_q_tail, SR_CANCEL_WRITE,
+ proc_nr, ref, SFF_WRITE_FIRST);
+ if (result != EAGAIN)
+ return result;
+
ip_panic((
"request not found: from %d, type %d, MINOR= %d, PROC= %d, REF= %d",
- m->m_source, m->m_type, m->NDEV_MINOR,
- m->NDEV_PROC, m->IO_GRANT));
-#endif
+ m->m_source, m->m_type, m->DEVICE,
+ m->IO_ENDPT, m->IO_GRANT));
}
-#ifndef __minix_vmd /* Minix 3 */
PRIVATE int sr_select(m)
message *m;
{
ioreq_t request;
size_t size;
- sr_fd= sr_getchannel(m->NDEV_MINOR);
+ sr_fd= sr_getchannel(m->DEVICE);
assert (sr_fd);
sr_fd->srf_select_proc= m->m_source;
if (result != OK)
ip_panic(("unable to send"));
}
-#endif
PRIVATE int walk_queue(sr_fd, q_head_ptr, q_tail_ptr, type, proc_nr, ref,
first_flag)
for(q_ptr_prv= NULL, q_ptr= *q_head_ptr; q_ptr;
q_ptr_prv= q_ptr, q_ptr= q_ptr->mq_next)
{
- if (q_ptr->mq_mess.NDEV_PROC != proc_nr)
+ if (q_ptr->mq_mess.IO_ENDPT != proc_nr)
continue;
-#ifdef __minix_vmd
- if (q_ptr->mq_mess.NDEV_REF != ref)
- continue;
-#else
if ((int)q_ptr->mq_mess.IO_GRANT != ref)
continue;
-#endif
if (!q_ptr_prv)
{
assert(!(sr_fd->srf_flags & first_flag));
int result, proc, ref,operation;
message reply, *mp;
- proc= mq->mq_mess.NDEV_PROC;
-#ifdef __minix_vmd
- ref= mq->mq_mess.NDEV_REF;
-#else /* Minix 3 */
+ proc= mq->mq_mess.IO_ENDPT;
ref= (int)mq->mq_mess.IO_GRANT;
-#endif
operation= mq->mq_mess.m_type;
-#ifdef __minix_vmd
- assert(operation != DEV_CANCEL);
-#endif
if (is_revive)
mp= &mq->mq_mess;
else
mp= &reply;
- mp->m_type= DEVICE_REPLY;
+ mp->m_type= TASK_REPLY;
mp->REP_ENDPT= proc;
mp->REP_STATUS= status;
-#ifdef __minix_vmd
- mp->REP_REF= ref;
- mp->REP_OPERATION= operation;
-#else
mp->REP_IO_GRANT= ref;
-#endif
if (is_revive)
{
notify(mq->mq_mess.m_source);
{
sr_fd_t *loc_fd;
mq_t **head_ptr, *m, *mq;
- int ip_flag, susp_flag, first_flag, m_type, safe_copy;
+ int ip_flag, susp_flag, first_flag;
int result, suspended, is_revive;
- char *src;
acc_t *acc;
event_t *evp;
ev_arg_t arg;
first_flag= SFF_WRITE_FIRST;
}
-assert (loc_fd->srf_flags & ip_flag);
+ assert (loc_fd->srf_flags & ip_flag);
if (!count)
{
return NULL;
}
- m_type= (*head_ptr)->mq_mess.m_type;
- if (m_type == DEV_READ_S || m_type == DEV_WRITE_S ||
- m_type == DEV_IOCTL_S)
- {
- safe_copy= 1;
- }
- else
- {
-#ifdef DEV_READ
- assert(m_type == DEV_READ || m_type == DEV_WRITE ||
- m_type == DEV_IOCTL);
-#else
- ip_panic(("sr_get_userdata: m_type not *_S\n"));
-#endif
- safe_copy= 0;
- }
-
- if (safe_copy)
- {
- result= cp_u2b_s ((*head_ptr)->mq_mess.NDEV_PROC,
- (int)(*head_ptr)->mq_mess.NDEV_BUFFER, offset, &acc,
- count);
- }
- else
- {
- src= (*head_ptr)->mq_mess.NDEV_BUFFER + offset;
- result= cp_u2b ((*head_ptr)->mq_mess.NDEV_PROC, src, &acc,
- count);
- }
+ result= cp_u2b ((*head_ptr)->mq_mess.IO_ENDPT,
+ (int)(*head_ptr)->mq_mess.IO_GRANT, offset, &acc, count);
return result<0 ? NULL : acc;
}
{
sr_fd_t *loc_fd;
mq_t **head_ptr, *m, *mq;
- int ip_flag, susp_flag, first_flag, m_type, safe_copy;
+ int ip_flag, susp_flag, first_flag;
int result, suspended, is_revive;
- char *dst;
event_t *evp;
ev_arg_t arg;
return OK;
}
- m_type= (*head_ptr)->mq_mess.m_type;
- if (m_type == DEV_READ_S || m_type == DEV_WRITE_S ||
- m_type == DEV_IOCTL_S)
- {
- safe_copy= 1;
- }
- else
- {
-#ifdef DEV_READ
- assert(m_type == DEV_READ || m_type == DEV_WRITE ||
- m_type == DEV_IOCTL);
-#else
- ip_panic(("sr_put_userdata: m_type not *_S\n"));
-#endif
- safe_copy= 0;
- }
-
- if (safe_copy)
- {
- return cp_b2u_s (data, (*head_ptr)->mq_mess.NDEV_PROC,
- (int)(*head_ptr)->mq_mess.NDEV_BUFFER, offset);
- }
- else
- {
- dst= (*head_ptr)->mq_mess.NDEV_BUFFER + offset;
- return cp_b2u (data, (*head_ptr)->mq_mess.NDEV_PROC, dst);
- }
+ return cp_b2u (data, (*head_ptr)->mq_mess.IO_ENDPT,
+ (int)(*head_ptr)->mq_mess.IO_GRANT, offset);
}
-#ifndef __minix_vmd /* Minix 3 */
PRIVATE void sr_select_res(fd, ops)
int fd;
unsigned ops;
notify(sr_fd->srf_select_proc);
}
-#endif
PRIVATE void process_req_q(mq, tail, tail_ptr)
mq_t *mq, *tail, **tail_ptr;
}
return;
}
- ip_panic(("sr_event: unkown event\n"));
+ ip_panic(("sr_event: unknown event\n"));
}
-PRIVATE int cp_u2b (proc, src, var_acc_ptr, size)
-int proc;
-char *src;
-acc_t **var_acc_ptr;
-int size;
-{
- static message mess;
- acc_t *acc;
- int i;
-
- acc= bf_memreq(size);
-
- *var_acc_ptr= acc;
- i=0;
-
- while (acc)
- {
- size= (vir_bytes)acc->acc_length;
-
-#ifdef __minix_vmd
- cpvec[i].cpv_src= (vir_bytes)src;
- cpvec[i].cpv_dst= (vir_bytes)ptr2acc_data(acc);
- cpvec[i].cpv_size= size;
-#else /* Minix 3 */
- vir_cp_req[i].count= size;
- vir_cp_req[i].src.proc_nr_e = proc;
- vir_cp_req[i].src.segment = D;
- vir_cp_req[i].src.offset = (vir_bytes) src;
- vir_cp_req[i].dst.proc_nr_e = this_proc;
- vir_cp_req[i].dst.segment = D;
- vir_cp_req[i].dst.offset = (vir_bytes) ptr2acc_data(acc);
-#endif
-
- src += size;
- acc= acc->acc_next;
- i++;
-
- if (i == CPVEC_NR || acc == NULL)
- {
-#ifdef __minix_vmd
- mess.m_type= SYS_VCOPY;
- mess.m1_i1= proc;
- mess.m1_i2= this_proc;
- mess.m1_i3= i;
- mess.m1_p1= (char *)cpvec;
-#else /* Minix 3 */
- mess.m_type= SYS_VIRVCOPY;
- mess.VCP_VEC_SIZE= i;
- mess.VCP_VEC_ADDR= (char *)vir_cp_req;
-#endif
- if (sendrec(SYSTASK, &mess) <0)
- ip_panic(("unable to sendrec"));
- if (mess.m_type <0)
- {
- bf_afree(*var_acc_ptr);
- *var_acc_ptr= 0;
- return mess.m_type;
- }
- i= 0;
- }
- }
- return OK;
-}
-
-PRIVATE int cp_b2u (acc_ptr, proc, dest)
-acc_t *acc_ptr;
-int proc;
-char *dest;
-{
- static message mess;
- acc_t *acc;
- int i, size;
-
- acc= acc_ptr;
- i=0;
-
- while (acc)
- {
- size= (vir_bytes)acc->acc_length;
-
- if (size)
- {
-#ifdef __minix_vmd
- cpvec[i].cpv_src= (vir_bytes)ptr2acc_data(acc);
- cpvec[i].cpv_dst= (vir_bytes)dest;
- cpvec[i].cpv_size= size;
-#else /* Minix 3 */
- vir_cp_req[i].src.proc_nr_e = this_proc;
- vir_cp_req[i].src.segment = D;
- vir_cp_req[i].src.offset= (vir_bytes)ptr2acc_data(acc);
- vir_cp_req[i].dst.proc_nr_e = proc;
- vir_cp_req[i].dst.segment = D;
- vir_cp_req[i].dst.offset= (vir_bytes)dest;
- vir_cp_req[i].count= size;
-#endif
- i++;
- }
-
- dest += size;
- acc= acc->acc_next;
-
- if (i == CPVEC_NR || acc == NULL)
- {
-#ifdef __minix_vmd
- mess.m_type= SYS_VCOPY;
- mess.m1_i1= this_proc;
- mess.m1_i2= proc;
- mess.m1_i3= i;
- mess.m1_p1= (char *)cpvec;
-#else /* Minix 3 */
- mess.m_type= SYS_VIRVCOPY;
- mess.VCP_VEC_SIZE= i;
- mess.VCP_VEC_ADDR= (char *) vir_cp_req;
-#endif
- if (sendrec(SYSTASK, &mess) <0)
- ip_panic(("unable to sendrec"));
- if (mess.m_type <0)
- {
- bf_afree(acc_ptr);
- return mess.m_type;
- }
- i= 0;
- }
- }
- bf_afree(acc_ptr);
- return OK;
-}
-
-PRIVATE int cp_u2b_s(proc, gid, offset, var_acc_ptr, size)
+PRIVATE int cp_u2b(proc, gid, offset, var_acc_ptr, size)
int proc;
int gid;
vir_bytes offset;
i= 0;
continue;
}
- if (i == CPVEC_NR || acc == NULL)
+ if (i == SCPVEC_NR || acc == NULL)
{
r= sys_vsafecopy(s_cp_req, i);
if (r <0)
{
- printf("cp_u2b_s: sys_vsafecopy failed: %d\n",
+ printf("cp_u2b: sys_vsafecopy failed: %d\n",
r);
bf_afree(*var_acc_ptr);
*var_acc_ptr= 0;
return OK;
}
-PRIVATE int cp_b2u_s(acc_ptr, proc, gid, offset)
+PRIVATE int cp_b2u(acc_ptr, proc, gid, offset)
acc_t *acc_ptr;
int proc;
int gid;
i= 0;
continue;
}
- if (i == CPVEC_NR || acc == NULL)
+ if (i == SCPVEC_NR || acc == NULL)
{
r= sys_vsafecopy(s_cp_req, i);
if (r <0)
{
- printf("cp_b2u_s: sys_vsafecopy failed: %d\n",
+ printf("cp_b2u: sys_vsafecopy failed: %d\n",
r);
bf_afree(acc_ptr);
return r;
int operation;
{
mq_t *m, *m_cancel, *m_tmp;
-#ifndef __minix_vmd
mq_t *new_queue;
-#endif
int result;
m_cancel= NULL;
for (m= repl_queue; m;)
{
-#ifdef __minix_vmd
- if (m->mq_mess.REP_ENDPT == proc &&
- m->mq_mess.REP_REF == ref &&
- (m->mq_mess.REP_OPERATION == operation ||
- operation == CANCEL_ANY))
-#else /* Minix 3 */
if (m->mq_mess.REP_ENDPT == proc &&
m->mq_mess.REP_IO_GRANT == ref)
-#endif
{
-assert(!m_cancel);
+ assert(!m_cancel);
m_cancel= m;
m= m->mq_next;
continue;
}
-#ifdef __minix_vmd
- result= send(m->mq_mess.m_source, &m->mq_mess);
- if (result != OK)
- ip_panic(("unable to send: %d", result));
- m_tmp= m;
- m= m->mq_next;
- mq_free(m_tmp);
-#else /* Minix 3 */
m_tmp= m;
m= m->mq_next;
m_tmp->mq_next= new_queue;
new_queue= m_tmp;
-#endif
}
- repl_queue= NULL;
-#ifndef __minix_vmd /* Minix 3 */
repl_queue= new_queue;
-#endif
if (m_cancel)
{
result= send(m_cancel->mq_mess.m_source, &m_cancel->mq_mess);
*
* The entry points into this file are:
* do_exec: perform the EXEC system call
- * exec_newmem: allocate new memory map for a process that tries to exec
+ * do_exec_newmem: allocate new memory map for a process that tries to exec
* do_execrestart: finish the special exec call for RS
* exec_restart: finish a regular exec call
* find_share: find a process whose text segment can be shared
/*===========================================================================*
- * exec_newmem *
+ * do_exec_newmem *
*===========================================================================*/
-PUBLIC int exec_newmem()
+PUBLIC int do_exec_newmem()
{
int proc_e, proc_n, allow_setuid;
char *ptr;
proc_e= m_in.EXC_NM_PROC;
if (pm_isokendpt(proc_e, &proc_n) != OK)
{
- panic(__FILE__, "exec_newmem: got bad endpoint",
+ panic(__FILE__, "do_exec_newmem: got bad endpoint",
proc_e);
}
rmp= &mproc[proc_n];
r= sys_datacopy(who_e, (vir_bytes)ptr,
SELF, (vir_bytes)&args, sizeof(args));
if (r != OK)
- panic(__FILE__, "exec_newmem: sys_datacopy failed", r);
+ panic(__FILE__, "do_exec_newmem: sys_datacopy failed", r);
if((r=vm_exec_newmem(proc_e, &args, sizeof(args), &stack_top, &flags)) == OK) {
allow_setuid= 0; /* Do not allow setuid execution */
else
result= ENOSYS;
break;
- case ALLOCMEM:
- result= do_allocmem();
- break;
- case FORK_NB:
- result= do_fork_nb();
- break;
- case EXEC_NEWMEM:
- result= exec_newmem();
- break;
- case EXEC_RESTART:
- result= do_execrestart();
- break;
- case PROCSTAT:
- result= do_procstat();
- break;
- case GETPROCNR:
- result= do_getprocnr();
- break;
- case GETEPINFO:
- result= do_getepinfo();
- break;
default:
/* Else, if the system call number is valid, perform the
* call.
rmp->mp_endpoint = ip->endpoint;
/* Tell FS about this system process. */
- mess.PR_SLOT = ip->proc_nr;
- mess.PR_PID = rmp->mp_pid;
- mess.PR_ENDPT = rmp->mp_endpoint;
+ mess.m_type = PM_INIT;
+ mess.PM_SLOT = ip->proc_nr;
+ mess.PM_PID = rmp->mp_pid;
+ mess.PM_PROC = rmp->mp_endpoint;
if (OK != (s=send(FS_PROC_NR, &mess)))
panic(__FILE__,"can't sync up with FS", s);
}
* do_getsysinfo: request copy of PM data structure (Jorrit N. Herder)
* do_getprocnr: lookup process slot number (Jorrit N. Herder)
* do_getepinfo: get the pid/uid/gid of a process given its endpoint
- * do_allocmem: allocate a chunk of memory (Jorrit N. Herder)
- * do_freemem: deallocate a chunk of memory (Jorrit N. Herder)
* do_getsetpriority: get/set process priority
* do_svrctl: process manager control
*/
PUBLIC unsigned long calls_stats[NCALLS];
#endif
-FORWARD _PROTOTYPE( int getpciinfo, (struct pciinfo *pciinfo) );
-
-/*===========================================================================*
- * do_allocmem *
- *===========================================================================*/
-PUBLIC int do_allocmem()
-{
- int r;
- phys_bytes retmembase;
- r = vm_allocmem(m_in.memsize, (phys_clicks *) &retmembase);
- if(r == OK)
- mp->mp_reply.membase = retmembase;
- return r;
-}
-
-/*===========================================================================*
- * do_freemem *
- *===========================================================================*/
-PUBLIC int do_freemem()
-{
-#if 1
- return ENOSYS;
-#else
- vir_clicks mem_clicks;
- phys_clicks mem_base;
-
- /* This call is dangerous. Even memory belonging to other processes can
- * be freed.
- */
- if (mp->mp_effuid != 0)
- {
- printf("PM: unauthorized call of do_freemem by proc %d\n",
- mp->mp_endpoint);
- sys_sysctl_stacktrace(mp->mp_endpoint);
- return EPERM;
- }
-
- mem_clicks = (m_in.memsize + CLICK_SIZE -1 ) >> CLICK_SHIFT;
- mem_base = (m_in.membase + CLICK_SIZE -1 ) >> CLICK_SHIFT;
- free_mem(mem_base, mem_clicks);
- return(OK);
-#endif
-}
+FORWARD _PROTOTYPE( int getpciinfo, (struct pciinfo *pciinfo) );
/*===========================================================================*
* do_procstat *
/* exec.c */
_PROTOTYPE( int do_exec, (void) );
-_PROTOTYPE( int exec_newmem, (void) );
+_PROTOTYPE( int do_exec_newmem, (void) );
_PROTOTYPE( int do_execrestart, (void) );
_PROTOTYPE( void exec_restart, (struct mproc *rmp, int result) );
_PROTOTYPE( int do_getprocnr, (void) );
_PROTOTYPE( int do_getepinfo, (void) );
_PROTOTYPE( int do_svrctl, (void) );
-_PROTOTYPE( int do_allocmem, (void) );
-_PROTOTYPE( int do_freemem, (void) );
_PROTOTYPE( int do_getsetpriority, (void) );
/* profile.c */
do_getsysinfo_up,/* 97 = getsysinfo_up */
do_sprofile, /* 98 = sprofile */
do_cprofile, /* 99 = cprofile */
- no_sys, /* 100 = unused */
- no_sys, /* 101 = unused */
- no_sys, /* 102 = unused */
- no_sys, /* 103 = unused */
- no_sys, /* 104 = unused */
+ /* THE MINIX3 ABI ENDS HERE */
+ do_exec_newmem, /* 100 = exec_newmem */
+ do_fork_nb, /* 101 = forknb */
+ do_execrestart, /* 102 = exec_restart */
+ do_procstat, /* 103 = procstat */
+ do_getprocnr, /* 104 = getprocnr */
no_sys, /* 105 = unused */
no_sys, /* 106 = unused */
- no_sys, /* 107 = unused */
+ do_getepinfo, /* 107 = getepinfo */
do_adddma, /* 108 = adddma */
do_deldma, /* 109 = deldma */
do_getdma, /* 110 = getdma */
*/
#define MAX_SCRIPT_LEN 256 /* maximum restart script name length */
#define MAX_NR_ARGS 4 /* maximum number of arguments */
-#define MAX_RESCUE_DIR_LEN 64 /* maximum rescue dir length */
#define MAX_IPC_LIST 256 /* Max size of list for IPC target
* process names
* process, because VFS may be blocked on a sendrec() to a MFS that is
* waiting for a endpoint update for a dead driver. We have just published
* that update, but VFS may still be blocked. As a result, VFS may not yet
- * have received PM's fork message. Hence, if we call mapdriver5()
+ * have received PM's fork message. Hence, if we call mapdriver()
* immediately, VFS may not know about the process and thus refuse to add the
* driver entry. The following temporary hack works around this by forcing
* blocking communication from PM to VFS. Once VFS has been made non-blocking
/* Map the new service. */
if (rp->r_dev_nr > 0) { /* set driver map */
- if ((s=mapdriver5(rp->r_label, strlen(rp->r_label),
+ if ((s=mapdriver(rp->r_label,
rp->r_dev_nr, rp->r_dev_style, !!use_copy /* force */)) < 0) {
report("RS", "couldn't map driver (continuing)", errno);
}
/* The following are relative to optind */
#define ARG_REQUEST 0 /* request to perform */
-#define ARG_PATH 1 /* rescue dir or system service */
+#define ARG_PATH 1 /* system service */
#define ARG_LABEL 1 /* name of system service */
#define ARG_LU_STATE 2 /* the state required to update */
#define ARG_PREPARE_MAXTIME 3 /* max time to prepare for the update */
fprintf(stderr, " %s refresh label\n", app_name);
fprintf(stderr, " %s restart label\n", app_name);
fprintf(stderr, " %s update label state maxtime\n", app_name);
- fprintf(stderr, " %s rescue <dir>\n", app_name);
fprintf(stderr, " %s shutdown\n", app_name);
fprintf(stderr, "\n");
}
* once at runtime.
*/
#define FS_KC SYS_KILL, SYS_VIRCOPY, SYS_SAFECOPYFROM, SYS_SAFECOPYTO, \
- SYS_VIRVCOPY, SYS_UMAP, SYS_GETINFO, SYS_EXIT, SYS_TIMES, SYS_SETALARM, \
+ SYS_UMAP, SYS_GETINFO, SYS_EXIT, SYS_TIMES, SYS_SETALARM, \
SYS_PRIVCTL, SYS_TRACE , SYS_SETGRANT, SYS_PROFBUF, SYS_SYSCTL
#define DRV_KC FS_KC, SYS_SEGCTL, SYS_IRQCTL, SYS_INT86, SYS_DEVIO, \
SYS_SDEVIO, SYS_VDEVIO, SYS_SETGRANT, SYS_PROFBUF, SYS_SYSCTL
drv_kc[] = { DRV_KC, SYS_NULL_C },
tty_kc[] = { DRV_KC, SYS_PHYSCOPY, SYS_ABORT, SYS_IOPENABLE,
SYS_READBIOS, SYS_NULL_C },
- mem_kc[] = { DRV_KC, SYS_PHYSCOPY, SYS_PHYSVCOPY, SYS_IOPENABLE, SYS_NULL_C },
+ mem_kc[] = { DRV_KC, SYS_PHYSCOPY, SYS_IOPENABLE, SYS_NULL_C },
rusr_kc[] = { SYS_NULL_C },
no_kc[] = { SYS_NULL_C }; /* no kernel call */
/* Miscellaneous constants */
#define SU_UID ((uid_t) 0) /* super_user's uid_t */
#define SERVERS_UID ((uid_t) 11) /* who may do FSSIGNON */
-#define SYS_UID ((uid_t) 0) /* uid_t for processes MM and INIT */
-#define SYS_GID ((gid_t) 0) /* gid_t for processes MM and INIT */
+#define SYS_UID ((uid_t) 0) /* uid_t for system processes and INIT */
+#define SYS_GID ((gid_t) 0) /* gid_t for system processes and INIT */
#define FP_BLOCKED_ON_NONE 0 /* not blocked */
#define FP_BLOCKED_ON_PIPE 1 /* susp'd on pipe */
#endif /* IBM_PC */
};
-FORWARD _PROTOTYPE( int map_driverX, (char *label, int major,
- endpoint_t proc_nr_e, int style, int force) );
-
-/*===========================================================================*
- * do_devctl *
- *===========================================================================*/
-PUBLIC int do_devctl()
-{
- if (!super_user)
- {
- printf("FS: unauthorized call of do_devctl by proc %d\n",
- who_e);
- return(EPERM); /* only su (should be only RS or some drivers)
- * may call do_devctl.
- */
- }
- return fs_devctl(m_in.ctl_req, m_in.dev_nr, m_in.driver_nr,
- m_in.dev_style, m_in.m_force);
-}
-
-/*===========================================================================*
- * fs_devctl *
- *===========================================================================*/
-PUBLIC int fs_devctl(req, dev, proc_nr_e, style, force)
-int req;
-int dev;
-int proc_nr_e;
-int style;
-int force;
-{
- int result, proc_nr_n;
-
- switch(req) {
- case DEV_MAP:
- if (!force)
- {
- /* Check process number of new driver. */
- if (isokendpt(proc_nr_e, &proc_nr_n) != OK)
- return(EINVAL);
- }
-
- /* Try to update device mapping. */
- result = map_driver(dev, proc_nr_e, style, force);
- if (result == OK)
- {
- /* If a driver has completed its exec(), it can be announced to be
- * up.
- */
- if(force || fproc[proc_nr_n].fp_execced) {
- dev_up(dev);
- } else {
- dmap[dev].dmap_flags |= DMAP_BABY;
- }
- }
- break;
- case DEV_UNMAP:
- result = map_driver(dev, NONE, 0, 0);
- break;
- default:
- result = EINVAL;
- }
- return(result);
-}
-
-
/*===========================================================================*
* do_mapdriver *
*===========================================================================*/
/* Try to update device mapping. */
major= m_in.md_major;
force= m_in.md_force;
- r= map_driverX(label, major, tasknr, m_in.md_style, force);
+ r= map_driver(label, major, tasknr, m_in.md_style, force);
if (r == OK)
{
/* If a driver has completed its exec(), it can be announced
return(r);
}
-
/*===========================================================================*
* map_driver *
*===========================================================================*/
-PUBLIC int map_driver(major, proc_nr_e, style, force)
-int major; /* major number of the device */
-int proc_nr_e; /* process number of the driver */
-int style; /* style of the device */
-int force;
-{
-/* Set a new device driver mapping in the dmap table. Given that correct
- * arguments are given, this only works if the entry is mutable and the
- * current driver is not busy. If the proc_nr is set to NONE, we're supposed
- * to unmap it.
- *
- * Normal error codes are returned so that this function can be used from
- * a system call that tries to dynamically install a new driver.
- */
- struct dmap *dp;
- int proc_nr_n;
-
- /* Get pointer to device entry in the dmap table. */
- if (major < 0 || major >= NR_DEVICES) return(ENODEV);
- dp = &dmap[major];
-
- /* Check if we're supposed to unmap it. If so, do it even
- * if busy or unmutable, as unmap is called when driver has
- * exited.
- */
- if(proc_nr_e == NONE) {
- dp->dmap_opcl = no_dev;
- dp->dmap_io = no_dev_io;
- dp->dmap_driver = NONE;
- dp->dmap_flags = DMAP_MUTABLE; /* When gone, not busy or reserved. */
- return(OK);
- }
-
- /* See if updating the entry is allowed. */
- if (! (dp->dmap_flags & DMAP_MUTABLE)) return(EPERM);
- if (dp->dmap_flags & DMAP_BUSY) return(EBUSY);
-
- if (!force)
- {
- /* Check process number of new driver. */
- if (isokendpt(proc_nr_e, &proc_nr_n) != OK)
- return(EINVAL);
- }
-
- /* Try to update the entry. */
- switch (style) {
- case STYLE_DEV: dp->dmap_opcl = gen_opcl; break;
- case STYLE_TTY: dp->dmap_opcl = tty_opcl; break;
- case STYLE_CLONE: dp->dmap_opcl = clone_opcl; break;
- default: return(EINVAL);
- }
- dp->dmap_io = gen_io;
- dp->dmap_driver = proc_nr_e;
-
- return(OK);
-}
-
-
-/*===========================================================================*
- * map_driverX *
- *===========================================================================*/
-PRIVATE int map_driverX(label, major, proc_nr_e, style, force)
+PUBLIC int map_driver(label, major, proc_nr_e, style, force)
char *label; /* name of the driver */
int major; /* major number of the device */
endpoint_t proc_nr_e; /* process number of the driver */
return(EINVAL);
}
- len= strlen(label);
- if (len+1 > sizeof(dp->dmap_label))
- panic(__FILE__, "map_driver: label too long", len);
- strcpy(dp->dmap_label, label);
+ if (label != NULL) {
+ len= strlen(label);
+ if (len+1 > sizeof(dp->dmap_label))
+ panic(__FILE__, "map_driver: label too long", len);
+ strcpy(dp->dmap_label, label);
+ }
/* Try to update the entry. */
switch (style) {
int i, r;
for (i=0; i<NR_DEVICES; i++)
if(dmap[i].dmap_driver && dmap[i].dmap_driver == proc_nr_e)
- if((r=map_driver(i, NONE, 0, 0)) != OK)
+ if((r=map_driver(NULL, i, NONE, 0, 0)) != OK)
printf("FS: unmap of p %d / d %d failed: %d\n", proc_nr_e,i,r);
return;
/* Other calls. */
switch(call_nr)
{
- case DEVCTL:
- error= do_devctl();
- if (error != SUSPEND) reply(who_e, error);
- break;
-
case MAPDRIVER:
error= do_mapdriver();
if (error != SUSPEND) reply(who_e, error);
do {
if (OK != (s=sef_receive(PM_PROC_NR, &mess)))
panic(__FILE__,"FS couldn't receive from PM", s);
- if (NONE == mess.PR_ENDPT) break;
- rfp = &fproc[mess.PR_SLOT];
- rfp->fp_pid = mess.PR_PID;
- rfp->fp_endpoint = mess.PR_ENDPT;
+ if (mess.m_type != PM_INIT)
+ panic(__FILE__, "unexpected message from PM", mess.m_type);
+
+ if (NONE == mess.PM_PROC) break;
+
+ rfp = &fproc[mess.PM_SLOT];
+ rfp->fp_pid = mess.PM_PID;
+ rfp->fp_endpoint = mess.PM_PROC;
rfp->fp_realuid = (uid_t) SYS_UID;
rfp->fp_effuid = (uid_t) SYS_UID;
rfp->fp_realgid = (gid_t) SYS_GID;
* do_sync: perform the SYNC system call
* do_fsync: perform the FSYNC system call
* do_reboot: sync disks and prepare for shutdown
- * do_fork: adjust the tables after MM has performed a FORK system call
- * do_exec: handle files with FD_CLOEXEC on after MM has done an EXEC
+ * do_fork: adjust the tables after PM has performed a FORK system call
+ * do_exec: handle files with FD_CLOEXEC on after PM has done an EXEC
* do_exit: a process has exited; note that in the tables
* do_set: set uid or gid for some process
* do_revive: revive a process that was waiting for something (e.g. TTY)
/* Perform those aspects of the fork() system call that relate to files.
* In particular, let the child inherit its parent's file descriptors.
* The parent and child parameters tell who forked off whom. The file
- * system uses the same slot numbers as the kernel. Only MM makes this call.
+ * system uses the same slot numbers as the kernel. Only PM makes this call.
*/
register struct fproc *cp;
/* Try to update device mapping. */
major = (device.dev >> MAJOR) & BYTE;
- r=map_driver(major, who_e, device.style, 0 /* !force */);
+ r=map_driver(NULL, major, who_e, device.style, 0 /* !force */);
if (r == OK)
{
/* If a driver has completed its exec(), it can be announced
return(r);
}
- case FSDEVUNMAP: {
- struct fsdevunmap fdu;
- int r, major;
- /* Try to copy request structure to FS. */
- if ((r = sys_datacopy(who_e, (vir_bytes) m_in.svrctl_argp,
- FS_PROC_NR, (vir_bytes) &fdu,
- (phys_bytes) sizeof(fdu))) != OK)
- return(r);
- major = (fdu.dev >> MAJOR) & BYTE;
- r=map_driver(major, NONE, 0, 0);
- return(r);
- }
default:
return(EINVAL);
}
_PROTOTYPE( void reopen_reply, (void) );
/* dmap.c */
-_PROTOTYPE( int do_devctl, (void) );
-_PROTOTYPE( int fs_devctl, (int req, int dev, int proc_nr_e, int style,
- int force) );
_PROTOTYPE( int do_mapdriver, (void) );
_PROTOTYPE( void build_dmap, (void) );
-_PROTOTYPE( int map_driver, (int major, int proc_nr, int dev_style,
- int force) );
+_PROTOTYPE( int map_driver, (char *label, int major, int proc_nr,
+ int dev_style, int force) );
_PROTOTYPE( int dmap_driver_match, (endpoint_t proc, int major) );
_PROTOTYPE( void dmap_unmap_by_endpt, (int proc_nr) );
_PROTOTYPE( void dmap_endpt_up, (int proc_nr) );
off_t bytes_left;
u64_t position, res_pos, new_pos;
unsigned int off, cum_io, cum_io_incr, res_cum_io;
- int op, oflags, r, chunk, usr, block_spec, char_spec;
+ int op, oflags, r, chunk, block_spec, char_spec;
int regular;
mode_t mode_word;
phys_bytes p;
struct dmap *dp;
- /* PM loads segments by putting funny things in other bits of the
- * message, indicated by a high bit in fd. */
- if (who_e == PM_PROC_NR && (m_in.fd & _PM_SEG_FLAG)) {
- panic(__FILE__,
- "read_write: special read/write calls by PM no longer supported",
- NO_NUM);
- } else {
- usr = who_e; /* normal case */
- }
-
/* If the file descriptor is valid, get the vnode, size and mode. */
if (m_in.nbytes < 0) return(EINVAL);
if ((f = get_filp(m_in.fd)) == NIL_FILP) return(err_code);
panic(__FILE__, "read_write: fp_cum_io_partial not clear",
NO_NUM);
}
- return rw_pipe(rw_flag, usr, m_in.fd, f, m_in.buffer, m_in.nbytes);
+ return rw_pipe(rw_flag, who_e, m_in.fd, f, m_in.buffer, m_in.nbytes);
}
op = (rw_flag == READING ? VFS_DEV_READ : VFS_DEV_WRITE);
suspend_reopen = (f->filp_state != FS_NORMAL);
dev = (dev_t) vp->v_sdev;
- r = dev_io(op, dev, usr, m_in.buffer, position, m_in.nbytes, oflags,
+ r = dev_io(op, dev, who_e, m_in.buffer, position, m_in.nbytes, oflags,
suspend_reopen);
if (r >= 0) {
cum_io = r;
r = OK;
}
} else if (block_spec) { /* Block special files. */
- r = req_breadwrite(vp->v_bfs_e, usr, vp->v_sdev, position, m_in.nbytes,
- m_in.buffer, rw_flag, &res_pos, &res_cum_io);
+ r = req_breadwrite(vp->v_bfs_e, who_e, vp->v_sdev, position,
+ m_in.nbytes, m_in.buffer, rw_flag, &res_pos, &res_cum_io);
position = res_pos;
cum_io += res_cum_io;
} else { /* Regular files */
}
/* Issue request */
- r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, position, rw_flag, usr,
+ r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, position, rw_flag, who_e,
m_in.buffer, m_in.nbytes, &new_pos, &cum_io_incr);
if (r >= 0) {
*===========================================================================*/
PUBLIC int do_chdir()
{
-/* Change directory. This function is also called by MM to simulate a chdir
- * in order to do EXEC, etc. It also changes the root directory, the uids and
- * gids, and the umask.
- */
- int r;
- register struct fproc *rfp;
-
- if (who_e == PM_PROC_NR) {
- int slot;
- if(isokendpt(m_in.endpt1, &slot) != OK) return(EINVAL);
- rfp = &fproc[slot];
-
- put_vnode(fp->fp_rd);
- dup_vnode(fp->fp_rd = rfp->fp_rd);
- put_vnode(fp->fp_wd);
- dup_vnode(fp->fp_wd = rfp->fp_wd);
-
- /* MM uses access() to check permissions. To make this work, pretend
- * that the user's real ids are the same as the user's effective ids.
- * FS calls other than access() do not use the real ids, so are not
- * affected.
- */
- fp->fp_realuid =
- fp->fp_effuid = rfp->fp_effuid;
- fp->fp_realgid =
- fp->fp_effgid = rfp->fp_effgid;
- fp->fp_umask = rfp->fp_umask;
- return(OK);
- }
+/* Perform the chdir(name) system call. */
- /* Perform the chdir(name) system call. */
return change(&fp->fp_wd, m_in.name, m_in.name_length);
}
no_sys, /* 97 = getsysinfo_up */
no_sys, /* 98 = (sprofile) */
no_sys, /* 99 = (cprofile) */
- no_sys, /* 100 = unused */
- no_sys, /* 101 = unused */
- no_sys, /* 102 = unused */
- no_sys, /* 103 = unused */
- no_sys, /* 104 = unused */
+ /* THE MINIX3 ABI ENDS HERE */
+ no_sys, /* 100 = (exec_newmem) */
+ no_sys, /* 101 = (fork_nb) */
+ no_sys, /* 102 = (exec_restart) */
+ no_sys, /* 103 = (procstat) */
+ no_sys, /* 104 = (getprocnr) */
no_sys, /* 105 = unused */
no_sys, /* 106 = unused */
- no_sys, /* 107 = unused */
+ no_sys, /* 107 = (getepinfo) */
no_sys, /* 108 = (adddma) */
- no_sys, /* 109 = unused */
- no_sys, /* 110 = unused */
+ no_sys, /* 109 = (deldma) */
+ no_sys, /* 110 = (getdma) */
};
/* This should not fail with "array size is negative": */
extern int dummy[sizeof(call_vec) == NCALLS * sizeof(call_vec[0]) ? 1 : -1];
}
/*===========================================================================*
- * do_allocmem *
- *===========================================================================*/
-PUBLIC int do_allocmem(message *m)
-{
- phys_clicks mem, clicks;
-
- clicks = 1 + ((vir_bytes)m->VMAM_BYTES / CLICK_SIZE);
-
- if((mem=ALLOC_MEM(clicks, PAF_CLEAR)) == NO_MEM) {
- return ENOMEM;
- }
-
- m->VMAM_MEMBASE = CLICK2ABS(mem);
-
-#if 0
- printf("VM: do_allocmem: 0x%lx clicks OK at 0x%lx\n", m->VMAM_CLICKS, mem);
-#endif
-
- return OK;
-}
-
-/*===========================================================================*
- * do_allocmem *
+ * printmemstats *
*===========================================================================*/
void printmemstats(void)
{
CALLMAP(VM_ADDDMA, do_adddma, PM_PROC_NR);
CALLMAP(VM_DELDMA, do_deldma, PM_PROC_NR);
CALLMAP(VM_GETDMA, do_getdma, PM_PROC_NR);
- CALLMAP(VM_ALLOCMEM, do_allocmem, PM_PROC_NR);
CALLMAP(VM_NOTIFY_SIG, do_notify_sig, PM_PROC_NR);
/* Requests from RS */
_PROTOTYPE( int do_adddma, (message *msg) );
_PROTOTYPE( int do_deldma, (message *msg) );
_PROTOTYPE( int do_getdma, (message *msg) );
-_PROTOTYPE( int do_allocmem, (message *msg) );
_PROTOTYPE( void release_dma, (struct vmproc *vmp) );
_PROTOTYPE( void memstats, (int *nodes, int *pages, int *largest) );
_PROTOTYPE( void printmemstats, (void) );