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)
35 * 2006-06-14 added process table in shared mem (dragos)
36 * 2007-07-04 added register_fds() and get_max_open_fds(() (andrei)
43 #include <sys/types.h>
49 #include "socket_info.h"
52 #define MAX_PT_DESC 128
54 struct process_table {
57 int unix_sock; /* unix socket on which tcp main listens */
58 int idx; /* tcp child index, -1 for other processes */
60 char desc[MAX_PT_DESC];
63 extern struct process_table *pt;
64 extern gen_lock_t* process_lock;
65 extern int *process_count;
66 extern int process_no;
68 extern struct tcp_child* tcp_children;
72 int register_procs(int no);
73 int get_max_open_fds();
74 int register_fds(int no);
77 int close_extra_socks(int proc_id, int proc_no);
79 #define get_proc_no() ((process_count)?*process_count:0)
81 /* return processes pid */
85 * Forks a new process.
86 * @param desc - text description for the process table
87 * @param make_sock - if to create a unix socket pair for it
88 * @returns the pid of the new process
90 int fork_process(int child_id,char *desc,int make_sock);
93 * Forks a new TCP process.
94 * @param desc - text description for the process table
95 * @param r - index in the tcp_children array
96 * @param *reader_fd_1 - pointer to return the reader_fd[1]
97 * @returns the pid of the new process
100 int fork_tcp_process(int child_id,char *desc,int r,int *reader_fd_1);
104 void mem_dump_pkg_cb(str *name);
108 int mem_dump_shm_fixup(void *handle, str *name, void **val);