mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
1. Support cygwin by '--cygwin64=on' 2. Detect cygwin automatically. 3. Disalbe sanitizer, srt and srtp with openssl. 4. Disable multiple threads, use single threads. 5. Support utest for cygwin64. 6. Query features for windows by API. 7. Disable stat APIs for cygwin. 8. Use ST select event driver. Co-authored-by: wenjie.zhao <740936897@qq.com>
This commit is contained in:
parent
3d0dcb2a17
commit
d741f81110
15 changed files with 122 additions and 30 deletions
|
@ -178,6 +178,11 @@ if [[ $SRS_CROSS_BUILD == YES ]]; then
|
|||
else
|
||||
srs_undefine_macro "SRS_CROSSBUILD" $SRS_AUTO_HEADERS_H
|
||||
fi
|
||||
if [[ $SRS_CYGWIN64 == YES ]]; then
|
||||
srs_define_macro "SRS_CYGWIN64" $SRS_AUTO_HEADERS_H
|
||||
else
|
||||
srs_undefine_macro "SRS_CYGWIN64" $SRS_AUTO_HEADERS_H
|
||||
fi
|
||||
if [[ $SRS_OSX == YES ]]; then
|
||||
srs_define_macro "SRS_OSX" $SRS_AUTO_HEADERS_H
|
||||
else
|
||||
|
|
|
@ -293,7 +293,7 @@ OSX_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "OSX prepare failed, ret=$re
|
|||
#####################################################################################
|
||||
# Check OS and CPU architectures.
|
||||
#####################################################################################
|
||||
if [[ $OS_IS_UBUNTU != YES && $OS_IS_CENTOS != YES && $OS_IS_OSX != YES && $SRS_CROSS_BUILD != YES ]]; then
|
||||
if [[ $OS_IS_UBUNTU != YES && $OS_IS_CENTOS != YES && $OS_IS_OSX != YES && $SRS_CROSS_BUILD != YES && $SRS_CYGWIN64 != YES ]]; then
|
||||
echo "Your OS `uname -s` is not supported."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -347,6 +347,10 @@ fi
|
|||
if [[ $SRS_OSX == YES ]]; then
|
||||
_ST_MAKE=darwin-debug && _ST_OBJ="DARWIN_`uname -r`_DBG"
|
||||
fi
|
||||
# for windows/cygwin
|
||||
if [[ $SRS_CYGWIN64 = YES ]]; then
|
||||
_ST_MAKE=cygwin64-debug && _ST_OBJ="CYGWIN64_`uname -s`_DBG"
|
||||
fi
|
||||
# For Ubuntu, the epoll detection might be fail.
|
||||
if [[ $OS_IS_UBUNTU == YES ]]; then
|
||||
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_HAVE_EPOLL"
|
||||
|
@ -598,8 +602,16 @@ if [[ $SRS_RTC == YES ]]; then
|
|||
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit ${SRS_OBJS}/${SRS_PLATFORM}/3rdpatry/srtp2 \
|
||||
${SRS_OBJS}/srtp2 &&
|
||||
cp -rf ${SRS_WORKDIR}/3rdparty/libsrtp-2-fit ${SRS_OBJS}/${SRS_PLATFORM}/ &&
|
||||
patch -p0 ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit/crypto/math/datatypes.c ${SRS_WORKDIR}/3rdparty/patches/srtp/gcc10-01.patch &&
|
||||
patch -p0 ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit/config.guess ${SRS_WORKDIR}/3rdparty/patches/srtp/config.guess-02.patch &&
|
||||
# For cygwin64, the patch is not available, so use sed instead.
|
||||
if [[ $SRS_CYGWIN64 == YES ]]; then
|
||||
sed -i 's/char bit_string/static char bit_string/g' ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit/crypto/math/datatypes.c
|
||||
else
|
||||
patch -p0 ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit/crypto/math/datatypes.c ${SRS_WORKDIR}/3rdparty/patches/srtp/gcc10-01.patch
|
||||
fi &&
|
||||
# Patch the cpu arch guessing for RISCV.
|
||||
if [[ $OS_IS_RISCV == YES ]]; then
|
||||
patch -p0 ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit/config.guess ${SRS_WORKDIR}/3rdparty/patches/srtp/config.guess-02.patch
|
||||
fi &&
|
||||
(
|
||||
cd ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit &&
|
||||
$SRTP_CONFIGURE ${SRTP_OPTIONS} --prefix=${SRS_DEPENDS_LIBS}/${SRS_PLATFORM}/3rdpatry/srtp2
|
||||
|
@ -768,16 +780,16 @@ if [[ $SRS_SRT == YES ]]; then
|
|||
else
|
||||
LIBSRT_OPTIONS="$LIBSRT_OPTIONS --enable-shared=0"
|
||||
fi
|
||||
# For windows build, over cygwin
|
||||
if [[ $SRS_CYGWIN64 == YES ]]; then
|
||||
LIBSRT_OPTIONS="$LIBSRT_OPTIONS --cygwin-use-posix"
|
||||
fi
|
||||
# For cross-build.
|
||||
if [[ $SRS_CROSS_BUILD == YES ]]; then
|
||||
TOOL_GCC_REALPATH=$(realpath $(which $SRS_TOOL_CC))
|
||||
SRT_COMPILER_PREFIX=$(echo $TOOL_GCC_REALPATH |sed 's/-gcc.*$/-/')
|
||||
LIBSRT_OPTIONS="$LIBSRT_OPTIONS --with-compiler-prefix=$SRT_COMPILER_PREFIX"
|
||||
fi
|
||||
# For windows build, over cygwin
|
||||
if [[ $SRS_CYGWIN64 == YES ]]; then
|
||||
LIBSRT_OPTIONS="$LIBSRT_OPTIONS --cygwin-use-posix"
|
||||
fi
|
||||
|
||||
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/3rdpatry/srt/lib/libsrt.a ]]; then
|
||||
rm -rf ${SRS_OBJS}/srt && cp -rf ${SRS_OBJS}/${SRS_PLATFORM}/3rdpatry/srt ${SRS_OBJS}/ &&
|
||||
|
|
|
@ -84,6 +84,7 @@ SRS_GPROF=NO # Performance test: gprof
|
|||
################################################################
|
||||
# Preset options
|
||||
SRS_OSX= #For OSX/macOS/Darwin PC.
|
||||
SRS_CYGWIN64= # For Cygwin64 for Windows PC or servers.
|
||||
SRS_CROSS_BUILD= #For cross build, for example, on Ubuntu.
|
||||
# For cross build, the cpu, for example(FFmpeg), --cpu=24kc
|
||||
SRS_CROSS_BUILD_CPU=
|
||||
|
@ -119,6 +120,7 @@ function show_help() {
|
|||
Presets:
|
||||
--cross-build Enable cross-build, please set bellow Toolchain also. Default: $(value2switch $SRS_CROSS_BUILD)
|
||||
--osx Enable build for OSX/Darwin AppleOS. Default: $(value2switch $SRS_OSX)
|
||||
--cygwin64 Use cygwin64 to build for Windows. Default: $(value2switch $SRS_CYGWIN64)
|
||||
|
||||
Features:
|
||||
-h, --help Print this message and exit 0.
|
||||
|
@ -253,6 +255,7 @@ function parse_user_option() {
|
|||
--build-tag) SRS_BUILD_TAG=${value} ;;
|
||||
|
||||
--osx) SRS_OSX=YES ;;
|
||||
--cygwin64) SRS_CYGWIN64=YES ;;
|
||||
|
||||
--without-srtp-nasm) SRS_SRTP_ASM=NO ;;
|
||||
--with-srtp-nasm) SRS_SRTP_ASM=YES ;;
|
||||
|
@ -450,6 +453,10 @@ do
|
|||
done
|
||||
|
||||
function apply_auto_options() {
|
||||
if [[ $OS_IS_CYGWIN == YES ]]; then
|
||||
SRS_CYGWIN64=YES
|
||||
fi
|
||||
|
||||
if [[ $SRS_CROSS_BUILD == YES ]]; then
|
||||
if [[ $SRS_CROSS_BUILD_PREFIX != "" && $SRS_CROSS_BUILD_HOST == "" ]]; then
|
||||
SRS_CROSS_BUILD_HOST=$(echo $SRS_CROSS_BUILD_PREFIX| sed 's/-$//g')
|
||||
|
@ -503,6 +510,31 @@ function apply_auto_options() {
|
|||
SRS_SRTP_ASM=NO
|
||||
fi
|
||||
|
||||
# TODO: FIXME: Should build address sanitizer for cygwin64.
|
||||
# See https://github.com/ossrs/srs/issues/3252
|
||||
if [[ $SRS_CYGWIN64 == YES && $SRS_SANITIZER == YES ]]; then
|
||||
echo "Disable address sanitizer for cygwin64"
|
||||
SRS_SANITIZER=NO
|
||||
fi
|
||||
# TODO: FIXME: Should fix bug for SRT for cygwin64. Build ok, but fail in SrsSrtSocket::accept.
|
||||
# See https://github.com/ossrs/srs/issues/3251
|
||||
if [[ $SRS_CYGWIN64 == YES && $SRS_SRT == YES ]]; then
|
||||
echo "Disable SRT for cygwin64"
|
||||
SRS_SRT=NO
|
||||
fi
|
||||
# TODO: FIXME: Cygwin: ST stuck when working in multiple threads mode.
|
||||
# See https://github.com/ossrs/srs/issues/3253
|
||||
if [[ $SRS_CYGWIN64 == YES && $SRS_SINGLE_THREAD != YES ]]; then
|
||||
echo "Force single thread for cygwin64"
|
||||
SRS_SINGLE_THREAD=YES
|
||||
fi
|
||||
# TODO: FIXME: Cygwin: Build srtp with openssl fail for no srtp_aes_icm_ctx_t
|
||||
# See https://github.com/ossrs/srs/issues/3254
|
||||
if [[ $SRS_CYGWIN64 == YES && $SRS_SRTP_ASM == YES ]]; then
|
||||
echo "Disable SRTP with openssl for cygwin64"
|
||||
SRS_SRTP_ASM=NO
|
||||
fi
|
||||
|
||||
# parse the jobs for make
|
||||
if [[ ! -z SRS_JOBS ]]; then
|
||||
export SRS_JOBS="--jobs=${SRS_JOBS}"
|
||||
|
@ -589,6 +621,7 @@ function regenerate_options() {
|
|||
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --debug-stats=$(value2switch $SRS_DEBUG_STATS)"
|
||||
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cross-build=$(value2switch $SRS_CROSS_BUILD)"
|
||||
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sanitizer=$(value2switch $SRS_SANITIZER)"
|
||||
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cygwin64=$(value2switch $SRS_CYGWIN64)"
|
||||
SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --single-thread=$(value2switch $SRS_SINGLE_THREAD)"
|
||||
if [[ $SRS_CROSS_BUILD_ARCH != "" ]]; then SRS_AUTO_CONFIGURE="$SRS_AUTO_CONFIGURE --arch=$SRS_CROSS_BUILD_ARCH"; fi
|
||||
if [[ $SRS_CROSS_BUILD_CPU != "" ]]; then SRS_AUTO_CONFIGURE="$SRS_AUTO_CONFIGURE --cpu=$SRS_CROSS_BUILD_CPU"; fi
|
||||
|
|
|
@ -5,6 +5,10 @@ OS_KERNEL_NAME=$(uname -s)
|
|||
OS_KERNRL_RELEASE=$(uname -r|awk -F '-' '{print $1}')
|
||||
OS_PREFIX="Platform"
|
||||
|
||||
if [[ $OSTYPE == cygwin ]]; then
|
||||
OS_KERNRL_RELEASE=$(uname -r|awk -F '(' '{print $1}')
|
||||
fi
|
||||
|
||||
# Build platform cache.
|
||||
SRS_PLATFORM="${SRS_BUILD_TAG}${OS_PREFIX}-${OS_KERNEL_NAME}-${OS_KERNRL_RELEASE}"
|
||||
# Build platform cache with gcc version.
|
||||
|
|
|
@ -17,7 +17,13 @@ mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/utest
|
|||
# trunk of srs, which contains the src dir, relative to objs/utest, it's trunk
|
||||
SRS_TRUNK_PREFIX=../../..
|
||||
# gest dir, relative to objs/utest, it's trunk/objs/{Platform}/gtest
|
||||
GTEST_DIR=${SRS_TRUNK_PREFIX}/${SRS_OBJS}/${SRS_PLATFORM}/3rdpatry/gtest/googletest
|
||||
GTEST_DIR=../3rdpatry/gtest/googletest
|
||||
|
||||
# Whether enable C++11 or higher versions.
|
||||
# For linux, always use C++11 for gtest required, see https://github.com/google/googletest
|
||||
# For cygwin64, ignore because it use -std=gnu++11 by default.
|
||||
SRS_CPP_VERSION="-std=c++11"
|
||||
if [[ $SRS_CYGWIN64 == YES ]]; then SRS_CPP_VERSION="-std=gnu++11"; fi
|
||||
|
||||
cat << END > ${FILE}
|
||||
# user must run make the ${SRS_OBJS}/utest dir
|
||||
|
@ -51,9 +57,9 @@ CXX = ${SRS_TOOL_CXX}
|
|||
CPPFLAGS += -I\$(GTEST_DIR)/include
|
||||
|
||||
# Flags passed to the C++ compiler.
|
||||
CXXFLAGS += ${CXXFLAGS} ${UTEST_EXTRA_DEFINES} -Wno-unused-private-field -Wno-unused-command-line-argument
|
||||
# Always use C++11 for gtest required, see https://github.com/google/googletest
|
||||
CXXFLAGS += -std=c++11
|
||||
CXXFLAGS += ${CXXFLAGS} ${UTEST_EXTRA_DEFINES}
|
||||
CXXFLAGS += -Wno-unused-private-field -Wno-unused-command-line-argument
|
||||
CXXFLAGS += ${SRS_CPP_VERSION}
|
||||
|
||||
# All tests produced by this Makefile. Remember to add new tests you
|
||||
# created to the list.
|
||||
|
|
13
trunk/configure
vendored
13
trunk/configure
vendored
|
@ -93,9 +93,11 @@ WarnLevel=" -Wall"
|
|||
CppStd="-ansi"
|
||||
if [[ $SRS_CXX11 == YES ]]; then
|
||||
CppStd="-std=c++11"
|
||||
if [[ $SRS_CYGWIN64 == YES ]]; then CppStd="-std=gnu++11"; fi
|
||||
fi
|
||||
if [[ $SRS_CXX14 == YES ]]; then
|
||||
CppStd="-std=c++14"
|
||||
if [[ $SRS_CYGWIN64 == YES ]]; then CppStd="-std=gnu++14"; fi
|
||||
fi
|
||||
# performance of gprof
|
||||
SrsGprof=""; SrsGprofLink=""; if [[ $SRS_GPROF == YES ]]; then SrsGprof=" -pg -lc_p"; SrsGprofLink=" -pg"; fi
|
||||
|
@ -204,7 +206,7 @@ if [[ $SRS_GCOV == YES ]]; then
|
|||
fi
|
||||
|
||||
# For FFMPEG/RTC on Linux.
|
||||
if [[ $SRS_OSX != YES && $SRS_RTC == YES && $SRS_FFMPEG_FIT == YES ]]; then
|
||||
if [[ $SRS_OSX != YES && $SRS_CYGWIN64 != YES && $SRS_RTC == YES && $SRS_FFMPEG_FIT == YES ]]; then
|
||||
SrsLinkOptions="${SrsLinkOptions} -lrt";
|
||||
fi
|
||||
|
||||
|
@ -222,6 +224,11 @@ if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# For FFMPEG/RTC on windows.
|
||||
if [[ $SRS_CYGWIN64 == YES && $SRS_FFMPEG_FIT == YES ]]; then
|
||||
SrsLinkOptions="${SrsLinkOptions} -lbcrypt";
|
||||
fi
|
||||
|
||||
#####################################################################################
|
||||
# Modules, compile each module, then link to binary
|
||||
#
|
||||
|
@ -555,8 +562,8 @@ clean_st:
|
|||
|
||||
st:
|
||||
@rm -f ${SRS_OBJS}/srs srs_utest
|
||||
@\$(MAKE)\$(JOBS) -C ${SRS_OBJS}/${SRS_PLATFORM}/st-srs clean)
|
||||
@env EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" \$(MAKE)\$(JOBS) -C ${SRS_OBJS}/${SRS_PLATFORM}/st-srs ${_ST_MAKE_ARGS} CC=\$(GCC) AR=\$(AR) LD=\$(LINK) RANDLIB=\$(RANDLIB))
|
||||
@\$(MAKE)\$(JOBS) -C ${SRS_OBJS}/${SRS_PLATFORM}/st-srs clean
|
||||
@env EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" \$(MAKE)\$(JOBS) -C ${SRS_OBJS}/${SRS_PLATFORM}/st-srs ${_ST_MAKE_ARGS} CC=\$(GCC) AR=\$(AR) LD=\$(LINK) RANDLIB=\$(RANDLIB)
|
||||
@echo "Please rebuild srs by: make"
|
||||
|
||||
ffmpeg:
|
||||
|
|
|
@ -41,6 +41,8 @@ void srs_build_features(stringstream& ss)
|
|||
{
|
||||
if (SRS_OSX_BOOL) {
|
||||
ss << "&os=mac";
|
||||
} else if (SRS_CYGWIN64_BOOL) {
|
||||
ss << "&os=windows";
|
||||
} else {
|
||||
ss << "&os=linux";
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <algorithm>
|
||||
#ifndef SRS_OSX
|
||||
#if !defined(SRS_OSX) && !defined(SRS_CYGWIN64)
|
||||
#include <sys/inotify.h>
|
||||
#endif
|
||||
using namespace std;
|
||||
|
@ -191,7 +191,7 @@ srs_error_t SrsInotifyWorker::start()
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
#ifndef SRS_OSX
|
||||
#if !defined(SRS_OSX) && !defined(SRS_CYGWIN64)
|
||||
// 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()) {
|
||||
|
@ -271,7 +271,7 @@ srs_error_t SrsInotifyWorker::cycle()
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
#ifndef SRS_OSX
|
||||
#if !defined(SRS_OSX) && !defined(SRS_CYGWIN64)
|
||||
string config_path = _srs_config->config();
|
||||
string config_file = srs_path_basename(config_path);
|
||||
string k8s_file = "..data";
|
||||
|
|
|
@ -36,7 +36,7 @@ using namespace std;
|
|||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef SRS_OSX
|
||||
#if defined(SRS_OSX) || defined(SRS_CYGWIN64)
|
||||
pid_t gettid() {
|
||||
return 0;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ using namespace std;
|
|||
|
||||
// These functions first appeared in glibc in version 2.12.
|
||||
// See https://man7.org/linux/man-pages/man3/pthread_setname_np.3.html
|
||||
#if defined(SRS_CROSSBUILD) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12))
|
||||
#if defined(SRS_CYGWIN64) || (defined(SRS_CROSSBUILD) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12)))
|
||||
void pthread_setname_np(pthread_t trd, const char* name) {
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -330,7 +330,7 @@ SrsProcSystemStat* srs_get_system_proc_stat()
|
|||
|
||||
bool get_proc_system_stat(SrsProcSystemStat& r)
|
||||
{
|
||||
#ifndef SRS_OSX
|
||||
#if !defined(SRS_OSX)
|
||||
FILE* f = fopen("/proc/stat", "r");
|
||||
if (f == NULL) {
|
||||
srs_warn("open system cpu stat failed, ignore");
|
||||
|
@ -369,7 +369,7 @@ bool get_proc_system_stat(SrsProcSystemStat& r)
|
|||
|
||||
bool get_proc_self_stat(SrsProcSelfStat& r)
|
||||
{
|
||||
#ifndef SRS_OSX
|
||||
#if !defined(SRS_OSX)
|
||||
FILE* f = fopen("/proc/self/stat", "r");
|
||||
if (f == NULL) {
|
||||
srs_warn("open self cpu stat failed, ignore");
|
||||
|
@ -493,7 +493,7 @@ SrsDiskStat* srs_get_disk_stat()
|
|||
|
||||
bool srs_get_disk_vmstat_stat(SrsDiskStat& r)
|
||||
{
|
||||
#ifndef SRS_OSX
|
||||
#if !defined(SRS_OSX) && !defined(SRS_CYGWIN64)
|
||||
FILE* f = fopen("/proc/vmstat", "r");
|
||||
if (f == NULL) {
|
||||
srs_warn("open vmstat failed, ignore");
|
||||
|
@ -525,7 +525,7 @@ bool srs_get_disk_diskstats_stat(SrsDiskStat& r)
|
|||
r.ok = true;
|
||||
r.sample_time = srsu2ms(srs_update_system_time());
|
||||
|
||||
#ifndef SRS_OSX
|
||||
#if !defined(SRS_OSX)
|
||||
// if disabled, ignore all devices.
|
||||
SrsConfDirective* conf = _srs_config->get_stats_disk_device();
|
||||
if (conf == NULL) {
|
||||
|
@ -689,7 +689,7 @@ void srs_update_meminfo()
|
|||
{
|
||||
SrsMemInfo& r = _srs_system_meminfo;
|
||||
|
||||
#ifndef SRS_OSX
|
||||
#if !defined(SRS_OSX)
|
||||
FILE* f = fopen("/proc/meminfo", "r");
|
||||
if (f == NULL) {
|
||||
srs_warn("open meminfo failed, ignore");
|
||||
|
@ -783,7 +783,7 @@ void srs_update_platform_info()
|
|||
|
||||
r.srs_startup_time = srsu2ms(srs_get_system_startup_time());
|
||||
|
||||
#ifndef SRS_OSX
|
||||
#if !defined(SRS_OSX)
|
||||
if (true) {
|
||||
FILE* f = fopen("/proc/uptime", "r");
|
||||
if (f == NULL) {
|
||||
|
@ -877,7 +877,7 @@ static SrsSnmpUdpStat _srs_snmp_udp_stat;
|
|||
|
||||
bool get_udp_snmp_statistic(SrsSnmpUdpStat& r)
|
||||
{
|
||||
#ifndef SRS_OSX
|
||||
#if !defined(SRS_OSX) && !defined(SRS_CYGWIN64)
|
||||
if (true) {
|
||||
FILE* f = fopen("/proc/net/snmp", "r");
|
||||
if (f == NULL) {
|
||||
|
@ -983,7 +983,7 @@ int srs_get_network_devices_count()
|
|||
|
||||
void srs_update_network_devices()
|
||||
{
|
||||
#ifndef SRS_OSX
|
||||
#if !defined(SRS_OSX) && !defined(SRS_CYGWIN64)
|
||||
if (true) {
|
||||
FILE* f = fopen("/proc/net/dev", "r");
|
||||
if (f == NULL) {
|
||||
|
@ -1071,7 +1071,7 @@ void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps)
|
|||
int nb_tcp_mem = 0;
|
||||
int nb_udp4 = 0;
|
||||
|
||||
#ifndef SRS_OSX
|
||||
#if !defined(SRS_OSX) && !defined(SRS_CYGWIN64)
|
||||
if (true) {
|
||||
FILE* f = fopen("/proc/net/sockstat", "r");
|
||||
if (f == NULL) {
|
||||
|
@ -1119,7 +1119,7 @@ void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps)
|
|||
|
||||
int nb_tcp_estab = 0;
|
||||
|
||||
#ifndef SRS_OSX
|
||||
#if !defined(SRS_OSX) && !defined(SRS_CYGWIN64)
|
||||
if (true) {
|
||||
FILE* f = fopen("/proc/net/snmp", "r");
|
||||
if (f == NULL) {
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
#include <srs_app_uuid.hpp>
|
||||
|
||||
#if defined(SRS_CYGWIN64)
|
||||
#define HAVE_LOFF_T
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/file.h>
|
||||
|
@ -1082,7 +1086,9 @@ void uuid_generate(uuid_t out)
|
|||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#if defined(__linux__) && defined(HAVE_SYS_SYSCALL_H)
|
||||
#include <sys/syscall.h>
|
||||
#endif
|
||||
|
||||
//#include "randutils.h"
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
XX(ERROR_APM_ENDPOINT , 1088, "ApmEndpoint", "APM endpoint is invalid") \
|
||||
XX(ERROR_APM_AUTH , 1089, "ApmAuth", "APM team or token is invalid") \
|
||||
XX(ERROR_EXPORTER_DISABLED , 1090, "ExporterDisable", "Prometheus exporter is disabled") \
|
||||
XX(ERROR_ST_SET_SELECT , 1091, "StSetSelect", "ST set select failed") \
|
||||
|
||||
/**************************************************/
|
||||
/* RTMP protocol error. */
|
||||
|
|
|
@ -48,9 +48,15 @@ srs_error_t srs_st_init()
|
|||
|
||||
// Select the best event system available on the OS. In Linux this is
|
||||
// epoll(). On BSD it will be kqueue.
|
||||
#if defined(SRS_CYGWIN64)
|
||||
if (st_set_eventsys(ST_EVENTSYS_SELECT) == -1) {
|
||||
return srs_error_new(ERROR_ST_SET_SELECT, "st enable st failed, current is %s", st_get_eventsys_name());
|
||||
}
|
||||
#else
|
||||
if (st_set_eventsys(ST_EVENTSYS_ALT) == -1) {
|
||||
return srs_error_new(ERROR_ST_SET_EPOLL, "st enable st failed, current is %s", st_get_eventsys_name());
|
||||
}
|
||||
#endif
|
||||
|
||||
// Before ST init, we might have already initialized the background cid.
|
||||
SrsContextId cid = _srs_context->get_id();
|
||||
|
|
|
@ -5751,6 +5751,11 @@ VOID TEST(KernelUtilityTest, CoverCheckIPAddrValid)
|
|||
ASSERT_TRUE(srs_check_ip_addr_valid("::"));
|
||||
|
||||
ASSERT_FALSE(srs_check_ip_addr_valid("256.256.256.256"));
|
||||
#ifdef SRS_CYGWIN64
|
||||
// TODO: Might be a bug for cygwin64.
|
||||
ASSERT_TRUE(srs_check_ip_addr_valid("2001:0db8:85a3:0:0:8A2E:0370:7334:"));
|
||||
#else
|
||||
ASSERT_FALSE(srs_check_ip_addr_valid("2001:0db8:85a3:0:0:8A2E:0370:7334:"));
|
||||
#endif
|
||||
ASSERT_FALSE(srs_check_ip_addr_valid("1e1.4.5.6"));
|
||||
}
|
|
@ -870,7 +870,12 @@ VOID TEST(TCPServerTest, TCPListen)
|
|||
|
||||
srs_close_stfd(pfd);
|
||||
srs_close_stfd(pfd2);
|
||||
#ifdef SRS_CYGWIN64
|
||||
// Should failed because cygwin does not support REUSE_PORT.
|
||||
HELPER_EXPECT_FAILED(err2);
|
||||
#else
|
||||
HELPER_EXPECT_SUCCESS(err2);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Typical listen.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue