1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Support macOS OSX

This commit is contained in:
winlin 2020-03-28 17:20:40 +08:00
parent b3b76b0ca6
commit c339542ce0
13 changed files with 312 additions and 51 deletions

View file

@ -30,7 +30,9 @@
#include <fcntl.h>
#include <unistd.h>
#include <algorithm>
#ifndef SRS_AUTO_OSX
#include <sys/inotify.h>
#endif
using namespace std;
#include <srs_kernel_log.hpp>
@ -478,6 +480,7 @@ srs_error_t SrsInotifyWorker::start()
{
srs_error_t err = srs_success;
#ifndef SRS_AUTO_OSX
// Whether enable auto reload config.
bool auto_reload = _srs_config->inotify_auto_reload();
if (!auto_reload && _srs_in_docker && _srs_config->auto_reload_for_docker()) {
@ -548,6 +551,7 @@ srs_error_t SrsInotifyWorker::start()
if ((err = trd->start()) != srs_success) {
return srs_error_wrap(err, "inotify");
}
#endif
return err;
}
@ -556,6 +560,7 @@ srs_error_t SrsInotifyWorker::cycle()
{
srs_error_t err = srs_success;
#ifndef SRS_AUTO_OSX
string config_path = _srs_config->config();
string config_file = srs_path_basename(config_path);
string k8s_file = "..data";
@ -595,6 +600,7 @@ srs_error_t SrsInotifyWorker::cycle()
srs_usleep(3000 * SRS_UTIME_MILLISECONDS);
}
#endif
return err;
}
@ -763,7 +769,7 @@ srs_error_t SrsServer::initialize_st()
if ((err = srs_st_init()) != srs_success) {
return srs_error_wrap(err, "initialize st failed");
}
// @remark, st alloc segment use mmap, which only support 32757 threads,
// if need to support more, for instance, 100k threads, define the macro MALLOC_STACK.
// TODO: FIXME: maybe can use "sysctl vm.max_map_count" to refine.