2 * Copyright (c) 1996-1998 University of Utah and the Flux Group.
5 * This file is part of the Flux OSKit. The OSKit is free software, also known
6 * as "open source;" you can redistribute it and/or modify it under the terms
7 * of the GNU General Public License (GPL), version 2, as published by the Free
8 * Software Foundation (FSF). To explore alternate licensing terms, contact
9 * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271.
11 * The OSKit is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GPL for more details. You should have
14 * received a copy of the GPL along with the OSKit; see the file COPYING. If
15 * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
18 * Routines necessary for the bsdnet code.
21 #include <sys/types.h>
22 #include <sys/param.h>
24 #include <sys/systm.h>
25 #include <sys/kernel.h>
26 #include <sys/domain.h>
27 #include "net/netisr.h"
29 int oskit_cpl
; /* for machine/spl.h */
30 int bootverbose
; /* networking code wants to know whether booting
32 int securelevel
= 3; /* used in ip_fw.c:ip_fw_ctl -- make it > 2 */
34 vm_map_t mb_map
; /* this is passed in kmem_alloc, but ignored there */
37 struct proc
*curproc
= &proc0
;
39 struct domain localdomain
; /* see uipc_domain.c ADDDOMAIN macro */
41 /* ---------------------------------------------------------------------- */
44 * find a process by pid
49 printf("%s called, pid=%d, returning x%p\n",
50 "pfind", (int)pid
, (void*)&proc0
);
58 psignal (struct proc
*p
, int sig
)
60 printf("%s called, proc=x%p sig=%d\n", "psignal", p
, sig
);
64 * signal a process group
67 gsignal (int pgid
, int sig
)
69 printf("%s called, pgid=%d sig=%d\n", "gsignal", pgid
, sig
);
72 /* ---------------------------------------------------------------------- */
75 * copy in from userspace
78 copyin (void *udaddr
, void *kaddr
, u_int len
)
80 memcpy(kaddr
, udaddr
, len
);
85 * copy out to userspace
88 copyout (void *kaddr
, void *udaddr
, u_int len
)
90 memcpy(udaddr
, kaddr
, len
);
95 * even though these functions have an odd signature,
96 * they only copy one byte
98 int subyte (void *base
, int byte
)
100 return (int)(base
= (char *)byte
);
103 int suibyte (void *base
, int byte
)
105 return (int)(base
= (char *)byte
);
108 /* ---------------------------------------------------------------------- */
112 * log some information
115 log (int level
, const char *format
, ...)
117 extern int vprintf(const char *, va_list);
119 va_start(args
, format
);
120 printf("__FUNCTION__(%d):", level
);
121 vprintf(format
, args
);
126 /* ---------------------------------------------------------------------- */
129 * do we have super user credentials?
133 suser(struct ucred
*ucred
, u_short
*acflag
)
139 /* ---------------------------------------------------------------------- */
141 * stuff stolen from kern/kern_sysctl.c
144 * Validate parameters and get old / set new parameters
145 * for an integer-valued sysctl function.
148 sysctl_int(oldp
, oldlenp
, newp
, newlen
, valp
)
157 if (oldp
&& *oldlenp
< sizeof(int))
159 if (newp
&& newlen
!= sizeof(int))
161 *oldlenp
= sizeof(int);
163 error
= copyout(valp
, oldp
, sizeof(int));
164 if (error
== 0 && newp
)
165 error
= copyin(newp
, valp
, sizeof(int));
170 * Validate parameters and get old parameters
171 * for a structure oriented sysctl function.
174 sysctl_rdstruct(oldp
, oldlenp
, newp
, sp
, len
)
182 if (oldp
&& *oldlenp
< len
)
188 error
= copyout(sp
, oldp
, len
);
192 int bcmp(const void *b1
, const void *b2
, size_t len
)
194 return RtlCompareMemory(b1
, b2
, len
);