MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pipe_zone_ctor

Function pipe_zone_ctor

freebsd/kern/sys_pipe.c:266–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266static int
267pipe_zone_ctor(void *mem, int size, void *arg, int flags)
268{
269 struct pipepair *pp;
270 struct pipe *rpipe, *wpipe;
271
272 KASSERT(size == sizeof(*pp), ("pipe_zone_ctor: wrong size"));
273
274 pp = (struct pipepair *)mem;
275
276 /*
277 * We zero both pipe endpoints to make sure all the kmem pointers
278 * are NULL, flag fields are zero'd, etc. We timestamp both
279 * endpoints with the same time.
280 */
281 rpipe = &pp->pp_rpipe;
282 bzero(rpipe, sizeof(*rpipe));
283 pipe_timestamp(&rpipe->pipe_ctime);
284 rpipe->pipe_atime = rpipe->pipe_mtime = rpipe->pipe_ctime;
285
286 wpipe = &pp->pp_wpipe;
287 bzero(wpipe, sizeof(*wpipe));
288 wpipe->pipe_ctime = rpipe->pipe_ctime;
289 wpipe->pipe_atime = wpipe->pipe_mtime = rpipe->pipe_ctime;
290
291 rpipe->pipe_peer = wpipe;
292 rpipe->pipe_pair = pp;
293 wpipe->pipe_peer = rpipe;
294 wpipe->pipe_pair = pp;
295
296 /*
297 * Mark both endpoints as present; they will later get free'd
298 * one at a time. When both are free'd, then the whole pair
299 * is released.
300 */
301 rpipe->pipe_present = PIPE_ACTIVE;
302 wpipe->pipe_present = PIPE_ACTIVE;
303
304 /*
305 * Eventually, the MAC Framework may initialize the label
306 * in ctor or init, but for now we do it elswhere to avoid
307 * blocking in ctor or init.
308 */
309 pp->pp_label = NULL;
310
311 return (0);
312}
313
314static int
315pipe_zone_init(void *mem, int size, int flags)

Callers

nothing calls this directly

Calls 2

bzeroFunction · 0.85
pipe_timestampFunction · 0.85

Tested by

no test coverage detected