kern_xxx.c (f35a53bf11ff42266ab6c248ea879ac7663595a8) kern_xxx.c (27aef04699fda115d1899d414e1f485886a4f335)
1/*
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. 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

--- 17 unchanged lines hidden (view full) ---

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 8.2 (Berkeley) 11/14/93
1/*
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. 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

--- 17 unchanged lines hidden (view full) ---

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 8.2 (Berkeley) 11/14/93
34 * $Id: kern_xxx.c,v 1.17 1995/11/12 06:43:03 bde Exp $
34 * $Id: kern_xxx.c,v 1.18 1995/11/12 07:04:30 bde Exp $
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/sysproto.h>
40#include <sys/kernel.h>
41#include <sys/proc.h>
42#include <sys/reboot.h>

--- 232 unchanged lines hidden (view full) ---

275
276/* ARGSUSED */
277int
278getdomainname(p, uap, retval)
279 struct proc *p;
280 struct getdomainname_args *uap;
281 int *retval;
282{
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/sysproto.h>
40#include <sys/kernel.h>
41#include <sys/proc.h>
42#include <sys/reboot.h>

--- 232 unchanged lines hidden (view full) ---

275
276/* ARGSUSED */
277int
278getdomainname(p, uap, retval)
279 struct proc *p;
280 struct getdomainname_args *uap;
281 int *retval;
282{
283 int domainnamelen = strlen(domainname) + 1;
283 if ((u_int)uap->len > domainnamelen + 1)
284 uap->len = domainnamelen + 1;
285 return (copyout((caddr_t)domainname, (caddr_t)uap->domainname, uap->len));
286}
287
288#ifndef _SYS_SYSPROTO_H_
289struct setdomainname_args {
290 char *domainname;
291 int len;
292};
293#endif
294
295/* ARGSUSED */
296int
297setdomainname(p, uap, retval)
298 struct proc *p;
299 struct setdomainname_args *uap;
300 int *retval;
301{
284 if ((u_int)uap->len > domainnamelen + 1)
285 uap->len = domainnamelen + 1;
286 return (copyout((caddr_t)domainname, (caddr_t)uap->domainname, uap->len));
287}
288
289#ifndef _SYS_SYSPROTO_H_
290struct setdomainname_args {
291 char *domainname;
292 int len;
293};
294#endif
295
296/* ARGSUSED */
297int
298setdomainname(p, uap, retval)
299 struct proc *p;
300 struct setdomainname_args *uap;
301 int *retval;
302{
302 int error;
303 int error, domainnamelen;
303
304 if ((error = suser(p->p_ucred, &p->p_acflag)))
305 return (error);
306 if ((u_int)uap->len > sizeof (domainname) - 1)
307 return EINVAL;
308 domainnamelen = uap->len;
309 error = copyin((caddr_t)uap->domainname, domainname, uap->len);
310 domainname[domainnamelen] = 0;
311 return (error);
312}
313
304
305 if ((error = suser(p->p_ucred, &p->p_acflag)))
306 return (error);
307 if ((u_int)uap->len > sizeof (domainname) - 1)
308 return EINVAL;
309 domainnamelen = uap->len;
310 error = copyin((caddr_t)uap->domainname, domainname, uap->len);
311 domainname[domainnamelen] = 0;
312 return (error);
313}
314