|
|
1.1 root 1: /*
2: * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms, with or without
6: * modification, are permitted provided that the following conditions
7: * are met:
8: * 1. Redistributions of source code must retain the above copyright
9: * notice, this list of conditions and the following disclaimer.
10: * 2. Redistributions in binary form must reproduce the above copyright
11: * notice, this list of conditions and the following disclaimer in the
12: * documentation and/or other materials provided with the distribution.
13: * 3. All advertising materials mentioning features or use of this software
14: * must display the following acknowledgement:
15: * This product includes software developed by the University of
16: * California, Berkeley and its contributors.
17: * 4. Neither the name of the University nor the names of its contributors
18: * may be used to endorse or promote products derived from this software
19: * without specific prior written permission.
20: *
21: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31: * SUCH DAMAGE.
32: *
33: * @(#)kern_xxx.c 7.17 (Berkeley) 4/20/91
34: */
35:
36: #include "param.h"
37: #include "systm.h"
38: #include "kernel.h"
39: #include "proc.h"
40: #include "reboot.h"
41:
42: /* ARGSUSED */
43: gethostid(p, uap, retval)
44: struct proc *p;
45: void *uap;
46: long *retval;
47: {
48:
49: *retval = hostid;
50: return (0);
51: }
52:
53: /* ARGSUSED */
54: sethostid(p, uap, retval)
55: struct proc *p;
56: struct args {
57: long hostid;
58: } *uap;
59: int *retval;
60: {
61: int error;
62:
63: if (error = suser(p->p_ucred, &p->p_acflag))
64: return (error);
65: hostid = uap->hostid;
66: return (0);
67: }
68:
69: /* ARGSUSED */
70: gethostname(p, uap, retval)
71: struct proc *p;
72: struct args {
73: char *hostname;
74: u_int len;
75: } *uap;
76: int *retval;
77: {
78:
79: if (uap->len > hostnamelen + 1)
80: uap->len = hostnamelen + 1;
81: return (copyout((caddr_t)hostname, (caddr_t)uap->hostname, uap->len));
82: }
83:
84: /* ARGSUSED */
85: sethostname(p, uap, retval)
86: struct proc *p;
87: register struct args {
88: char *hostname;
89: u_int len;
90: } *uap;
91: int *retval;
92: {
93: int error;
94:
95: if (error = suser(p->p_ucred, &p->p_acflag))
96: return (error);
97: if (uap->len > sizeof (hostname) - 1)
98: return (EINVAL);
99: hostnamelen = uap->len;
100: error = copyin((caddr_t)uap->hostname, hostname, uap->len);
101: hostname[hostnamelen] = 0;
102: return (error);
103: }
104:
105: /* ARGSUSED */
1.1.1.2 ! root 106: getdomainname(p, uap, retval)
! 107: struct proc *p;
! 108: struct args {
! 109: char *domainname;
! 110: u_int len;
! 111: } *uap;
! 112: int *retval;
! 113: {
! 114: if (uap->len > domainnamelen + 1)
! 115: uap->len = domainnamelen + 1;
! 116: return (copyout((caddr_t)domainname, (caddr_t)uap->domainname, uap->len));
! 117: }
! 118:
! 119: /* ARGSUSED */
! 120: setdomainname(p, uap, retval)
! 121: struct proc *p;
! 122: struct args {
! 123: char *domainname;
! 124: u_int len;
! 125: } *uap;
! 126: int *retval;
! 127: {
! 128: int error;
! 129:
! 130: if (error = suser(p->p_ucred, &p->p_acflag))
! 131: return (error);
! 132: if (uap->len > sizeof (domainname) - 1)
! 133: return EINVAL;
! 134: domainnamelen = uap->len;
! 135: error = copyin((caddr_t)uap->domainname, domainname, uap->len);
! 136: domainname[domainnamelen] = 0;
! 137: return (error);
! 138: }
! 139:
! 140: /* ARGSUSED */
1.1 root 141: reboot(p, uap, retval)
142: struct proc *p;
143: struct args {
144: int opt;
145: } *uap;
146: int *retval;
147: {
148: int error;
149:
150: if (error = suser(p->p_ucred, &p->p_acflag))
151: return (error);
152: boot(uap->opt);
153: return (0);
154: }
155:
156: #ifdef COMPAT_43
157: oquota()
158: {
159:
160: return (ENOSYS);
161: }
162: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.