8 * Copyright (C) 2001-2003 Fhg Fokus
10 * This file is part of ser, a free SIP server.
12 * ser is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version
17 * For a license to use the ser software under conditions
18 * other than those described here, or to purchase support for this
19 * software, please contact iptel.org by e-mail at the following addresses:
22 * ser is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 * 2003-04-15 added tcp_disable support (andrei)
41 #include <sys/types.h>
46 #include "socket_info.h"
48 #define MAX_PT_DESC 128
50 struct process_table {
53 int unix_sock; /* unix socket on which tcp main listens */
54 int idx; /* tcp child index, -1 for other processes */
56 char desc[MAX_PT_DESC];
59 extern struct process_table *pt;
60 extern int process_no;
62 /* get number of process started by main with
65 inline static int process_count()
68 struct socket_info* si;
70 for (si=udp_listen, udp_listeners=0; si; si=si->next, udp_listeners++);
72 /* receivers and attendant */
73 (dont_fork ? 1 : children_no*udp_listeners + 1)
75 + (timer_list ? 1 : 0 )
77 +((fifo==NULL || strlen(fifo)==0) ? 0 : 1 )
79 +((!tcp_disable)?( 1/* tcp main */ + tcp_children_no +
80 (timer_list ? 0: 1)):0) /* add the timer proc.
89 /* retun processes's pid */
90 inline static int my_pid()
92 return pt ? pt[process_no].pid : getpid();