kern_xxx.c (31778) | kern_xxx.c (38517) |
---|---|
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.26 1997/11/06 19:29:18 phk Exp $ | 34 * $Id: kern_xxx.c,v 1.27 1997/12/16 17:40:21 eivind Exp $ |
35 */ 36 37#include "opt_compat.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/sysproto.h> 42#include <sys/kernel.h> --- 12 unchanged lines hidden (view full) --- 55#endif 56/* ARGSUSED */ 57int 58ogethostname(p, uap) 59 struct proc *p; 60 struct gethostname_args *uap; 61{ 62 int name[2]; | 35 */ 36 37#include "opt_compat.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/sysproto.h> 42#include <sys/kernel.h> --- 12 unchanged lines hidden (view full) --- 55#endif 56/* ARGSUSED */ 57int 58ogethostname(p, uap) 59 struct proc *p; 60 struct gethostname_args *uap; 61{ 62 int name[2]; |
63 size_t len = uap->len; |
|
63 64 name[0] = CTL_KERN; 65 name[1] = KERN_HOSTNAME; | 64 65 name[0] = CTL_KERN; 66 name[1] = KERN_HOSTNAME; |
66 return (userland_sysctl(p, name, 2, uap->hostname, &uap->len, | 67 return (userland_sysctl(p, name, 2, uap->hostname, &len, |
67 1, 0, 0, 0)); 68} 69 70#ifndef _SYS_SYSPROTO_H_ 71struct sethostname_args { 72 char *hostname; 73 u_int len; 74}; --- 69 unchanged lines hidden (view full) --- 144#endif 145 146/* ARGSUSED */ 147int 148uname(p, uap) 149 struct proc *p; 150 struct uname_args *uap; 151{ | 68 1, 0, 0, 0)); 69} 70 71#ifndef _SYS_SYSPROTO_H_ 72struct sethostname_args { 73 char *hostname; 74 u_int len; 75}; --- 69 unchanged lines hidden (view full) --- 145#endif 146 147/* ARGSUSED */ 148int 149uname(p, uap) 150 struct proc *p; 151 struct uname_args *uap; 152{ |
152 int name[2], len, rtval; | 153 int name[2], rtval; 154 size_t len; |
153 char *s, *us; 154 155 name[0] = CTL_KERN; 156 name[1] = KERN_OSTYPE; 157 len = sizeof uap->name->sysname; 158 rtval = userland_sysctl(p, name, 2, uap->name->sysname, &len, 159 1, 0, 0, 0); 160 if( rtval) return rtval; --- 31 unchanged lines hidden (view full) --- 192 rtval = subyte( us++, *s); 193 if( rtval) 194 return rtval; 195 } 196 rtval = subyte( us++, 0); 197 if( rtval) 198 return rtval; 199 | 155 char *s, *us; 156 157 name[0] = CTL_KERN; 158 name[1] = KERN_OSTYPE; 159 len = sizeof uap->name->sysname; 160 rtval = userland_sysctl(p, name, 2, uap->name->sysname, &len, 161 1, 0, 0, 0); 162 if( rtval) return rtval; --- 31 unchanged lines hidden (view full) --- 194 rtval = subyte( us++, *s); 195 if( rtval) 196 return rtval; 197 } 198 rtval = subyte( us++, 0); 199 if( rtval) 200 return rtval; 201 |
202 name[0] = CTL_HW; |
|
200 name[1] = HW_MACHINE; 201 len = sizeof uap->name->machine; 202 rtval = userland_sysctl(p, name, 2, uap->name->machine, &len, 203 1, 0, 0, 0); 204 if( rtval) return rtval; 205 subyte( uap->name->machine + sizeof(uap->name->machine) - 1, 0); 206 207 return 0; --- 46 unchanged lines hidden --- | 203 name[1] = HW_MACHINE; 204 len = sizeof uap->name->machine; 205 rtval = userland_sysctl(p, name, 2, uap->name->machine, &len, 206 1, 0, 0, 0); 207 if( rtval) return rtval; 208 subyte( uap->name->machine + sizeof(uap->name->machine) - 1, 0); 209 210 return 0; --- 46 unchanged lines hidden --- |