1/*
2 * Copyright (c) 1997 John S. Dyson. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. John S. Dyson's name may not be used to endorse or promote products
10 * derived from this software without specific prior written permission.
11 *
12 * DISCLAIMER: This code isn't warranted to do anything useful. Anything
13 * bad that happens because of using this software isn't the responsibility
14 * of the author. This software is distributed AS-IS.
15 *
16 * $FreeBSD: head/sys/kern/vfs_aio.c 91140 2002-02-23 11:12:57Z tanimura $
17 */
18
19/*
20 * This file contains support for the POSIX 1003.1B AIO/LIO facility.
21 */
22
23#include <sys/param.h>
24#include <sys/systm.h>
25#include <sys/malloc.h>
26#include <sys/bio.h>
27#include <sys/buf.h>
28#include <sys/sysproto.h>
29#include <sys/filedesc.h>
30#include <sys/kernel.h>
31#include <sys/kthread.h>
32#include <sys/fcntl.h>
33#include <sys/file.h>
--- 703 unchanged lines hidden (view full) ---
737 struct aio_liojob *lj;
738 struct aiocb *cb;
739 struct aiocblist *aiocbe;
740 struct aiothreadlist *aiop;
741 struct kaioinfo *ki;
742 struct proc *curcp, *mycp, *userp;
743 struct vmspace *myvm, *tmpvm;
744 struct thread *td = curthread;
745 struct pgrp *newpgrp;
746 struct session *newsess;
747
748 mtx_lock(&Giant);
749 /*
750 * Local copies of curproc (cp) and vmspace (myvm)
751 */
752 mycp = td->td_proc;
753 myvm = mycp->p_vmspace;
754
--- 24 unchanged lines hidden (view full) ---
779 /*
780 * Get rid of our current filedescriptors. AIOD's don't need any
781 * filedescriptors, except as temporarily inherited from the client.
782 */
783 fdfree(td);
784 mycp->p_fd = NULL;
785
786 /* The daemon resides in its own pgrp. */
787 MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO);
788 MALLOC(newsess, struct session *, sizeof(struct session), M_SESSION, M_WAITOK | M_ZERO);
789
790 PGRPSESS_XLOCK();
791 enterpgrp(mycp, mycp->p_pid, newpgrp, newsess);
792 PGRPSESS_XUNLOCK();
793
794 /* Mark special process type. */
795 mycp->p_flag |= P_SYSTEM;
796
797 /*
798 * Wakeup parent process. (Parent sleeps to keep from blasting away
799 * and creating too many daemons.)
800 */
801 wakeup(mycp);
--- 1526 unchanged lines hidden ---
2 * Copyright (c) 1997 John S. Dyson. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. John S. Dyson's name may not be used to endorse or promote products
10 * derived from this software without specific prior written permission.
11 *
12 * DISCLAIMER: This code isn't warranted to do anything useful. Anything
13 * bad that happens because of using this software isn't the responsibility
14 * of the author. This software is distributed AS-IS.
15 *
16 * $FreeBSD: head/sys/kern/vfs_aio.c 91140 2002-02-23 11:12:57Z tanimura $
17 */
18
19/*
20 * This file contains support for the POSIX 1003.1B AIO/LIO facility.
21 */
22
23#include <sys/param.h>
24#include <sys/systm.h>
25#include <sys/malloc.h>
26#include <sys/bio.h>
27#include <sys/buf.h>
28#include <sys/sysproto.h>
29#include <sys/filedesc.h>
30#include <sys/kernel.h>
31#include <sys/kthread.h>
32#include <sys/fcntl.h>
33#include <sys/file.h>
--- 703 unchanged lines hidden (view full) ---
737 struct aio_liojob *lj;
738 struct aiocb *cb;
739 struct aiocblist *aiocbe;
740 struct aiothreadlist *aiop;
741 struct kaioinfo *ki;
742 struct proc *curcp, *mycp, *userp;
743 struct vmspace *myvm, *tmpvm;
744 struct thread *td = curthread;
745 struct pgrp *newpgrp;
746 struct session *newsess;
747
748 mtx_lock(&Giant);
749 /*
750 * Local copies of curproc (cp) and vmspace (myvm)
751 */
752 mycp = td->td_proc;
753 myvm = mycp->p_vmspace;
754
--- 24 unchanged lines hidden (view full) ---
779 /*
780 * Get rid of our current filedescriptors. AIOD's don't need any
781 * filedescriptors, except as temporarily inherited from the client.
782 */
783 fdfree(td);
784 mycp->p_fd = NULL;
785
786 /* The daemon resides in its own pgrp. */
787 MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO);
788 MALLOC(newsess, struct session *, sizeof(struct session), M_SESSION, M_WAITOK | M_ZERO);
789
790 PGRPSESS_XLOCK();
791 enterpgrp(mycp, mycp->p_pid, newpgrp, newsess);
792 PGRPSESS_XUNLOCK();
793
794 /* Mark special process type. */
795 mycp->p_flag |= P_SYSTEM;
796
797 /*
798 * Wakeup parent process. (Parent sleeps to keep from blasting away
799 * and creating too many daemons.)
800 */
801 wakeup(mycp);
--- 1526 unchanged lines hidden ---