00001 /* 00002 * $Id: pt.h 5003 2008-09-26 11:01:51Z henningw $ 00003 * 00004 * Process Table 00005 * 00006 * Copyright (C) 2001-2003 FhG Fokus 00007 * 00008 * This file is part of Kamailio, a free SIP server. 00009 * 00010 * Kamailio is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version 00014 * 00015 * Kamailio is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 * 00024 * History: 00025 * -------- 00026 * 2003-04-15 added tcp_disable support (andrei) 00027 */ 00028 00029 /*! 00030 * \file 00031 * \brief Server process related functions and datastructures 00032 */ 00033 00034 00035 #ifndef _PT_H 00036 #define _PT_H 00037 00038 #include <sys/types.h> 00039 #include <unistd.h> 00040 00041 #include "globals.h" 00042 #include "timer.h" 00043 #include "socket_info.h" 00044 00045 #define MAX_PT_DESC 128 00046 00047 struct process_table { 00048 int pid; 00049 #ifdef USE_TCP 00050 int unix_sock; /*! unix socket on which tcp main listens */ 00051 int idx; /*! tcp child index, -1 for other processes */ 00052 #endif 00053 char desc[MAX_PT_DESC]; 00054 }; 00055 00056 typedef void(*forked_proc_func)(int i); 00057 00058 extern struct process_table *pt; 00059 extern int process_no; 00060 extern unsigned int counted_processes; 00061 00062 int init_multi_proc_support(void); 00063 void set_proc_attrs( char *fmt, ...); 00064 pid_t internal_fork(char *proc_desc); 00065 00066 /*! return processes pid */ 00067 inline static int my_pid(void) 00068 { 00069 return pt ? pt[process_no].pid : getpid(); 00070 } 00071 00072 00073 #endif
1.5.6