Deleted Added
full compact
kern_xxx.c (180291) kern_xxx.c (181803)
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

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)kern_xxx.c 8.2 (Berkeley) 11/14/93
30 */
31
32#include <sys/cdefs.h>
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

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)kern_xxx.c 8.2 (Berkeley) 11/14/93
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/kern/kern_xxx.c 180291 2008-07-05 13:10:10Z rwatson $");
33__FBSDID("$FreeBSD: head/sys/kern/kern_xxx.c 181803 2008-08-17 23:27:27Z bz $");
34
35#include "opt_compat.h"
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/sysproto.h>
40#include <sys/kernel.h>
41#include <sys/priv.h>
42#include <sys/proc.h>
43#include <sys/lock.h>
44#include <sys/mutex.h>
45#include <sys/sysctl.h>
46#include <sys/utsname.h>
34
35#include "opt_compat.h"
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/sysproto.h>
40#include <sys/kernel.h>
41#include <sys/priv.h>
42#include <sys/proc.h>
43#include <sys/lock.h>
44#include <sys/mutex.h>
45#include <sys/sysctl.h>
46#include <sys/utsname.h>
47#include <sys/vimage.h>
47
48
49#if defined(COMPAT_43)
50
51#ifndef _SYS_SYSPROTO_H_
52struct gethostname_args {
53 char *hostname;
54 u_int len;

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

244getdomainname(td, uap)
245 struct thread *td;
246 struct getdomainname_args *uap;
247{
248 char tmpdomainname[MAXHOSTNAMELEN];
249 int domainnamelen;
250
251 mtx_lock(&hostname_mtx);
48
49
50#if defined(COMPAT_43)
51
52#ifndef _SYS_SYSPROTO_H_
53struct gethostname_args {
54 char *hostname;
55 u_int len;

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

245getdomainname(td, uap)
246 struct thread *td;
247 struct getdomainname_args *uap;
248{
249 char tmpdomainname[MAXHOSTNAMELEN];
250 int domainnamelen;
251
252 mtx_lock(&hostname_mtx);
252 bcopy(domainname, tmpdomainname, sizeof(tmpdomainname));
253 bcopy(V_domainname, tmpdomainname, sizeof(tmpdomainname));
253 mtx_unlock(&hostname_mtx);
254
255 domainnamelen = strlen(tmpdomainname) + 1;
256 if ((u_int)uap->len > domainnamelen)
257 uap->len = domainnamelen;
258 return (copyout(tmpdomainname, uap->domainname, uap->len));
259}
260

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

278 return (error);
279 if ((u_int)uap->len > sizeof(tmpdomainname) - 1)
280 return (EINVAL);
281 domainnamelen = uap->len;
282 error = copyin(uap->domainname, tmpdomainname, uap->len);
283 if (error == 0) {
284 tmpdomainname[domainnamelen] = 0;
285 mtx_lock(&hostname_mtx);
254 mtx_unlock(&hostname_mtx);
255
256 domainnamelen = strlen(tmpdomainname) + 1;
257 if ((u_int)uap->len > domainnamelen)
258 uap->len = domainnamelen;
259 return (copyout(tmpdomainname, uap->domainname, uap->len));
260}
261

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

279 return (error);
280 if ((u_int)uap->len > sizeof(tmpdomainname) - 1)
281 return (EINVAL);
282 domainnamelen = uap->len;
283 error = copyin(uap->domainname, tmpdomainname, uap->len);
284 if (error == 0) {
285 tmpdomainname[domainnamelen] = 0;
286 mtx_lock(&hostname_mtx);
286 bcopy(tmpdomainname, domainname, sizeof(domainname));
287 bcopy(tmpdomainname, V_domainname, sizeof(domainname));
287 mtx_unlock(&hostname_mtx);
288 }
289 return (error);
290}
288 mtx_unlock(&hostname_mtx);
289 }
290 return (error);
291}