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