1 /* 2 * Copyright (c) 1982, 1986, 1989 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)kern_xxx.c 7.17 (Berkeley) 04/20/91 8 */ 9 10 #include "param.h" 11 #include "systm.h" 12 #include "kernel.h" 13 #include "proc.h" 14 #include "reboot.h" 15 16 /* ARGSUSED */ 17 gethostid(p, uap, retval) 18 struct proc *p; 19 void *uap; 20 long *retval; 21 { 22 23 *retval = hostid; 24 return (0); 25 } 26 27 /* ARGSUSED */ 28 sethostid(p, uap, retval) 29 struct proc *p; 30 struct args { 31 long hostid; 32 } *uap; 33 int *retval; 34 { 35 int error; 36 37 if (error = suser(p->p_ucred, &p->p_acflag)) 38 return (error); 39 hostid = uap->hostid; 40 return (0); 41 } 42 43 /* ARGSUSED */ 44 gethostname(p, uap, retval) 45 struct proc *p; 46 struct args { 47 char *hostname; 48 u_int len; 49 } *uap; 50 int *retval; 51 { 52 53 if (uap->len > hostnamelen + 1) 54 uap->len = hostnamelen + 1; 55 return (copyout((caddr_t)hostname, (caddr_t)uap->hostname, uap->len)); 56 } 57 58 /* ARGSUSED */ 59 sethostname(p, uap, retval) 60 struct proc *p; 61 register struct args { 62 char *hostname; 63 u_int len; 64 } *uap; 65 int *retval; 66 { 67 int error; 68 69 if (error = suser(p->p_ucred, &p->p_acflag)) 70 return (error); 71 if (uap->len > sizeof (hostname) - 1) 72 return (EINVAL); 73 hostnamelen = uap->len; 74 error = copyin((caddr_t)uap->hostname, hostname, uap->len); 75 hostname[hostnamelen] = 0; 76 return (error); 77 } 78 79 /* ARGSUSED */ 80 reboot(p, uap, retval) 81 struct proc *p; 82 struct args { 83 int opt; 84 } *uap; 85 int *retval; 86 { 87 int error; 88 89 if (error = suser(p->p_ucred, &p->p_acflag)) 90 return (error); 91 boot(uap->opt); 92 return (0); 93 } 94 95 #ifdef COMPAT_43 96 oquota() 97 { 98 99 return (ENOSYS); 100 } 101 #endif 102