Deleted Added
full compact
kern_kthread.c (52128) kern_kthread.c (52140)
1/*
2 * Copyright (c) 1999 Peter Wemm <peter@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*
2 * Copyright (c) 1999 Peter Wemm <peter@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/kern/kern_kthread.c 52128 1999-10-11 15:19:12Z peter $
26 * $FreeBSD: head/sys/kern/kern_kthread.c 52140 1999-10-11 20:33:17Z luoqi $
27 */
28
29#include <sys/param.h>
30#include <sys/systm.h>
31#include <sys/proc.h>
32#include <sys/kthread.h>
33#include <sys/unistd.h>
34#include <sys/wait.h>

--- 36 unchanged lines hidden (view full) ---

71 if (error)
72 return error;
73
74 /* save a global descriptor, if desired */
75 if (newpp != NULL)
76 *newpp = p2;
77
78 /* this is a non-swapped system process */
27 */
28
29#include <sys/param.h>
30#include <sys/systm.h>
31#include <sys/proc.h>
32#include <sys/kthread.h>
33#include <sys/unistd.h>
34#include <sys/wait.h>

--- 36 unchanged lines hidden (view full) ---

71 if (error)
72 return error;
73
74 /* save a global descriptor, if desired */
75 if (newpp != NULL)
76 *newpp = p2;
77
78 /* this is a non-swapped system process */
79 p2->p_flag |= P_INMEM | P_SYSTEM | P_NOCLDWAIT;
79 p2->p_flag |= P_INMEM | P_SYSTEM;
80 p2->p_procsig->ps_flag |= PS_NOCLDWAIT;
80 PHOLD(p2);
81
82 /* set up arg0 for 'ps', et al */
83 va_start(ap, fmt);
84 vsnprintf(p2->p_comm, sizeof(p2->p_comm), fmt, ap);
85 va_end(ap);
86
87 /* call the processes' main()... */
88 cpu_set_fork_handler(p2, func, arg);
89
90 return 0;
91}
92
93void
94kthread_exit(int ecode)
95{
96 exit1(curproc, W_EXITCODE(ecode, 0));
97}
98
81 PHOLD(p2);
82
83 /* set up arg0 for 'ps', et al */
84 va_start(ap, fmt);
85 vsnprintf(p2->p_comm, sizeof(p2->p_comm), fmt, ap);
86 va_end(ap);
87
88 /* call the processes' main()... */
89 cpu_set_fork_handler(p2, func, arg);
90
91 return 0;
92}
93
94void
95kthread_exit(int ecode)
96{
97 exit1(curproc, W_EXITCODE(ecode, 0));
98}
99