Beispiel #1
0
static int
Fork1(EXEC *ep)
{
	int			pid;
	int			fds[2];

	if (pipe(fds) == -1) {
		note("Failed to create pipe for child process (%s).\n", PERROR);
		errno = EAGAIN ;
		return(-1);
	}

	ep->md = mconnect((char *)0, fds[0], fds[1]);

	switch (pid = fork()) {

	case -1:
		mdisconnect(ep->md);
		close(fds[0]);
		close(fds[1]);
		ep->md = 0;
		return (-1);
	
	case 0:
		ChildMd = mconnect(NULL, fds[1], fds[1]);
		return (0);

	default:
		mlistenadd(ep->md, POLLIN);
		return (pid);
	}
}
Beispiel #2
0
static void
done(int status, int err)
{
	if (do_undial)
		undial (1);

	mputm (ChildMd, S_CHILD_DONE, key, status, err);
	mdisconnect (ChildMd);

	exit (0);
	/*NOTREACHED*/
}
Beispiel #3
0
void
papiServiceDestroy(papi_service_t handle)
{
    service_t *svc = handle;

    if (svc != NULL) {
        if (svc->md != NULL)
            mdisconnect(svc->md);
        if (svc->msgbuf != NULL)
            free(svc->msgbuf);
        papiAttributeListFree(svc->attributes);
        free(svc);
    }
}