diff --git a/src/core/daemonize.c b/src/core/daemonize.c index 0b3d91c6aef..bc51c9674bc 100644 --- a/src/core/daemonize.c +++ b/src/core/daemonize.c @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include /* setrlimit */ #include #include @@ -101,7 +101,7 @@ void daemon_status_init() int daemon_status_pre_daemonize(void) { int ret; - + retry: ret = pipe(daemon_status_fd); if (ret < 0 && errno == EINTR) @@ -123,7 +123,7 @@ int daemon_status_pre_daemonize(void) int daemon_status_wait(char* status) { int ret; - + /* close the output side of the pipe */ if (daemon_status_fd[1] != -1) { close(daemon_status_fd[1]); @@ -249,7 +249,7 @@ int enable_dumpable(void) * pid_file - if set the pid will be written here (ascii). * pgid_file - if set, the pgid will be written here (ascii). * log_stderr - if not set syslog will be opened (openlog(name,...)) - * + * * * Side-effects: * sets own_pgid after becoming session leader (own process group). @@ -280,7 +280,7 @@ int daemonize(char* name, int status_wait) LM_CRIT("Cannot chroot to %s: %s\n", chroot_dir, strerror(errno)); goto error; } - + if (chdir(working_dir)<0){ LM_CRIT("cannot chdir to %s: %s\n", working_dir, strerror(errno)); goto error; @@ -329,7 +329,7 @@ int daemonize(char* name, int status_wait) /* added by noh: create a pid file for the main process */ if (pid_file!=0){ - + if ((pid_stream=fopen(pid_file, "r"))!=NULL){ if (fscanf(pid_stream, "%d", &p) < 0) { LM_WARN("could not parse pid file %s\n", pid_file); @@ -350,7 +350,7 @@ int daemonize(char* name, int status_wait) } pid=getpid(); if ((pid_stream=fopen(pid_file, "w"))==NULL){ - LM_WARN("unable to create pid file %s: %s\n", + LM_WARN("unable to create pid file %s: %s\n", pid_file, strerror(errno)); goto error; }else{ @@ -396,7 +396,7 @@ int daemonize(char* name, int status_wait) value*/ } } - + /* try to replace stdin, stdout & stderr with /dev/null */ if (freopen("/dev/null", "r", stdin)==0){ LM_ERR("unable to replace stdin with /dev/null: %s\n", @@ -414,7 +414,7 @@ int daemonize(char* name, int status_wait) strerror(errno)); /* continue, leave it open */ }; - + /* close all but the daemon_status_fd output as the main process must still write into it to tell the parent to exit with 0 */ closelog(); @@ -422,7 +422,7 @@ int daemonize(char* name, int status_wait) if(r != daemon_status_fd[1]) close(r); } - + if (log_stderr==0) openlog(name, LOG_PID|LOG_CONS, cfg_get(core, core_cfg, log_facility)); /* LOG_CONS, LOG_PERRROR ? */ @@ -438,7 +438,7 @@ int daemonize(char* name, int status_wait) int do_suid() { struct passwd *pw; - + if (gid){ if(gid!=getgid()) { if(setgid(gid)<0){ @@ -447,7 +447,7 @@ int do_suid() } } } - + if(uid){ if (!(pw = getpwuid(uid))){ LM_CRIT("user lookup failed: %s\n", strerror(errno)); @@ -455,7 +455,7 @@ int do_suid() } if(uid!=getuid()) { if(initgroups(pw->pw_name, pw->pw_gid)<0){ - LM_CRIT("cannot set supplementary groups: %s\n", + LM_CRIT("cannot set supplementary groups: %s\n", strerror(errno)); goto error; } @@ -481,7 +481,7 @@ int increase_open_fds(int target) { struct rlimit lim; struct rlimit orig; - + if (getrlimit(RLIMIT_NOFILE, &lim)<0){ LM_CRIT("cannot get the maximum number of file descriptors: %s\n", strerror(errno)); @@ -498,7 +498,7 @@ int increase_open_fds(int target) }else{ /* more than the hard limit */ LM_INFO("trying to increase the open file limit" - " past the hard limit (%ld -> %d)\n", + " past the hard limit (%ld -> %d)\n", (unsigned long)lim.rlim_max, target); lim.rlim_max=target; lim.rlim_cur=target; @@ -535,7 +535,7 @@ int set_core_dump(int enable, long unsigned int size) { struct rlimit lim; struct rlimit newlim; - + if (enable){ if (getrlimit(RLIMIT_CORE, &lim)<0){ LM_CRIT("cannot get the maximum core size: %s\n", @@ -603,11 +603,11 @@ int mem_lock_pages() #else /* if MLOCKALL not defined return error */ LM_WARN("failed to lock the memory pages: no mlockall support\n"); return -1; -#endif +#endif } -/*! \brief tries to set real time priority +/*! \brief tries to set real time priority * policy: 0 - SCHED_OTHER, 1 - SCHED_RR, 2 - SCHED_FIFO */ int set_rt_prio(int prio, int policy) { @@ -615,7 +615,7 @@ int set_rt_prio(int prio, int policy) struct sched_param sch_p; int min_prio, max_prio; int sched_policy; - + switch(policy){ case 0: sched_policy=SCHED_OTHER; diff --git a/src/core/daemonize.h b/src/core/daemonize.h index a9b40f795b4..a8ee113a779 100644 --- a/src/core/daemonize.h +++ b/src/core/daemonize.h @@ -18,11 +18,11 @@ * \file * \brief Kamailio core :: Daemonize * \author andrei - * - * \ingroup core - * Module: \ref core - * - * + * + * \ingroup core + * Module: \ref core + * + * */ #ifndef _daemonize_h diff --git a/src/core/proxy.c b/src/core/proxy.c index 589d1ad88e1..78e74da3a64 100644 --- a/src/core/proxy.c +++ b/src/core/proxy.c @@ -1,7 +1,6 @@ /* * proxy list & assoc. functions * - * * Copyright (C) 2001-2003 FhG Fokus * * This file is part of Kamailio, a free SIP server. @@ -16,8 +15,8 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -54,9 +53,9 @@ struct proxy_l* proxies=0; -/* searches for the proxy named 'name', on port 'port' with +/* searches for the proxy named 'name', on port 'port' with proto 'proto'; if proto==0 => proto wildcard (will match any proto) - returns: pointer to proxy_l on success or 0 if not found */ + returns: pointer to proxy_l on success or 0 if not found */ static struct proxy_l* find_proxy(str *name, unsigned short port, int proto) { struct proxy_l* t; @@ -206,7 +205,7 @@ void free_shm_hostent(struct hostent* dst) struct proxy_l* add_proxy(str* name, unsigned short port, int proto) { struct proxy_l* p; - + if ((p=find_proxy(name, port, proto))!=0) return p; if ((p=mk_proxy(name, port, proto))==0) goto error; /* add p to the proxy list */ diff --git a/src/core/proxy.h b/src/core/proxy.h index e0872406b5b..d6ed0f83081 100644 --- a/src/core/proxy.h +++ b/src/core/proxy.h @@ -13,13 +13,13 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /*! * \file - * \brief Kamailio core :: Proxy + * \brief Kamailio core :: Proxy * \ingroup core * \author andrei * Module: \ref core @@ -40,7 +40,7 @@ struct proxy_l{ unsigned short port; unsigned short reserved; /*align*/ int proto; - + /* socket ? */ int addr_idx; /* crt. addr. idx. */ @@ -62,7 +62,6 @@ void free_proxy(struct proxy_l* p); void free_shm_proxy(struct proxy_l* p); - /** returns 0 on success, -1 on error (unknown af/bug) */ inline static int proxy2su(union sockaddr_union* su, struct proxy_l* p) { @@ -73,13 +72,12 @@ inline static int proxy2su(union sockaddr_union* su, struct proxy_l* p) else p->addr_idx=0; p->ok=1; } - + return hostent2su(su, &p->host, p->addr_idx, (p->port)?p->port:((p->proto==PROTO_TLS)?SIPS_PORT:SIP_PORT) ); } - /** mark proxy either as ok (err>=0) or as bad (err<0) */ inline static void proxy_mark(struct proxy_l* p, int err) { @@ -92,6 +90,5 @@ inline static void proxy_mark(struct proxy_l* p, int err) } - #endif diff --git a/src/core/shm_init.c b/src/core/shm_init.c index a02eb04bbbe..1dfcddae3cc 100644 --- a/src/core/shm_init.c +++ b/src/core/shm_init.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2010 iptelorg GmbH * * Permission to use, copy, modify, and distribute this software for any diff --git a/src/core/shm_init.h b/src/core/shm_init.h index 178800b6b74..9abe9d2b530 100644 --- a/src/core/shm_init.h +++ b/src/core/shm_init.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2010 iptelorg GmbH * * Permission to use, copy, modify, and distribute this software for any diff --git a/src/core/signals.c b/src/core/signals.c index 374a3dd0e04..0d0dd1fa909 100644 --- a/src/core/signals.c +++ b/src/core/signals.c @@ -13,8 +13,8 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -36,14 +36,14 @@ void (*set_sig_h(int sig, void (*handler) (int) ))(int) { struct sigaction act; struct sigaction old; - + memset(&act, 0, sizeof(act)); act.sa_handler=handler; /* sigemptyset(&act.sa_mask); act.sa_flags=0; */ - /* sa_sigaction not set, we use sa_hanlder instead */ + /* sa_sigaction not set, we use sa_hanlder instead */ return (sigaction (sig, &act, &old)==-1)?SIG_ERR:old.sa_handler; } #endif diff --git a/src/core/signals.h b/src/core/signals.h index 88025b45a37..f4119498cf1 100644 --- a/src/core/signals.h +++ b/src/core/signals.h @@ -13,8 +13,8 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /*! \file diff --git a/src/core/tls_hooks.h b/src/core/tls_hooks.h index a789a496f4f..528bf244ce9 100644 --- a/src/core/tls_hooks.h +++ b/src/core/tls_hooks.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 iptelorg GmbH + * Copyright (C) 2007 iptelorg GmbH * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -63,14 +63,14 @@ struct tls_hooks{ int (*on_tcpconn_init)(struct tcp_connection *c, int sock); void (*tcpconn_clean)(struct tcp_connection* c); void (*tcpconn_close)(struct tcp_connection*c , int fd); - + /* per listening socket init, called on kamailio startup (after modules, * process table, init() and udp socket initialization)*/ int (*init_si)(struct socket_info* si); /* generic init function (called at kamailio init, after module initialization * and process table creation)*/ int (*init)(void); - /* destroy function, called after the modules are destroyed, and + /* destroy function, called after the modules are destroyed, and * after destroy_tcp() */ void (*destroy)(void); /* generic pre-init function (called at kamailio start, before module