37 #define _XOPEN_SOURCE 600 43 #include <sys/resource.h> 48 #include <sys/prctl.h> 56 #define PIDFILE "freeswitch.pid" 62 #pragma warning (disable:167) 67 #define SERVICENAME_DEFAULT "FreeSWITCH" 68 #define SERVICENAME_MAXLEN 256 69 static char service_name[SERVICENAME_MAXLEN];
75 static HANDLE shutdown_event;
107 char path[PATH_MAX] =
"";
117 if ((f = fopen(path,
"r")) == 0) {
119 fprintf(stderr,
"Cannot open pid file %s.\n", path);
124 if (fscanf(f,
"%d", (
int *) (intptr_t) & pid) != 1) {
132 fprintf(stderr,
"Killing: %d\n", (
int) pid);
135 snprintf(path,
sizeof(path),
"Global\\Freeswitch.%d", pid);
138 shutdown_event = OpenEvent(EVENT_MODIFY_STATE,
FALSE, path);
141 if (!shutdown_event) {
143 fprintf(stderr,
"ERROR: Can't Shutdown: %d\n", (
int) pid);
146 SetEvent(shutdown_event);
148 CloseHandle(shutdown_event);
165 SERVICE_STATUS_HANDLE hStatus;
166 SERVICE_STATUS status;
169 void WINAPI ServiceCtrlHandler(DWORD control)
172 case SERVICE_CONTROL_SHUTDOWN:
173 case SERVICE_CONTROL_STOP:
177 status.dwCurrentState = SERVICE_STOPPED;
178 status.dwWin32ExitCode = 0;
179 status.dwCheckPoint = 0;
180 status.dwWaitHint = 0;
182 case SERVICE_CONTROL_INTERROGATE:
188 SetServiceStatus(hStatus, &status);
192 void WINAPI service_main(DWORD numArgs,
char **args)
195 const char *err = NULL;
199 flags = service_flags;
202 memset(&status, 0,
sizeof(SERVICE_STATUS));
203 status.dwServiceType = SERVICE_WIN32;
204 status.dwCurrentState = SERVICE_START_PENDING;
205 status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
208 hStatus = RegisterServiceCtrlHandler(service_name, &ServiceCtrlHandler);
211 SetServiceStatus(hStatus, &status);
218 status.dwCurrentState = SERVICE_STOPPED;
221 status.dwCurrentState = SERVICE_RUNNING;
225 SetServiceStatus(hStatus, &status);
232 struct pollfd pfds[2] = { { 0 } };
236 pfds[0].events = POLLIN | POLLERR;
237 s = poll(pfds, 1, ms);
239 if (s == 0 || s == -1) {
244 if ((pfds[0].revents & POLLIN)) {
245 if (read(fd, &r,
sizeof(r)) > -1) {
246 (void)write(fd, &r,
sizeof(r));
258 unsigned int sanity = 60;
265 fprintf(stderr,
"Error Backgrounding (fork)! %d - %s\n", errno, strerror(errno));
273 fprintf(stderr,
"Error Backgrounding (setsid)! %d - %s\n", errno, strerror(errno));
287 fprintf(stderr,
"Error Backgrounding (fork2)! %d - %s\n", errno, strerror(errno));
291 fprintf(stderr,
"%d Backgrounding.\n", (
int) pid);
298 if ((o = getenv(
"FREESWITCH_BG_TIMEOUT"))) {
309 printf(
"FreeSWITCH[%d] Waiting for background process pid:%d to be ready.....\n", (
int)getpid(), (
int) pid);
320 printf(
"FreeSWITCH[%d] Error starting system! pid:%d\n", (
int)getpid(), (
int) pid);
325 printf(
"FreeSWITCH[%d] System Ready pid:%d\n", (
int) getpid(), (
int) pid);
335 fd = open(
"/dev/null", O_RDONLY);
342 fd = open(
"/dev/null", O_WRONLY);
349 fd = open(
"/dev/null", O_WRONLY);
366 int i;
struct sigaction sa, sa_dfl, sa4_prev, sa15_prev, sa17_prev;
367 memset(&sa, 0,
sizeof(sa));
memset(&sa_dfl, 0,
sizeof(sa_dfl));
369 sa_dfl.sa_handler = SIG_DFL;
374 sigaction(SIGILL, &sa, &sa4_prev);
375 sigaction(SIGTERM, &sa, &sa15_prev);
376 sigaction(SIGCHLD, &sa_dfl, &sa17_prev);
378 r = waitpid(i, &s, 0);
379 if (r == (pid_t)-1) {
380 if (errno == EINTR)
goto rewait;
383 if (r != i)
goto rewait;
385 && (WEXITSTATUS(s) == EXIT_SUCCESS
386 || WEXITSTATUS(s) == EXIT_FAILURE)) {
387 exit(WEXITSTATUS(s));
389 if (WIFEXITED(s) || WIFSIGNALED(s)) {
390 sigaction(SIGILL, &sa4_prev, NULL);
391 sigaction(SIGTERM, &sa15_prev, NULL);
392 sigaction(SIGCHLD, &sa17_prev, NULL);
394 if (argv[0] && execv(argv[0], argv) == -1) {
396 fprintf(stderr,
"Reincarnate execv() failed: %d %s\n", errno,
399 fprintf(stderr,
"Trying reincarnate-reexec plan B...\n");
400 if (argv[0] && execvp(argv[0], argv) == -1) {
402 fprintf(stderr,
"Reincarnate execvp() failed: %d %s\n", errno,
405 fprintf(stderr,
"Falling back to normal reincarnate behavior...\n");
412 prctl(PR_SET_PDEATHSIG, SIGTERM);
420 "Usage: freeswitch [OPTIONS]\n\n" 421 "These are the optional arguments you can pass to freeswitch:\n" 423 "\t-service [name] -- start freeswitch as a service, cannot be used if loaded as a console app\n" 424 "\t-install [name] -- install freeswitch as a service, with optional service name\n" 425 "\t-uninstall -- remove freeswitch as a service\n" 426 "\t-monotonic-clock -- use monotonic clock as timer source\n" 428 "\t-nf -- no forking\n" 429 "\t-reincarnate -- restart the switch on an uncontrolled exit\n" 430 "\t-reincarnate-reexec -- run execv on a restart (helpful for upgrades)\n" 431 "\t-u [user] -- specify user to switch to\n" 432 "\t-g [group] -- specify group to switch to\n" 434 #ifdef HAVE_SETRLIMIT 436 "\t-waste -- allow memory waste\n" 438 "\t-core -- dump cores\n" 440 "\t-help -- this message\n" 441 "\t-version -- print the version and exit\n" 442 "\t-rp -- enable high(realtime) priority settings\n" 443 "\t-lp -- enable low priority settings\n" 444 "\t-np -- enable normal priority settings\n" 445 "\t-vg -- run under valgrind\n" 446 "\t-nosql -- disable internal sql scoreboard\n" 447 "\t-heavy-timer -- Heavy Timer, possibly more accurate but at a cost\n" 448 "\t-nat -- enable auto nat detection\n" 449 "\t-nonat -- disable auto nat detection\n" 450 "\t-nonatmap -- disable auto nat port mapping\n" 451 "\t-nocal -- disable clock calibration\n" 452 "\t-nort -- disable clock clock_realtime\n" 453 "\t-stop -- stop freeswitch\n" 454 "\t-nc -- do not output to a console and background\n" 456 "\t-ncwait -- do not output to a console and background but wait until the system is ready before exiting (implies -nc)\n" 458 "\t-c -- output to a console and stay in the foreground\n" 459 "\n\tOptions to control locations of files:\n" 460 "\t-base [basedir] -- alternate prefix directory\n" 461 "\t-cfgname [filename] -- alternate filename for FreeSWITCH main configuration file\n" 462 "\t-conf [confdir] -- alternate directory for FreeSWITCH configuration files\n" 463 "\t-log [logdir] -- alternate directory for logfiles\n" 464 "\t-run [rundir] -- alternate directory for runtime files\n" 465 "\t-db [dbdir] -- alternate directory for the internal database\n" 466 "\t-mod [moddir] -- alternate directory for modules\n" 467 "\t-htdocs [htdocsdir] -- alternate directory for htdocs\n" 468 "\t-scripts [scriptsdir] -- alternate directory for scripts\n" 469 "\t-temp [directory] -- alternate directory for temporary files\n" 470 "\t-grammar [directory] -- alternate directory for grammar files\n" 471 "\t-certs [directory] -- alternate directory for certificates\n" 472 "\t-recordings [directory] -- alternate directory for recordings\n" 473 "\t-storage [directory] -- alternate directory for voicemail storage\n" 474 "\t-cache [directory] -- alternate directory for cache files\n" 475 "\t-sounds [directory] -- alternate directory for sound files\n";
484 while ((*p == 13) || (*p == 10) || (*p == 9) || (*p == 32) || (*p == 11)) p++;
485 return (p[0] ==
'-');
490 int main(
int argc,
char *argv[])
492 char pid_path[PATH_MAX] =
"";
493 char pid_buffer[32] =
"";
494 char old_pid_buffer[32] = { 0 };
496 const char *err = NULL;
500 char *runas_user = NULL;
501 char *runas_group = NULL;
503 int fds[2] = { 0, 0 };
513 char opts_str[1024] =
"";
514 char *local_argv[1024] = { 0 };
515 int local_argc = argc;
516 char *arg_argv[128] = { 0 };
517 int alt_dirs = 0, alt_base = 0, log_set = 0, run_set = 0, do_kill = 0;
519 #if (defined(__SVR4) && defined(__sun)) 528 #ifdef HAVE_SETRLIMIT 534 for (x = 0; x < argc; x++) {
535 local_argv[x] = argv[x];
538 if ((opts = getenv(
"FREESWITCH_OPTS"))) {
539 strncpy(opts_str, opts,
sizeof(opts_str) - 1);
541 for (x = 0; x < i; x++) {
542 local_argv[local_argc++] = arg_argv[x];
546 if (local_argv[0] && strstr(local_argv[0],
"freeswitchd")) {
553 for (x = 1; x < local_argc; x++) {
558 if (!strcmp(local_argv[x],
"-help") || !strcmp(local_argv[x],
"-h") || !strcmp(local_argv[x],
"-?")) {
559 printf(
"%s\n",
usage);
563 if (x == 1 && !strcmp(local_argv[x],
"-service")) {
576 else if (x == 1 && !strcmp(local_argv[x],
"-install")) {
577 char servicePath[PATH_MAX];
578 char exePath[PATH_MAX];
580 SC_HANDLE hSCManager;
581 SERVICE_DESCRIPTION desc;
582 desc.lpDescription =
"The FreeSWITCH service.";
591 GetModuleFileName(NULL, exePath,
sizeof(exePath));
592 snprintf(servicePath,
sizeof(servicePath),
"%s -service %s", exePath, service_name);
596 hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
598 fprintf(stderr,
"Could not open service manager (%u).\n", GetLastError());
602 hService = CreateService(hSCManager, service_name, service_name, GENERIC_READ | GENERIC_EXECUTE | SERVICE_CHANGE_CONFIG, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_IGNORE,
603 servicePath, NULL, NULL, NULL, NULL, NULL);
605 fprintf(stderr,
"Error creating freeswitch service (%u).\n", GetLastError());
606 CloseServiceHandle(hSCManager);
611 if (!ChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &desc)) {
612 fprintf(stderr,
"FreeSWITCH installed, but could not set the service description (%u).\n", GetLastError());
615 CloseServiceHandle(hService);
616 CloseServiceHandle(hSCManager);
620 else if (x == 1 && !strcmp(local_argv[x],
"-uninstall")) {
622 SC_HANDLE hSCManager;
633 hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
635 fprintf(stderr,
"Could not open service manager (%u).\n", GetLastError());
639 hService = OpenService(hSCManager, service_name, DELETE);
641 fprintf(stderr,
"Error opening service (%u).\n", GetLastError());
642 CloseServiceHandle(hSCManager);
647 deleted = DeleteService(hService);
649 fprintf(stderr,
"Error deleting service (%u).\n", GetLastError());
652 CloseServiceHandle(hService);
653 CloseServiceHandle(hSCManager);
654 exit(deleted ? EXIT_SUCCESS : EXIT_FAILURE);
657 else if (!strcmp(local_argv[x],
"-monotonic-clock")) {
661 else if (!strcmp(local_argv[x],
"-u")) {
664 fprintf(stderr,
"Option '%s' requires an argument!\n", local_argv[x - 1]);
667 runas_user = local_argv[x];
670 else if (!strcmp(local_argv[x],
"-g")) {
673 fprintf(stderr,
"Option '%s' requires an argument!\n", local_argv[x - 1]);
676 runas_group = local_argv[x];
679 else if (!strcmp(local_argv[x],
"-nf")) {
683 else if (!strcmp(local_argv[x],
"-elegant-term")) {
687 else if (!strcmp(local_argv[x],
"-reincarnate")) {
690 else if (!strcmp(local_argv[x],
"-reincarnate-reexec")) {
695 #ifdef HAVE_SETRLIMIT 696 else if (!strcmp(local_argv[x],
"-core")) {
698 memset(&rlp, 0,
sizeof(rlp));
699 rlp.rlim_cur = RLIM_INFINITY;
700 rlp.rlim_max = RLIM_INFINITY;
701 setrlimit(RLIMIT_CORE, &rlp);
704 else if (!strcmp(local_argv[x],
"-waste")) {
706 fprintf(stderr,
"WARNING: Wasting up to 8 megs of memory per thread.\n");
712 else if (!strcmp(local_argv[x],
"-no-auto-stack")) {
718 else if (!strcmp(local_argv[x],
"-version")) {
723 else if (!strcmp(local_argv[x],
"-hp") || !strcmp(local_argv[x],
"-rp")) {
727 else if (!strcmp(local_argv[x],
"-lp")) {
731 else if (!strcmp(local_argv[x],
"-np")) {
735 else if (!strcmp(local_argv[x],
"-nosql")) {
739 else if (!strcmp(local_argv[x],
"-nonat")) {
743 else if (!strcmp(local_argv[x],
"-nat")) {
747 else if (!strcmp(local_argv[x],
"-nonatmap")) {
751 else if (!strcmp(local_argv[x],
"-heavy-timer")) {
755 else if (!strcmp(local_argv[x],
"-nort")) {
759 else if (!strcmp(local_argv[x],
"-nocal")) {
763 else if (!strcmp(local_argv[x],
"-vg")) {
767 else if (!strcmp(local_argv[x],
"-stop")) {
771 else if (!strcmp(local_argv[x],
"-nc")) {
775 else if (!strcmp(local_argv[x],
"-ncwait")) {
780 else if (!strcmp(local_argv[x],
"-c")) {
784 else if (!strcmp(local_argv[x],
"-conf")) {
787 fprintf(stderr,
"When using -conf you must specify a config directory\n");
793 fprintf(stderr,
"Allocation error\n");
800 else if (!strcmp(local_argv[x],
"-mod")) {
803 fprintf(stderr,
"When using -mod you must specify a module directory\n");
809 fprintf(stderr,
"Allocation error\n");
815 else if (!strcmp(local_argv[x],
"-log")) {
818 fprintf(stderr,
"When using -log you must specify a log directory\n");
824 fprintf(stderr,
"Allocation error\n");
832 else if (!strcmp(local_argv[x],
"-run")) {
835 fprintf(stderr,
"When using -run you must specify a pid directory\n");
841 fprintf(stderr,
"Allocation error\n");
848 else if (!strcmp(local_argv[x],
"-db")) {
851 fprintf(stderr,
"When using -db you must specify a db directory\n");
857 fprintf(stderr,
"Allocation error\n");
864 else if (!strcmp(local_argv[x],
"-scripts")) {
867 fprintf(stderr,
"When using -scripts you must specify a scripts directory\n");
873 fprintf(stderr,
"Allocation error\n");
879 else if (!strcmp(local_argv[x],
"-htdocs")) {
882 fprintf(stderr,
"When using -htdocs you must specify a htdocs directory\n");
888 fprintf(stderr,
"Allocation error\n");
894 else if (!strcmp(local_argv[x],
"-base")) {
897 fprintf(stderr,
"When using -base you must specify a base directory\n");
903 fprintf(stderr,
"Allocation error\n");
910 else if (!strcmp(local_argv[x],
"-temp")) {
913 fprintf(stderr,
"When using -temp you must specify a temp directory\n");
919 fprintf(stderr,
"Allocation error\n");
925 else if (!strcmp(local_argv[x],
"-storage")) {
928 fprintf(stderr,
"When using -storage you must specify a storage directory\n");
934 fprintf(stderr,
"Allocation error\n");
940 else if (!strcmp(local_argv[x],
"-cache")) {
943 fprintf(stderr,
"When using -cache you must specify a cache directory\n");
949 fprintf(stderr,
"Allocation error\n");
955 else if (!strcmp(local_argv[x],
"-recordings")) {
958 fprintf(stderr,
"When using -recordings you must specify a recording directory\n");
964 fprintf(stderr,
"Allocation error\n");
970 else if (!strcmp(local_argv[x],
"-grammar")) {
973 fprintf(stderr,
"When using -grammar you must specify a grammar directory\n");
979 fprintf(stderr,
"Allocation error\n");
985 else if (!strcmp(local_argv[x],
"-certs")) {
988 fprintf(stderr,
"When using -certs you must specify a certificates directory\n");
994 fprintf(stderr,
"Allocation error\n");
1000 else if (!strcmp(local_argv[x],
"-sounds")) {
1003 fprintf(stderr,
"When using -sounds you must specify a sounds directory\n");
1009 fprintf(stderr,
"Allocation error\n");
1015 else if (!strcmp(local_argv[x],
"-cfgname")) {
1018 fprintf(stderr,
"When using -cfgname you must specify a filename\n");
1024 fprintf(stderr,
"Allocation error\n");
1032 fprintf(stderr,
"Unknown option '%s', see '%s -help' for a list of valid options\n",
1033 local_argv[x], local_argv[0]);
1038 if (log_set && !run_set) {
1041 fprintf(stderr,
"Allocation error\n");
1052 fprintf(stderr,
"FATAL ERROR! Could not initialize APR\n");
1056 if (alt_dirs && alt_dirs != 3 && !alt_base) {
1057 fprintf(stderr,
"You must specify all or none of -conf, -log, and -db\n");
1062 #if defined(HAVE_SETRLIMIT) && !defined(__sun) 1063 if (!waste && !(flags &
SCF_VG)) {
1066 memset(&rlp, 0,
sizeof(rlp));
1067 getrlimit(RLIMIT_STACK, &rlp);
1070 char buf[1024] =
"";
1073 memset(&rlp, 0,
sizeof(rlp));
1076 setrlimit(RLIMIT_STACK, &rlp);
1079 if (argv) ret = (int) execv(argv[0], argv);
1081 for (i = 0; i < argc; i++) {
1082 switch_snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"%s ", argv[i]);
1100 fprintf(stderr,
"System Error!\n");
1143 if (runas_user || runas_group) {
1145 fprintf(stderr,
"Failed to switch user [%s] / group [%s]\n",
1152 if (win32_service) {
1154 SERVICE_TABLE_ENTRY dispatchTable[] = {
1155 {service_name, &service_main}
1159 service_flags = flags;
1161 if (StartServiceCtrlDispatcher(dispatchTable) == 0) {
1163 fprintf(stderr,
"Error Freeswitch loaded as a console app with -service option\n");
1164 fprintf(stderr,
"To install the service load freeswitch with -install\n");
1174 memset(pid_buffer, 0,
sizeof(pid_buffer));
1177 pid_len = strlen(pid_buffer);
1179 fspr_pool_create(&pool, NULL);
1185 old_pid_len =
sizeof(old_pid_buffer) -1;
1194 fprintf(stderr,
"Cannot open pid file %s.\n", pid_path);
1199 fprintf(stderr,
"Cannot lock pid file %s.\n", pid_path);
1200 old_pid_len = strlen(old_pid_buffer);
1201 if (strlen(old_pid_buffer)) {
1210 fprintf(stderr,
"Cannot Initialize [%s]\n", err);
1219 if (write(fds[1], &v,
sizeof(v)) < 0) {
1220 fprintf(stderr,
"System Error [%s]\n", strerror(errno));
1222 (void)read(fds[1], &v,
sizeof(v));
1225 shutdown(fds[1], 2);
1241 fspr_pool_destroy(pool);
1243 if (unlink(pid_path) != 0) {
1244 fprintf(stderr,
"Failed to delete pid file [%s]\n", pid_path);
1248 char buf[1024] = { 0 };
1252 if (!argv || !argv[0] || execv(argv[0], argv) == -1) {
1253 fprintf(stderr,
"Restart Failed [%s] resorting to plan b\n", strerror(errno));
1254 for (j = 0; j < argc; j++) {
1255 switch_snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"%s ", argv[j]);
int32_t change_user_group(const char *user, const char *group)
Change user and/or group of the running process.
#define SWITCH_FOPEN_TRUNCATE
switch_status_t switch_file_write(switch_file_t *thefile, const void *buf, switch_size_t *nbytes)
#define SWITCH_CHANNEL_LOG
static void handle_SIGILL(int sig)
const char * switch_version_full(void)
#define SWITCH_FOPEN_READ
static void reincarnate_handle_sigterm(int sig)
void switch_sleep(switch_interval_time_t t)
int32_t set_low_priority(void)
#define SWITCH_FLOCK_EXCLUSIVE
static void handle_SIGTERM(int sig)
switch_memory_pool_t * pool
static int freeswitch_kill_background(void)
static void reincarnate_protect(char **argv)
void switch_core_set_globals(void)
Initiate Globals.
switch_status_t switch_core_destroy(void)
Destroy the core.
int switch_snprintf(_Out_z_cap_(len) char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format,...)
uint32_t switch_core_flag_t
static switch_bool_t is_option(const char *p)
static const char usage[]
int32_t set_auto_priority(void)
static void daemonize(int *fds)
#define SWITCH_PATH_SEPARATOR
switch_byte_t switch_byte_t * buf
unsigned int switch_separate_string(_In_ char *buf, char delim, _Post_count_(return) char **array, unsigned int arraylen)
Separate a string into an array based on a character delimiter.
switch_status_t switch_core_init_and_modload(_In_ switch_core_flag_t flags, _In_ switch_bool_t console, _Out_ const char **err)
Initilize the core and load modules.
#define switch_strlen_zero(x)
void switch_core_setrlimits(void)
#define SWITCH_THREAD_STACKSIZE
#define SWITCH_SYSTEM_THREAD_STACKSIZE
int32_t set_normal_priority(void)
Set the maximum priority the process can obtain.
static pid_t reincarnate_child
#define SWITCH_FPROT_UWRITE
char * switch_strerror_r(int errnum, char *buf, switch_size_t buflen)
switch_filenames SWITCH_GLOBAL_filenames
void switch_core_runtime_loop(int bg)
Run endlessly until the system is shutdown.
int main(int argc, char *argv[])
char * switch_copy_string(_Out_z_cap_(dst_size) char *dst, _In_z_ const char *src, _In_ switch_size_t dst_size)
#define SWITCH_FPROT_UREAD
switch_status_t switch_file_read(switch_file_t *thefile, void *buf, switch_size_t *nbytes)
switch_directories SWITCH_GLOBAL_dirs
int32_t set_realtime_priority(void)
#define SWITCH_DEFAULT_DIR_PERMS
switch_status_t
Common return values.
const char *const const char *const path
switch_status_t switch_dir_make_recursive(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool)
struct fspr_file_t switch_file_t
#define SWITCH_FLOCK_NONBLOCK
switch_status_t switch_file_lock(switch_file_t *thefile, int type)
static int check_fd(int fd, int ms)
void switch_log_printf(_In_ switch_text_channel_t channel, _In_z_ const char *file, _In_z_ const char *func, _In_ int line, _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, _In_z_ _Printf_format_string_ const char *fmt,...) PRINTF_FUNCTION(7
Write log data to the logging engine.
struct fspr_pool_t switch_memory_pool_t
switch_status_t switch_file_open(switch_file_t **newf, const char *fname, int32_t flag, switch_fileperms_t perm, switch_memory_pool_t *pool)
int32_t switch_core_set_process_privileges(void)
Switch on the privilege awareness for the process and request required privileges.
#define SWITCH_FOPEN_CREATE
const char * switch_version_revision_human(void)
int32_t switch_core_session_ctl(switch_session_ctl_t cmd, void *val)
send a control message to the core
switch_status_t switch_file_close(switch_file_t *thefile)
#define SWITCH_FOPEN_WRITE