1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is the Netscape Portable Runtime (NSPR).
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998-2000
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
41 * The purpose of this test and the sproc_p.c test is to test the shutdown
42 * of all the IRIX sprocs in a program when one of them dies due to an error.
44 * There are three sprocs in this test: the parent, the child, and the
45 * grandchild. The parent and child sprocs never stop on their own.
46 * The grandchild sproc gets a segmentation fault and dies. You should
47 * You should use "ps" to see if the parent and child sprocs are killed
48 * after the grandchild dies.
56 int main(int argc, char **argv)
58 printf("This test applies to IRIX only.\n");
65 #include <sys/types.h>
68 void SegFault(void *unused)
72 printf("The grandchild sproc has pid %d.\n", getpid());
73 printf("The grandchild sproc will get a segmentation fault and die.\n");
74 printf("The parent and child sprocs should be killed after the "
75 "grandchild sproc dies.\n");
76 printf("Use 'ps' to make sure this is so.\n");
78 /* Force a segmentation fault */
82 void NeverStops(void *unused)
86 printf("The child sproc has pid %d.\n", getpid());
87 printf("The child sproc won't stop on its own.\n");
90 /* create the grandchild sproc */
91 PR_CreateThread(PR_USER_THREAD, SegFault, NULL,
92 PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0);
103 PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
105 printf("The parent sproc has pid %d.\n", getpid());
106 printf("The parent sproc won't stop on its own.\n");
109 /* create the child sproc */
110 PR_CreateThread(PR_USER_THREAD, NeverStops, NULL,
111 PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0);