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.14 (Berkeley) 06/28/90 8 */ 9 10 #include "param.h" 11 #include "systm.h" 12 #include "user.h" 13 #include "kernel.h" 14 #include "proc.h" 15 #include "reboot.h" 16 17 /* ARGSUSED */ 18 gethostid(p, uap, retval) 19 struct proc *p; 20 void *uap; 21 long *retval; 22 { 23 24 *retval = hostid; 25 return (0); 26 } 27 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(u.u_cred, &u.u_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(u.u_cred, &u.u_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(u.u_cred, &u.u_acflag)) 90 return (error); 91 boot(uap->opt); 92 return (0); 93 } 94 95 ovhangup() 96 { 97 98 return (EINVAL); 99 } 100 101 oldquota() 102 { 103 104 return (EINVAL); 105 } 106