Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern pipe_create(): explicitly zero whole memory returne...
details: https://anonhg.NetBSD.org/src/rev/3c27f020b7dd
branches: trunk
changeset: 513217:3c27f020b7dd
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Thu Jul 26 14:14:28 2001 +0000
description:
pipe_create(): explicitly zero whole memory returned from pool_get(), instead
of some selective pieces. This fixes problem with NEW_PIPE in kernels
with DEBUG option, reported via e-mail by Chuck Silvers.
sys_pipe(): g/c fdp, provide it at the chunk of FreeBSD code where it's used
diffstat:
sys/kern/sys_pipe.c | 34 ++++++----------------------------
1 files changed, 6 insertions(+), 28 deletions(-)
diffs (70 lines):
diff -r eefe61da2b10 -r 3c27f020b7dd sys/kern/sys_pipe.c
--- a/sys/kern/sys_pipe.c Thu Jul 26 13:47:24 2001 +0000
+++ b/sys/kern/sys_pipe.c Thu Jul 26 14:14:28 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_pipe.c,v 1.10 2001/07/18 06:51:38 thorpej Exp $ */
+/* $NetBSD: sys_pipe.c,v 1.11 2001/07/26 14:14:28 jdolecek Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
@@ -230,7 +230,6 @@
register_t *retval;
#endif
{
- struct filedesc *fdp = p->p_fd;
struct file *rf, *wf;
struct pipe *rpipe, *wpipe;
int fd, error;
@@ -267,6 +266,8 @@
rf->f_ops = &pipeops;
error = falloc(p, &wf, &fd);
if (error) {
+ struct filedesc *fdp = p->p_fd;
+
if (fdp->fd_ofiles[p->p_retval[0]] == rf) {
fdp->fd_ofiles[p->p_retval[0]] = NULL;
fdrop(rf, p);
@@ -332,7 +333,7 @@
free3:
FILE_UNUSE(rf, p);
ffree(rf);
- fdremove(fdp, retval[0]);
+ fdremove(p->p_fd, retval[0]);
free2:
pipeclose(wpipe);
pipeclose(rpipe);
@@ -428,32 +429,9 @@
cpipe = *cpipep;
-#ifdef __FreeBSD__
- /* so pipespace()->pipe_free_kmem() doesn't follow junk pointer */
- cpipe->pipe_buffer.object = NULL;
-#endif /* FreeBSD */
- /*
- * protect so pipeclose() doesn't follow a junk pointer
- * if pipespace() fails.
- */
- cpipe->pipe_buffer.buffer = NULL;
- memset(&cpipe->pipe_sel, 0, sizeof(cpipe->pipe_sel));
+ /* Initialize */
+ memset(cpipe, 0, sizeof(*cpipe));
cpipe->pipe_state = PIPE_SIGNALR;
- cpipe->pipe_peer = NULL;
- cpipe->pipe_busy = 0;
-
-#ifndef PIPE_NODIRECT
- /*
- * pipe data structure initializations to support direct pipe I/O
- */
- cpipe->pipe_map.cnt = 0;
- cpipe->pipe_map.kva = NULL;
- cpipe->pipe_map.pos = 0;
- cpipe->pipe_map.npages = 0;
-#ifdef __NetBSD__
- cpipe->pipe_map.ms = NULL;
-#endif
-#endif /* !PIPE_NODIRECT */
if (allockva && (error = pipespace(cpipe, PIPE_SIZE)))
return (error);
Home |
Main Index |
Thread Index |
Old Index