|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1982, 1986, 1989 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution is only permitted until one year after the first shipment ! 6: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and ! 7: * binary forms are permitted provided that: (1) source distributions retain ! 8: * this entire copyright notice and comment, and (2) distributions including ! 9: * binaries display the following acknowledgement: This product includes ! 10: * software developed by the University of California, Berkeley and its ! 11: * contributors'' in the documentation or other materials provided with the ! 12: * distribution and in all advertising materials mentioning features or use ! 13: * of this software. Neither the name of the University nor the names of ! 14: * its contributors may be used to endorse or promote products derived from ! 15: * this software without specific prior written permission. ! 16: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 17: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 18: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 19: * ! 20: * @(#)kern_xxx.c 7.14 (Berkeley) 6/28/90 ! 21: */ ! 22: ! 23: #include "param.h" ! 24: #include "systm.h" ! 25: #include "user.h" ! 26: #include "kernel.h" ! 27: #include "proc.h" ! 28: #include "reboot.h" ! 29: ! 30: /* ARGSUSED */ ! 31: gethostid(p, uap, retval) ! 32: struct proc *p; ! 33: void *uap; ! 34: long *retval; ! 35: { ! 36: ! 37: *retval = hostid; ! 38: return (0); ! 39: } ! 40: ! 41: sethostid(p, uap, retval) ! 42: struct proc *p; ! 43: struct args { ! 44: long hostid; ! 45: } *uap; ! 46: int *retval; ! 47: { ! 48: int error; ! 49: ! 50: if (error = suser(u.u_cred, &u.u_acflag)) ! 51: return (error); ! 52: hostid = uap->hostid; ! 53: return (0); ! 54: } ! 55: ! 56: /* ARGSUSED */ ! 57: gethostname(p, uap, retval) ! 58: struct proc *p; ! 59: struct args { ! 60: char *hostname; ! 61: u_int len; ! 62: } *uap; ! 63: int *retval; ! 64: { ! 65: ! 66: if (uap->len > hostnamelen + 1) ! 67: uap->len = hostnamelen + 1; ! 68: return (copyout((caddr_t)hostname, (caddr_t)uap->hostname, uap->len)); ! 69: } ! 70: ! 71: /* ARGSUSED */ ! 72: sethostname(p, uap, retval) ! 73: struct proc *p; ! 74: register struct args { ! 75: char *hostname; ! 76: u_int len; ! 77: } *uap; ! 78: int *retval; ! 79: { ! 80: int error; ! 81: ! 82: if (error = suser(u.u_cred, &u.u_acflag)) ! 83: return (error); ! 84: if (uap->len > sizeof (hostname) - 1) ! 85: return (EINVAL); ! 86: hostnamelen = uap->len; ! 87: error = copyin((caddr_t)uap->hostname, hostname, uap->len); ! 88: hostname[hostnamelen] = 0; ! 89: return (error); ! 90: } ! 91: ! 92: /* ARGSUSED */ ! 93: reboot(p, uap, retval) ! 94: struct proc *p; ! 95: struct args { ! 96: int opt; ! 97: } *uap; ! 98: int *retval; ! 99: { ! 100: int error; ! 101: ! 102: if (error = suser(u.u_cred, &u.u_acflag)) ! 103: return (error); ! 104: boot(uap->opt); ! 105: return (0); ! 106: } ! 107: ! 108: ovhangup() ! 109: { ! 110: ! 111: return (EINVAL); ! 112: } ! 113: ! 114: oldquota() ! 115: { ! 116: ! 117: return (EINVAL); ! 118: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.