1f08c3bdfSopenharmony_ci/* 2f08c3bdfSopenharmony_ci * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. 3f08c3bdfSopenharmony_ci * 4f08c3bdfSopenharmony_ci * This program is free software; you can redistribute it and/or modify it 5f08c3bdfSopenharmony_ci * under the terms of version 2 of the GNU General Public License as 6f08c3bdfSopenharmony_ci * published by the Free Software Foundation. 7f08c3bdfSopenharmony_ci * 8f08c3bdfSopenharmony_ci * This program is distributed in the hope that it would be useful, but 9f08c3bdfSopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of 10f08c3bdfSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11f08c3bdfSopenharmony_ci * 12f08c3bdfSopenharmony_ci * Further, this software is distributed without any warranty that it is 13f08c3bdfSopenharmony_ci * free of the rightful claim of any third person regarding infringement 14f08c3bdfSopenharmony_ci * or the like. Any license provided herein, whether implied or 15f08c3bdfSopenharmony_ci * otherwise, applies only to this software file. Patent licenses, if 16f08c3bdfSopenharmony_ci * any, provided herein do not apply to combinations of this program with 17f08c3bdfSopenharmony_ci * other software, or any other product whatsoever. 18f08c3bdfSopenharmony_ci * 19f08c3bdfSopenharmony_ci * You should have received a copy of the GNU General Public License along 20f08c3bdfSopenharmony_ci * with this program; if not, write the Free Software Foundation, Inc., 21f08c3bdfSopenharmony_ci * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 22f08c3bdfSopenharmony_ci * 23f08c3bdfSopenharmony_ci * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, 24f08c3bdfSopenharmony_ci * Mountain View, CA 94043, or: 25f08c3bdfSopenharmony_ci * 26f08c3bdfSopenharmony_ci * http://www.sgi.com 27f08c3bdfSopenharmony_ci * 28f08c3bdfSopenharmony_ci * For further information regarding this notice, see: 29f08c3bdfSopenharmony_ci * 30f08c3bdfSopenharmony_ci * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ 31f08c3bdfSopenharmony_ci */ 32f08c3bdfSopenharmony_ci#ifndef _FORKER_H_ 33f08c3bdfSopenharmony_ci#define _FORKER_H_ 34f08c3bdfSopenharmony_ci 35f08c3bdfSopenharmony_ci#define FORKER_MAX_PIDS 4098 36f08c3bdfSopenharmony_ci 37f08c3bdfSopenharmony_ciextern int Forker_pids[FORKER_MAX_PIDS]; /* holds pids of forked processes */ 38f08c3bdfSopenharmony_ciextern int Forker_npids; /* number of entries in Forker_pids */ 39f08c3bdfSopenharmony_ci 40f08c3bdfSopenharmony_ci/* 41f08c3bdfSopenharmony_ci * This function will fork and the parent will exit zero and 42f08c3bdfSopenharmony_ci * the child will return. This will orphan the returning process 43f08c3bdfSopenharmony_ci * putting it in the background. 44f08c3bdfSopenharmony_ci */ 45f08c3bdfSopenharmony_ciint background( char * ); 46f08c3bdfSopenharmony_ci 47f08c3bdfSopenharmony_ci/* 48f08c3bdfSopenharmony_ci * Forker will fork ncopies-1 copies of self. 49f08c3bdfSopenharmony_ci * 50f08c3bdfSopenharmony_ci * arg 1: Number of copies of the process to be running after return. 51f08c3bdfSopenharmony_ci * This value minus one is the number of forks performed. 52f08c3bdfSopenharmony_ci * arg 2: mode: 0 - all children are first generation descendents. 53f08c3bdfSopenharmony_ci * 1 - each subsequent child is a descendent of another 54f08c3bdfSopenharmony_ci * descendent, resulting in only one direct descendent of the 55f08c3bdfSopenharmony_ci * parent and each other child is a child of another child in 56f08c3bdfSopenharmony_ci * relation to the parent. 57f08c3bdfSopenharmony_ci * arg 3: prefix: string to preceed any error messages. A value of NULL 58f08c3bdfSopenharmony_ci * results in no error messages on failure. 59f08c3bdfSopenharmony_ci * returns: returns to parent the number of children forked. 60f08c3bdfSopenharmony_ci */ 61f08c3bdfSopenharmony_ciint forker( int , int , char * ); 62f08c3bdfSopenharmony_ci 63f08c3bdfSopenharmony_ci#endif /* _FORKER_H_ */ 64