Put sound into multimedia and rename it to audio because it is "MoreCorrect©"
[reactos.git] / reactos / drivers / lib / oskittcp / oskittcp / defaults.c
1 /*
2 * Copyright (c) 1996-1998 University of Utah and the Flux Group.
3 * All rights reserved.
4 *
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.
10 *
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.
16 */
17 /*
18 * Routines necessary for the bsdnet code.
19 */
20
21 #include <sys/types.h>
22 #include <sys/param.h>
23 #include <vm/vm.h>
24 #include <sys/systm.h>
25 #include <sys/kernel.h>
26 #include <sys/domain.h>
27 #include "net/netisr.h"
28
29 int oskit_cpl; /* for machine/spl.h */
30 int bootverbose; /* networking code wants to know whether booting
31 is to be verbose */
32 int securelevel = 3; /* used in ip_fw.c:ip_fw_ctl -- make it > 2 */
33
34 vm_map_t mb_map; /* this is passed in kmem_alloc, but ignored there */
35
36 struct proc proc0;
37 struct proc *curproc = &proc0;
38
39 struct domain localdomain; /* see uipc_domain.c ADDDOMAIN macro */
40
41 /* ---------------------------------------------------------------------- */
42
43 /*
44 * find a process by pid
45 */
46 struct proc *
47 pfind(pid_t pid)
48 {
49 printf("%s called, pid=%d, returning x%p\n",
50 "pfind", (int)pid, (void*)&proc0);
51 return &proc0;
52 }
53
54 /*
55 * signal a process
56 */
57 void
58 psignal (struct proc *p, int sig)
59 {
60 printf("%s called, proc=x%p sig=%d\n", "psignal", p, sig);
61 }
62
63 /*
64 * signal a process group
65 */
66 void
67 gsignal (int pgid, int sig)
68 {
69 printf("%s called, pgid=%d sig=%d\n", "gsignal", pgid, sig);
70 }
71
72 /* ---------------------------------------------------------------------- */
73
74 /*
75 * copy in from userspace
76 */
77 int
78 copyin (void *udaddr, void *kaddr, u_int len)
79 {
80 memcpy(kaddr, udaddr, len);
81 return 0;
82 }
83
84 /*
85 * copy out to userspace
86 */
87 int
88 copyout (void *kaddr, void *udaddr, u_int len)
89 {
90 memcpy(udaddr, kaddr, len);
91 return 0;
92 }
93
94 /*
95 * even though these functions have an odd signature,
96 * they only copy one byte
97 */
98 int subyte (void *base, int byte)
99 {
100 return (int)(base = (char *)byte);
101 }
102
103 int suibyte (void *base, int byte)
104 {
105 return (int)(base = (char *)byte);
106 }
107
108 /* ---------------------------------------------------------------------- */
109
110 #ifndef __REACTOS__
111 /*
112 * log some information
113 */
114 void
115 log (int level, const char *format, ...)
116 {
117 extern int vprintf(const char *, va_list);
118 va_list args;
119 va_start(args, format);
120 printf("__FUNCTION__(%d):", level);
121 vprintf(format, args);
122 va_end(args);
123 }
124 #endif
125
126 /* ---------------------------------------------------------------------- */
127
128 /*
129 * do we have super user credentials?
130 */
131 /* ARGSUSED */
132 int
133 suser(struct ucred *ucred, u_short *acflag)
134 {
135 /* of course. */
136 return 0;
137 }
138
139 /* ---------------------------------------------------------------------- */
140 /*
141 * stuff stolen from kern/kern_sysctl.c
142 */
143 /*
144 * Validate parameters and get old / set new parameters
145 * for an integer-valued sysctl function.
146 */
147 int
148 sysctl_int(oldp, oldlenp, newp, newlen, valp)
149 void *oldp;
150 size_t *oldlenp;
151 void *newp;
152 size_t newlen;
153 int *valp;
154 {
155 int error = 0;
156
157 if (oldp && *oldlenp < sizeof(int))
158 return (ENOMEM);
159 if (newp && newlen != sizeof(int))
160 return (EINVAL);
161 *oldlenp = sizeof(int);
162 if (oldp)
163 error = copyout(valp, oldp, sizeof(int));
164 if (error == 0 && newp)
165 error = copyin(newp, valp, sizeof(int));
166 return (error);
167 }
168
169 /*
170 * Validate parameters and get old parameters
171 * for a structure oriented sysctl function.
172 */
173 int
174 sysctl_rdstruct(oldp, oldlenp, newp, sp, len)
175 void *oldp;
176 size_t *oldlenp;
177 void *newp, *sp;
178 int len;
179 {
180 int error = 0;
181
182 if (oldp && *oldlenp < len)
183 return (ENOMEM);
184 if (newp)
185 return (EPERM);
186 *oldlenp = len;
187 if (oldp)
188 error = copyout(sp, oldp, len);
189 return (error);
190 }
191
192 int bcmp(const void *b1, const void *b2, size_t len)
193 {
194 return RtlCompareMemory(b1, b2, len);
195 }
196