kern_sysctl.c revision 1.14 1 /* $NetBSD: kern_sysctl.c,v 1.14 1996/02/09 18:59:52 christos Exp $ */
2
3 /*-
4 * Copyright (c) 1982, 1986, 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Mike Karels at Berkeley Software Design, Inc.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
39 */
40
41 /*
42 * sysctl system call.
43 */
44
45 #include <sys/param.h>
46 #include <sys/systm.h>
47 #include <sys/kernel.h>
48 #include <sys/malloc.h>
49 #include <sys/proc.h>
50 #include <sys/file.h>
51 #include <sys/vnode.h>
52 #include <sys/unistd.h>
53 #include <sys/buf.h>
54 #include <sys/ioctl.h>
55 #include <sys/tty.h>
56 #include <sys/disklabel.h>
57 #include <vm/vm.h>
58 #include <sys/sysctl.h>
59
60 #include <sys/mount.h>
61 #include <sys/syscallargs.h>
62
63 /*
64 * Locking and stats
65 */
66 static struct sysctl_lock {
67 int sl_lock;
68 int sl_want;
69 int sl_locked;
70 } memlock;
71
72 int
73 sys___sysctl(p, v, retval)
74 struct proc *p;
75 void *v;
76 register_t *retval;
77 {
78 register struct sys___sysctl_args /* {
79 syscallarg(int *) name;
80 syscallarg(u_int) namelen;
81 syscallarg(void *) old;
82 syscallarg(size_t *) oldlenp;
83 syscallarg(void *) new;
84 syscallarg(size_t) newlen;
85 } */ *uap = v;
86 int error, dolock = 1;
87 size_t savelen = 0, oldlen = 0;
88 sysctlfn *fn;
89 int name[CTL_MAXNAME];
90
91 if (SCARG(uap, new) != NULL &&
92 (error = suser(p->p_ucred, &p->p_acflag)))
93 return (error);
94 /*
95 * all top-level sysctl names are non-terminal
96 */
97 if (SCARG(uap, namelen) > CTL_MAXNAME || SCARG(uap, namelen) < 2)
98 return (EINVAL);
99 error = copyin(SCARG(uap, name), &name,
100 SCARG(uap, namelen) * sizeof(int));
101 if (error)
102 return (error);
103
104 switch (name[0]) {
105 case CTL_KERN:
106 fn = kern_sysctl;
107 if (name[2] != KERN_VNODE) /* XXX */
108 dolock = 0;
109 break;
110 case CTL_HW:
111 fn = hw_sysctl;
112 break;
113 case CTL_VM:
114 fn = vm_sysctl;
115 break;
116 case CTL_NET:
117 fn = net_sysctl;
118 break;
119 #ifdef notyet
120 case CTL_FS:
121 fn = fs_sysctl;
122 break;
123 #endif
124 case CTL_MACHDEP:
125 fn = cpu_sysctl;
126 break;
127 #ifdef DEBUG
128 case CTL_DEBUG:
129 fn = debug_sysctl;
130 break;
131 #endif
132 default:
133 return (EOPNOTSUPP);
134 }
135
136 if (SCARG(uap, oldlenp) &&
137 (error = copyin(SCARG(uap, oldlenp), &oldlen, sizeof(oldlen))))
138 return (error);
139 if (SCARG(uap, old) != NULL) {
140 if (!useracc(SCARG(uap, old), oldlen, B_WRITE))
141 return (EFAULT);
142 while (memlock.sl_lock) {
143 memlock.sl_want = 1;
144 sleep((caddr_t)&memlock, PRIBIO+1);
145 memlock.sl_locked++;
146 }
147 memlock.sl_lock = 1;
148 if (dolock)
149 vslock(SCARG(uap, old), oldlen);
150 savelen = oldlen;
151 }
152 error = (*fn)(name + 1, SCARG(uap, namelen) - 1, SCARG(uap, old),
153 &oldlen, SCARG(uap, new), SCARG(uap, newlen), p);
154 if (SCARG(uap, old) != NULL) {
155 if (dolock)
156 vsunlock(SCARG(uap, old), savelen);
157 memlock.sl_lock = 0;
158 if (memlock.sl_want) {
159 memlock.sl_want = 0;
160 wakeup((caddr_t)&memlock);
161 }
162 }
163 if (error)
164 return (error);
165 if (SCARG(uap, oldlenp))
166 error = copyout(&oldlen, SCARG(uap, oldlenp), sizeof(oldlen));
167 *retval = oldlen;
168 return (0);
169 }
170
171 /*
172 * Attributes stored in the kernel.
173 */
174 char hostname[MAXHOSTNAMELEN];
175 int hostnamelen;
176 char domainname[MAXHOSTNAMELEN];
177 int domainnamelen;
178 long hostid;
179 #ifdef INSECURE
180 int securelevel = -1;
181 #else
182 int securelevel;
183 #endif
184
185 /*
186 * kernel related system variables.
187 */
188 int
189 kern_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
190 int *name;
191 u_int namelen;
192 void *oldp;
193 size_t *oldlenp;
194 void *newp;
195 size_t newlen;
196 struct proc *p;
197 {
198 int error, level, inthostid;
199 extern char ostype[], osrelease[], version[];
200
201 /* all sysctl names at this level are terminal */
202 if (namelen != 1 && !(name[0] == KERN_PROC || name[0] == KERN_PROF))
203 return (ENOTDIR); /* overloaded */
204
205 switch (name[0]) {
206 case KERN_OSTYPE:
207 return (sysctl_rdstring(oldp, oldlenp, newp, ostype));
208 case KERN_OSRELEASE:
209 return (sysctl_rdstring(oldp, oldlenp, newp, osrelease));
210 case KERN_OSREV:
211 return (sysctl_rdint(oldp, oldlenp, newp, BSD));
212 case KERN_VERSION:
213 return (sysctl_rdstring(oldp, oldlenp, newp, version));
214 case KERN_MAXVNODES:
215 return(sysctl_int(oldp, oldlenp, newp, newlen, &desiredvnodes));
216 case KERN_MAXPROC:
217 return (sysctl_int(oldp, oldlenp, newp, newlen, &maxproc));
218 case KERN_MAXFILES:
219 return (sysctl_int(oldp, oldlenp, newp, newlen, &maxfiles));
220 case KERN_ARGMAX:
221 return (sysctl_rdint(oldp, oldlenp, newp, ARG_MAX));
222 case KERN_SECURELVL:
223 level = securelevel;
224 if ((error = sysctl_int(oldp, oldlenp, newp, newlen, &level)) ||
225 newp == NULL)
226 return (error);
227 if (level < securelevel && p->p_pid != 1)
228 return (EPERM);
229 securelevel = level;
230 return (0);
231 case KERN_HOSTNAME:
232 error = sysctl_string(oldp, oldlenp, newp, newlen,
233 hostname, sizeof(hostname));
234 if (newp && !error)
235 hostnamelen = newlen;
236 return (error);
237 case KERN_DOMAINNAME:
238 error = sysctl_string(oldp, oldlenp, newp, newlen,
239 domainname, sizeof(domainname));
240 if (newp && !error)
241 domainnamelen = newlen;
242 return (error);
243 case KERN_HOSTID:
244 inthostid = hostid; /* XXX assumes sizeof long <= sizeof int */
245 error = sysctl_int(oldp, oldlenp, newp, newlen, &inthostid);
246 hostid = inthostid;
247 return (error);
248 case KERN_CLOCKRATE:
249 return (sysctl_clockrate(oldp, oldlenp));
250 case KERN_BOOTTIME:
251 return (sysctl_rdstruct(oldp, oldlenp, newp, &boottime,
252 sizeof(struct timeval)));
253 case KERN_VNODE:
254 return (sysctl_vnode(oldp, oldlenp));
255 case KERN_PROC:
256 return (sysctl_doproc(name + 1, namelen - 1, oldp, oldlenp));
257 case KERN_FILE:
258 return (sysctl_file(oldp, oldlenp));
259 #ifdef GPROF
260 case KERN_PROF:
261 return (sysctl_doprof(name + 1, namelen - 1, oldp, oldlenp,
262 newp, newlen));
263 #endif
264 case KERN_POSIX1:
265 return (sysctl_rdint(oldp, oldlenp, newp, _POSIX_VERSION));
266 case KERN_NGROUPS:
267 return (sysctl_rdint(oldp, oldlenp, newp, NGROUPS_MAX));
268 case KERN_JOB_CONTROL:
269 return (sysctl_rdint(oldp, oldlenp, newp, 1));
270 case KERN_SAVED_IDS:
271 #ifdef _POSIX_SAVED_IDS
272 return (sysctl_rdint(oldp, oldlenp, newp, 1));
273 #else
274 return (sysctl_rdint(oldp, oldlenp, newp, 0));
275 #endif
276 case KERN_MAXPARTITIONS:
277 return (sysctl_rdint(oldp, oldlenp, newp, MAXPARTITIONS));
278 case KERN_RAWPARTITION:
279 return (sysctl_rdint(oldp, oldlenp, newp, RAW_PART));
280 default:
281 return (EOPNOTSUPP);
282 }
283 /* NOTREACHED */
284 }
285
286 /*
287 * hardware related system variables.
288 */
289 int
290 hw_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
291 int *name;
292 u_int namelen;
293 void *oldp;
294 size_t *oldlenp;
295 void *newp;
296 size_t newlen;
297 struct proc *p;
298 {
299 extern char machine[], cpu_model[];
300
301 /* all sysctl names at this level are terminal */
302 if (namelen != 1)
303 return (ENOTDIR); /* overloaded */
304
305 switch (name[0]) {
306 case HW_MACHINE:
307 return (sysctl_rdstring(oldp, oldlenp, newp, machine));
308 case HW_MODEL:
309 return (sysctl_rdstring(oldp, oldlenp, newp, cpu_model));
310 case HW_NCPU:
311 return (sysctl_rdint(oldp, oldlenp, newp, 1)); /* XXX */
312 case HW_BYTEORDER:
313 return (sysctl_rdint(oldp, oldlenp, newp, BYTE_ORDER));
314 case HW_PHYSMEM:
315 return (sysctl_rdint(oldp, oldlenp, newp, ctob(physmem)));
316 case HW_USERMEM:
317 return (sysctl_rdint(oldp, oldlenp, newp,
318 ctob(physmem - cnt.v_wire_count)));
319 case HW_PAGESIZE:
320 return (sysctl_rdint(oldp, oldlenp, newp, PAGE_SIZE));
321 default:
322 return (EOPNOTSUPP);
323 }
324 /* NOTREACHED */
325 }
326
327 #ifdef DEBUG
328 /*
329 * Debugging related system variables.
330 */
331 struct ctldebug debug0, debug1, debug2, debug3, debug4;
332 struct ctldebug debug5, debug6, debug7, debug8, debug9;
333 struct ctldebug debug10, debug11, debug12, debug13, debug14;
334 struct ctldebug debug15, debug16, debug17, debug18, debug19;
335 static struct ctldebug *debugvars[CTL_DEBUG_MAXID] = {
336 &debug0, &debug1, &debug2, &debug3, &debug4,
337 &debug5, &debug6, &debug7, &debug8, &debug9,
338 &debug10, &debug11, &debug12, &debug13, &debug14,
339 &debug15, &debug16, &debug17, &debug18, &debug19,
340 };
341 int
342 debug_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
343 int *name;
344 u_int namelen;
345 void *oldp;
346 size_t *oldlenp;
347 void *newp;
348 size_t newlen;
349 struct proc *p;
350 {
351 struct ctldebug *cdp;
352
353 /* all sysctl names at this level are name and field */
354 if (namelen != 2)
355 return (ENOTDIR); /* overloaded */
356 cdp = debugvars[name[0]];
357 if (cdp->debugname == 0)
358 return (EOPNOTSUPP);
359 switch (name[1]) {
360 case CTL_DEBUG_NAME:
361 return (sysctl_rdstring(oldp, oldlenp, newp, cdp->debugname));
362 case CTL_DEBUG_VALUE:
363 return (sysctl_int(oldp, oldlenp, newp, newlen, cdp->debugvar));
364 default:
365 return (EOPNOTSUPP);
366 }
367 /* NOTREACHED */
368 }
369 #endif /* DEBUG */
370
371 /*
372 * Validate parameters and get old / set new parameters
373 * for an integer-valued sysctl function.
374 */
375 int
376 sysctl_int(oldp, oldlenp, newp, newlen, valp)
377 void *oldp;
378 size_t *oldlenp;
379 void *newp;
380 size_t newlen;
381 int *valp;
382 {
383 int error = 0;
384
385 if (oldp && *oldlenp < sizeof(int))
386 return (ENOMEM);
387 if (newp && newlen != sizeof(int))
388 return (EINVAL);
389 *oldlenp = sizeof(int);
390 if (oldp)
391 error = copyout(valp, oldp, sizeof(int));
392 if (error == 0 && newp)
393 error = copyin(newp, valp, sizeof(int));
394 return (error);
395 }
396
397 /*
398 * As above, but read-only.
399 */
400 int
401 sysctl_rdint(oldp, oldlenp, newp, val)
402 void *oldp;
403 size_t *oldlenp;
404 void *newp;
405 int val;
406 {
407 int error = 0;
408
409 if (oldp && *oldlenp < sizeof(int))
410 return (ENOMEM);
411 if (newp)
412 return (EPERM);
413 *oldlenp = sizeof(int);
414 if (oldp)
415 error = copyout((caddr_t)&val, oldp, sizeof(int));
416 return (error);
417 }
418
419 /*
420 * Validate parameters and get old / set new parameters
421 * for a string-valued sysctl function.
422 */
423 int
424 sysctl_string(oldp, oldlenp, newp, newlen, str, maxlen)
425 void *oldp;
426 size_t *oldlenp;
427 void *newp;
428 size_t newlen;
429 char *str;
430 int maxlen;
431 {
432 int len, error = 0;
433
434 len = strlen(str) + 1;
435 if (oldp && *oldlenp < len)
436 return (ENOMEM);
437 if (newp && newlen >= maxlen)
438 return (EINVAL);
439 if (oldp) {
440 *oldlenp = len;
441 error = copyout(str, oldp, len);
442 }
443 if (error == 0 && newp) {
444 error = copyin(newp, str, newlen);
445 str[newlen] = 0;
446 }
447 return (error);
448 }
449
450 /*
451 * As above, but read-only.
452 */
453 int
454 sysctl_rdstring(oldp, oldlenp, newp, str)
455 void *oldp;
456 size_t *oldlenp;
457 void *newp;
458 char *str;
459 {
460 int len, error = 0;
461
462 len = strlen(str) + 1;
463 if (oldp && *oldlenp < len)
464 return (ENOMEM);
465 if (newp)
466 return (EPERM);
467 *oldlenp = len;
468 if (oldp)
469 error = copyout(str, oldp, len);
470 return (error);
471 }
472
473 /*
474 * Validate parameters and get old / set new parameters
475 * for a structure oriented sysctl function.
476 */
477 int
478 sysctl_struct(oldp, oldlenp, newp, newlen, sp, len)
479 void *oldp;
480 size_t *oldlenp;
481 void *newp;
482 size_t newlen;
483 void *sp;
484 int len;
485 {
486 int error = 0;
487
488 if (oldp && *oldlenp < len)
489 return (ENOMEM);
490 if (newp && newlen > len)
491 return (EINVAL);
492 if (oldp) {
493 *oldlenp = len;
494 error = copyout(sp, oldp, len);
495 }
496 if (error == 0 && newp)
497 error = copyin(newp, sp, len);
498 return (error);
499 }
500
501 /*
502 * Validate parameters and get old parameters
503 * for a structure oriented sysctl function.
504 */
505 int
506 sysctl_rdstruct(oldp, oldlenp, newp, sp, len)
507 void *oldp;
508 size_t *oldlenp;
509 void *newp, *sp;
510 int len;
511 {
512 int error = 0;
513
514 if (oldp && *oldlenp < len)
515 return (ENOMEM);
516 if (newp)
517 return (EPERM);
518 *oldlenp = len;
519 if (oldp)
520 error = copyout(sp, oldp, len);
521 return (error);
522 }
523
524 /*
525 * Get file structures.
526 */
527 int
528 sysctl_file(where, sizep)
529 char *where;
530 size_t *sizep;
531 {
532 int buflen, error;
533 struct file *fp;
534 char *start = where;
535
536 buflen = *sizep;
537 if (where == NULL) {
538 /*
539 * overestimate by 10 files
540 */
541 *sizep = sizeof(filehead) + (nfiles + 10) * sizeof(struct file);
542 return (0);
543 }
544
545 /*
546 * first copyout filehead
547 */
548 if (buflen < sizeof(filehead)) {
549 *sizep = 0;
550 return (0);
551 }
552 error = copyout((caddr_t)&filehead, where, sizeof(filehead));
553 if (error)
554 return (error);
555 buflen -= sizeof(filehead);
556 where += sizeof(filehead);
557
558 /*
559 * followed by an array of file structures
560 */
561 for (fp = filehead.lh_first; fp != 0; fp = fp->f_list.le_next) {
562 if (buflen < sizeof(struct file)) {
563 *sizep = where - start;
564 return (ENOMEM);
565 }
566 error = copyout((caddr_t)fp, where, sizeof (struct file));
567 if (error)
568 return (error);
569 buflen -= sizeof(struct file);
570 where += sizeof(struct file);
571 }
572 *sizep = where - start;
573 return (0);
574 }
575
576 /*
577 * try over estimating by 5 procs
578 */
579 #define KERN_PROCSLOP (5 * sizeof (struct kinfo_proc))
580
581 int
582 sysctl_doproc(name, namelen, where, sizep)
583 int *name;
584 u_int namelen;
585 char *where;
586 size_t *sizep;
587 {
588 register struct proc *p;
589 register struct kinfo_proc *dp = (struct kinfo_proc *)where;
590 register int needed = 0;
591 int buflen = where != NULL ? *sizep : 0;
592 int doingzomb;
593 struct eproc eproc;
594 int error = 0;
595
596 if (namelen != 2 && !(namelen == 1 && name[0] == KERN_PROC_ALL))
597 return (EINVAL);
598 p = allproc.lh_first;
599 doingzomb = 0;
600 again:
601 for (; p != 0; p = p->p_list.le_next) {
602 /*
603 * Skip embryonic processes.
604 */
605 if (p->p_stat == SIDL)
606 continue;
607 /*
608 * TODO - make more efficient (see notes below).
609 * do by session.
610 */
611 switch (name[0]) {
612
613 case KERN_PROC_PID:
614 /* could do this with just a lookup */
615 if (p->p_pid != (pid_t)name[1])
616 continue;
617 break;
618
619 case KERN_PROC_PGRP:
620 /* could do this by traversing pgrp */
621 if (p->p_pgrp->pg_id != (pid_t)name[1])
622 continue;
623 break;
624
625 case KERN_PROC_TTY:
626 if ((p->p_flag & P_CONTROLT) == 0 ||
627 p->p_session->s_ttyp == NULL ||
628 p->p_session->s_ttyp->t_dev != (dev_t)name[1])
629 continue;
630 break;
631
632 case KERN_PROC_UID:
633 if (p->p_ucred->cr_uid != (uid_t)name[1])
634 continue;
635 break;
636
637 case KERN_PROC_RUID:
638 if (p->p_cred->p_ruid != (uid_t)name[1])
639 continue;
640 break;
641 }
642 if (buflen >= sizeof(struct kinfo_proc)) {
643 fill_eproc(p, &eproc);
644 error = copyout((caddr_t)p, &dp->kp_proc,
645 sizeof(struct proc));
646 if (error)
647 return (error);
648 error = copyout((caddr_t)&eproc, &dp->kp_eproc,
649 sizeof(eproc));
650 if (error)
651 return (error);
652 dp++;
653 buflen -= sizeof(struct kinfo_proc);
654 }
655 needed += sizeof(struct kinfo_proc);
656 }
657 if (doingzomb == 0) {
658 p = zombproc.lh_first;
659 doingzomb++;
660 goto again;
661 }
662 if (where != NULL) {
663 *sizep = (caddr_t)dp - where;
664 if (needed > *sizep)
665 return (ENOMEM);
666 } else {
667 needed += KERN_PROCSLOP;
668 *sizep = needed;
669 }
670 return (0);
671 }
672
673 /*
674 * Fill in an eproc structure for the specified process.
675 */
676 void
677 fill_eproc(p, ep)
678 register struct proc *p;
679 register struct eproc *ep;
680 {
681 register struct tty *tp;
682
683 ep->e_paddr = p;
684 ep->e_sess = p->p_pgrp->pg_session;
685 ep->e_pcred = *p->p_cred;
686 ep->e_ucred = *p->p_ucred;
687 if (p->p_stat == SIDL || p->p_stat == SZOMB) {
688 ep->e_vm.vm_rssize = 0;
689 ep->e_vm.vm_tsize = 0;
690 ep->e_vm.vm_dsize = 0;
691 ep->e_vm.vm_ssize = 0;
692 /* ep->e_vm.vm_pmap = XXX; */
693 } else {
694 register struct vmspace *vm = p->p_vmspace;
695
696 #ifdef pmap_resident_count
697 ep->e_vm.vm_rssize = pmap_resident_count(&vm->vm_pmap); /*XXX*/
698 #else
699 ep->e_vm.vm_rssize = vm->vm_rssize;
700 #endif
701 ep->e_vm.vm_tsize = vm->vm_tsize;
702 ep->e_vm.vm_dsize = vm->vm_dsize;
703 ep->e_vm.vm_ssize = vm->vm_ssize;
704 ep->e_vm.vm_pmap = vm->vm_pmap;
705 }
706 if (p->p_pptr)
707 ep->e_ppid = p->p_pptr->p_pid;
708 else
709 ep->e_ppid = 0;
710 ep->e_pgid = p->p_pgrp->pg_id;
711 ep->e_jobc = p->p_pgrp->pg_jobc;
712 if ((p->p_flag & P_CONTROLT) &&
713 (tp = ep->e_sess->s_ttyp)) {
714 ep->e_tdev = tp->t_dev;
715 ep->e_tpgid = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PID;
716 ep->e_tsess = tp->t_session;
717 } else
718 ep->e_tdev = NODEV;
719 ep->e_flag = ep->e_sess->s_ttyvp ? EPROC_CTTY : 0;
720 if (SESS_LEADER(p))
721 ep->e_flag |= EPROC_SLEADER;
722 if (p->p_wmesg)
723 strncpy(ep->e_wmesg, p->p_wmesg, WMESGLEN);
724 ep->e_xsize = ep->e_xrssize = 0;
725 ep->e_xccount = ep->e_xswrss = 0;
726 }
727
728