diff options
| author | christos <christos@NetBSD.org> | 1995-04-22 23:45:29 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 1995-04-22 23:45:29 +0000 |
| commit | ebdad87ea2d2f01dafd5f707cceba31cbc744eb3 (patch) | |
| tree | 348f2f475d4c7ff48384e538fd8640a2131a113a /sys/compat | |
| parent | 00e1cff41a76dcc4368ca52c9bb47f1e48af58ae (diff) | |
Added sunos_reboot().
Diffstat (limited to 'sys/compat')
| -rw-r--r-- | sys/compat/sunos/sunos_misc.c | 65 | ||||
| -rw-r--r-- | sys/compat/sunos/syscalls.master | 4 |
2 files changed, 66 insertions, 3 deletions
diff --git a/sys/compat/sunos/sunos_misc.c b/sys/compat/sunos/sunos_misc.c index 0545e9be6c2..17e7377f75a 100644 --- a/sys/compat/sunos/sunos_misc.c +++ b/sys/compat/sunos/sunos_misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: sunos_misc.c,v 1.43 1995/03/21 13:34:15 mycroft Exp $ */ +/* $NetBSD: sunos_misc.c,v 1.44 1995/04/22 23:45:29 christos Exp $ */ /* * Copyright (c) 1992, 1993 @@ -63,6 +63,7 @@ #include <sys/filedesc.h> #include <sys/ioctl.h> #include <sys/kernel.h> +#include <sys/reboot.h> #include <sys/exec.h> #include <sys/malloc.h> #include <sys/mbuf.h> @@ -1017,3 +1018,65 @@ bad: return (error); } + +/* + * SunOS reboot system call (for compatibility). + * Sun lets you pass in a boot string which the PROM + * saves and provides to the next boot program. + */ +static struct sunos_howto_conv { + int sunos_howto; + int bsd_howto; +} sunos_howto_conv[] = { + { 0x001, RB_ASKNAME }, + { 0x002, RB_SINGLE }, + { 0x004, RB_NOSYNC }, + { 0x008, RB_HALT }, + { 0x080, RB_DUMP }, + { 0x000, 0 }, +}; + +int sunos_reboot(p, uap, retval) + struct proc *p; + struct sunos_reboot_args *uap; + int *retval; +{ + struct reboot_args rb; + struct sunos_howto_conv *convp; + int error, bsd_howto, sunos_howto; + char bs[128]; + char *bsd_bootstr = NULL; + + if (error = suser(p->p_ucred, &p->p_acflag)) + return (error); + + /* + * Convert howto bits to BSD format. + */ + sunos_howto = uap->howto; + bsd_howto = 0; + convp = sunos_howto_conv; + while (convp->sunos_howto) { + if (sunos_howto & convp->sunos_howto) + bsd_howto |= convp->bsd_howto; + convp++; + } + +#ifdef notyet + /* Only works on sun3's */ + /* + * Sun RB_STRING (Get user supplied bootstring.) + */ + bsd_bootstr = NULL; + if (sunos_howto & 0x200) { + error = copyinstr(uap->bootstr, bs, sizeof(bs), 0); + if (error) return error; + bsd_bootstr = bs; + } + + return (reboot2(bsd_howto, bsd_bootstr)); +#else + rb.opt = bsd_howto; + return reboot(p, &rb, retval); +#endif +} diff --git a/sys/compat/sunos/syscalls.master b/sys/compat/sunos/syscalls.master index 9f2c1b85094..b0d5e0ae9fc 100644 --- a/sys/compat/sunos/syscalls.master +++ b/sys/compat/sunos/syscalls.master @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.25 1995/04/22 19:48:52 christos Exp $ + $NetBSD: syscalls.master,v 1.26 1995/04/22 23:45:33 christos Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -98,7 +98,7 @@ 53 STD { int sunos_mctl(caddr_t addr, int len, int func, \ void *arg); } 54 STD { int sunos_ioctl(int fd, u_long com, caddr_t data); } -55 NOARGS { int reboot(int opt); } +55 STD { int sunos_reboot(int howto, char *bootstr); } 56 OBSOL sunos_owait3 57 NOARGS { int symlink(char *path, char *link); } 58 NOARGS { int readlink(char *path, char *buf, int count); } |
