+90
-41
lines changedFilter options
+90
-41
lines changed Original file line number Diff line number Diff line change
@@ -40,8 +40,9 @@ set_if(BSD ${SYSNAME_LC} MATCHES "bsd$")
40
40
set_if(MICROSOFT WIN32 AND (NOT MINGW AND NOT CYGWIN))
41
41
set_if(GNU ${CMAKE_SYSTEM_NAME} MATCHES "GNU")
42
42
set_if(ANDROID ${SYSNAME_LC} MATCHES "android")
43
-
set_if(POSIX LINUX OR DARWIN OR BSD OR ANDROID OR (CYGWIN AND CYGWIN_USE_POSIX))
44
-
set_if(SYMLINKABLE LINUX OR DARWIN OR BSD OR CYGWIN OR GNU)
43
+
set_if(SUNOS "${SYSNAME_LC}" MATCHES "sunos")
44
+
set_if(POSIX LINUX OR DARWIN OR BSD OR SUNOS OR ANDROID OR (CYGWIN AND CYGWIN_USE_POSIX))
45
+
set_if(SYMLINKABLE LINUX OR DARWIN OR BSD OR SUNOS OR CYGWIN OR GNU)
45
46
46
47
# Not sure what to do in case of compiling by MSVC.
47
48
# This will make installdir in C:\Program Files\SRT then
@@ -282,8 +283,9 @@ if (DEFINED HAVE_INET_PTON)
282
283
add_definitions(-DHAVE_INET_PTON=1)
283
284
endif()
284
285
286
+
# Defines HAVE_PTHREAD_GETNAME_* and HAVE_PTHREAD_SETNAME_*
285
287
include(FindPThreadGetSetName)
286
-
FindPThreadGetSetName() # Defines HAVE_PTHREAD_GETNAME_* and HAVE_PTHREAD_SETNAME_*
288
+
FindPThreadGetSetName()
287
289
288
290
if (ENABLE_MONOTONIC_CLOCK)
289
291
if (NOT ENABLE_MONOTONIC_CLOCK_DEFAULT)
@@ -617,6 +619,9 @@ elseif(CYGWIN)
617
619
elseif(GNU)
618
620
add_definitions(-DGNU=1)
619
621
message(STATUS "DETECTED SYSTEM: GNU; GNU=1" )
622
+
elseif(SUNOS)
623
+
add_definitions(-DSUNOS=1)
624
+
message(STATUS "DETECTED SYSTEM: SunOS|Solaris; SUNOS=1" )
620
625
else()
621
626
message(FATAL_ERROR "Unsupported system: ${CMAKE_SYSTEM_NAME}")
622
627
endif()
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ class Medium
94
94
bool m_eof = false;
95
95
bool m_broken = false;
96
96
97
-
mutex access; // For closing
97
+
std::mutex access; // For closing
98
98
99
99
template <class DerivedMedium, class SocketType>
100
100
static Medium* CreateAcceptor(DerivedMedium* self, const sockaddr_any& sa, SocketType sock, size_t chunk)
@@ -287,7 +287,7 @@ class Tunnel
287
287
std::unique_ptr<Medium> med_acp, med_clr;
288
288
Engine acp_to_clr, clr_to_acp;
289
289
volatile bool running = true;
290
-
mutex access;
290
+
std::mutex access;
291
291
292
292
public:
293
293
@@ -324,7 +324,7 @@ class Tunnel
324
324
325
325
/*
326
326
{
327
-
lock_guard<mutex> lk(access);
327
+
lock_guard<std::mutex> lk(access);
328
328
if (acp_to_clr.stat() == -1 && clr_to_acp.stat() == -1)
329
329
{
330
330
Verb() << "Tunnel: Both engine decommissioned, will stop the tunnel.";
@@ -438,7 +438,7 @@ class SrtMedium: public Medium
438
438
void CloseSrt()
439
439
{
440
440
Verb() << "Closing SRT socket for " << uri();
441
-
lock_guard<mutex> lk(access);
441
+
lock_guard<std::mutex> lk(access);
442
442
if (m_socket == SRT_ERROR)
443
443
return;
444
444
srt_close(m_socket);
@@ -528,7 +528,7 @@ class TcpMedium: public Medium
528
528
void CloseTcp()
529
529
{
530
530
Verb() << "Closing TCP socket for " << uri();
531
-
lock_guard<mutex> lk(access);
531
+
lock_guard<std::mutex> lk(access);
532
532
if (m_socket == -1)
533
533
return;
534
534
tcp_close(m_socket);
@@ -954,20 +954,20 @@ std::unique_ptr<Medium> Medium::Create(const std::string& url, size_t chunk, Med
954
954
struct Tunnelbox
955
955
{
956
956
list<unique_ptr<Tunnel>> tunnels;
957
-
mutex access;
957
+
std::mutex access;
958
958
condition_variable decom_ready;
959
959
bool main_running = true;
960
960
thread thr;
961
961
962
962
void signal_decommission()
963
963
{
964
-
lock_guard<mutex> lk(access);
964
+
lock_guard<std::mutex> lk(access);
965
965
decom_ready.notify_one();
966
966
}
967
967
968
968
void install(std::unique_ptr<Medium>&& acp, std::unique_ptr<Medium>&& clr)
969
969
{
970
-
lock_guard<mutex> lk(access);
970
+
lock_guard<std::mutex> lk(access);
971
971
Verb() << "Tunnelbox: Starting tunnel: " << acp->uri() << " <-> " << clr->uri();
972
972
973
973
tunnels.emplace_back(new Tunnel(this, move(acp), move(clr)));
@@ -992,7 +992,7 @@ struct Tunnelbox
992
992
993
993
void CleanupWorker()
994
994
{
995
-
unique_lock<mutex> lk(access);
995
+
unique_lock<std::mutex> lk(access);
996
996
997
997
while (main_running)
998
998
{
@@ -1027,7 +1027,7 @@ void Tunnel::Stop()
1027
1027
if (!running)
1028
1028
return; // already stopped
1029
1029
1030
-
lock_guard<mutex> lk(access);
1030
+
lock_guard<std::mutex> lk(access);
1031
1031
1032
1032
// Ok, you are the first to make the tunnel
1033
1033
// not running and inform the tunnelbox.
@@ -1037,7 +1037,7 @@ void Tunnel::Stop()
1037
1037
1038
1038
bool Tunnel::decommission_if_dead(bool forced)
1039
1039
{
1040
-
lock_guard<mutex> lk(access);
1040
+
lock_guard<std::mutex> lk(access);
1041
1041
if (running && !forced)
1042
1042
return false; // working, not to be decommissioned
1043
1043
Original file line number Diff line number Diff line change
@@ -22,9 +22,12 @@
22
22
#if !defined(_WIN32)
23
23
#include <sys/ioctl.h>
24
24
#else
25
-
#include <fcntl.h>
25
+
#include <fcntl.h>
26
26
#include <io.h>
27
27
#endif
28
+
#if defined(SUNOS)
29
+
#include <sys/filio.h>
30
+
#endif
28
31
29
32
#include "netinet_any.h"
30
33
#include "apputil.hpp"
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ const char* CUDTException::getErrorMessage() const ATR_NOTHROW
98
98
return srt::strerror_get_message(m_iMajor, m_iMinor);
99
99
}
100
100
101
-
string CUDTException::getErrorString() const
101
+
std::string CUDTException::getErrorString() const
102
102
{
103
103
return getErrorMessage();
104
104
}
Original file line number Diff line number Diff line change
@@ -149,7 +149,8 @@ ENOMEM: There was insufficient memory to create the kernel object.
149
149
if (localid < 0)
150
150
throw CUDTException(MJ_SETUP, MN_NONE, errno);
151
151
#else
152
-
// on Solaris, use /dev/poll
152
+
// TODO: Solaris, use port_getn()
153
+
// https://docs.oracle.com/cd/E86824_01/html/E54766/port-get-3c.html
153
154
// on Windows, select
154
155
#endif
155
156
Original file line number Diff line number Diff line change
@@ -100,13 +100,13 @@ void CSndLossList::traceState() const
100
100
int pos = m_iHead;
101
101
while (pos != SRT_SEQNO_NONE)
102
102
{
103
-
::cout << pos << ":[" << m_caSeq[pos].seqstart;
103
+
std::cout << pos << ":[" << m_caSeq[pos].seqstart;
104
104
if (m_caSeq[pos].seqend != SRT_SEQNO_NONE)
105
-
::cout << ", " << m_caSeq[pos].seqend;
106
-
::cout << "], ";
105
+
std::cout << ", " << m_caSeq[pos].seqend;
106
+
std::cout << "], ";
107
107
pos = m_caSeq[pos].inext;
108
108
}
109
-
::cout << "\n";
109
+
std::cout << "\n";
110
110
}
111
111
112
112
int CSndLossList::insert(int32_t seqno1, int32_t seqno2)
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ written by
23
23
#include <string.h>
24
24
#include <stdio.h>
25
25
#include <errno.h>
26
-
#if defined(__unix__) && !defined(BSD)
26
+
#if defined(__unix__) && !defined(BSD) && !defined(SUNOS)
27
27
#include <features.h>
28
28
#endif
29
29
Original file line number Diff line number Diff line change
@@ -60,7 +60,6 @@ namespace srt
60
60
{
61
61
namespace sync
62
62
{
63
-
using namespace std;
64
63
65
64
///////////////////////////////////////////////////////////////////////////////
66
65
//
@@ -71,7 +70,7 @@ using namespace std;
71
70
#if ENABLE_STDCXX_SYNC
72
71
73
72
template <class Clock>
74
-
using Duration = chrono::duration<Clock>;
73
+
using Duration = std::chrono::duration<Clock>;
75
74
76
75
#else
77
76
@@ -130,13 +129,13 @@ class Duration
130
129
131
130
#if ENABLE_STDCXX_SYNC
132
131
133
-
using steady_clock = chrono::steady_clock;
132
+
using steady_clock = std::chrono::steady_clock;
134
133
135
134
template <class Clock, class Duration = typename Clock::duration>
136
-
using time_point = chrono::time_point<Clock, Duration>;
135
+
using time_point = std::chrono::time_point<Clock, Duration>;
137
136
138
137
template <class Clock>
139
-
using TimePoint = chrono::time_point<Clock>;
138
+
using TimePoint = std::chrono::time_point<Clock>;
140
139
141
140
template <class Clock, class Duration = typename Clock::duration>
142
141
inline bool is_zero(const time_point<Clock, Duration> &tp)
@@ -212,8 +211,8 @@ class TimePoint
212
211
inline void operator-=(const Duration<Clock>& rhs) { m_timestamp -= rhs.count(); }
213
212
214
213
public: //
215
-
static inline ATR_CONSTEXPR TimePoint min() { return TimePoint(numeric_limits<uint64_t>::min()); }
216
-
static inline ATR_CONSTEXPR TimePoint max() { return TimePoint(numeric_limits<uint64_t>::max()); }
214
+
static inline ATR_CONSTEXPR TimePoint min() { return TimePoint(std::numeric_limits<uint64_t>::min()); }
215
+
static inline ATR_CONSTEXPR TimePoint max() { return TimePoint(std::numeric_limits<uint64_t>::max()); }
217
216
218
217
public:
219
218
Duration<Clock> time_since_epoch() const;
@@ -311,9 +310,9 @@ inline bool is_zero(const TimePoint<steady_clock>& t)
311
310
///////////////////////////////////////////////////////////////////////////////
312
311
313
312
#if ENABLE_STDCXX_SYNC
314
-
using Mutex = mutex;
315
-
using UniqueLock = unique_lock<mutex>;
316
-
using ScopedLock = lock_guard<mutex>;
313
+
using Mutex = std::mutex;
314
+
using UniqueLock = std::unique_lock<std::mutex>;
315
+
using ScopedLock = std::lock_guard<std::mutex>;
317
316
#else
318
317
/// Mutex is a class wrapper, that should mimic the std::chrono::mutex class.
319
318
/// At the moment the extra function ref() is temporally added to allow calls
@@ -471,7 +470,7 @@ class Condition
471
470
472
471
private:
473
472
#if ENABLE_STDCXX_SYNC
474
-
condition_variable m_cv;
473
+
std::condition_variable m_cv;
475
474
#else
476
475
pthread_cond_t m_cv;
477
476
#endif
@@ -742,6 +741,7 @@ class CGlobEvent
742
741
#ifdef ENABLE_STDCXX_SYNC
743
742
typedef std::system_error CThreadException;
744
743
using CThread = std::thread;
744
+
namespace this_thread = std::this_thread;
745
745
#else // pthreads wrapper version
746
746
typedef ::CUDTException CThreadException;
747
747
Original file line number Diff line number Diff line change
@@ -68,12 +68,12 @@ void srt::sync::Condition::wait(UniqueLock& lock)
68
68
bool srt::sync::Condition::wait_for(UniqueLock& lock, const steady_clock::duration& rel_time)
69
69
{
70
70
// Another possible implementation is wait_until(steady_clock::now() + timeout);
71
-
return m_cv.wait_for(lock, rel_time) != cv_status::timeout;
71
+
return m_cv.wait_for(lock, rel_time) != std::cv_status::timeout;
72
72
}
73
73
74
74
bool srt::sync::Condition::wait_until(UniqueLock& lock, const steady_clock::time_point& timeout_time)
75
75
{
76
-
return m_cv.wait_until(lock, timeout_time) != cv_status::timeout;
76
+
return m_cv.wait_until(lock, timeout_time) != std::cv_status::timeout;
77
77
}
78
78
79
79
void srt::sync::Condition::notify_one()
Original file line number Diff line number Diff line change
@@ -140,6 +140,46 @@ written by
140
140
# define le64toh(x) letoh64(x)
141
141
#endif
142
142
143
+
#elif defined(SUNOS)
144
+
145
+
// SunOS/Solaris
146
+
147
+
#include <sys/byteorder.h>
148
+
#include <sys/isa_defs.h>
149
+
150
+
#define __LITTLE_ENDIAN 1234
151
+
#define __BIG_ENDIAN 4321
152
+
153
+
# if defined(_BIG_ENDIAN)
154
+
#define __BYTE_ORDER __BIG_ENDIAN
155
+
#define be64toh(x) (x)
156
+
#define be32toh(x) (x)
157
+
#define be16toh(x) (x)
158
+
#define le16toh(x) ((uint16_t)BSWAP_16(x))
159
+
#define le32toh(x) BSWAP_32(x)
160
+
#define le64toh(x) BSWAP_64(x)
161
+
#define htobe16(x) (x)
162
+
#define htole16(x) ((uint16_t)BSWAP_16(x))
163
+
#define htobe32(x) (x)
164
+
#define htole32(x) BSWAP_32(x)
165
+
#define htobe64(x) (x)
166
+
#define htole64(x) BSWAP_64(x)
167
+
# else
168
+
#define __BYTE_ORDER __LITTLE_ENDIAN
169
+
#define be64toh(x) BSWAP_64(x)
170
+
#define be32toh(x) ntohl(x)
171
+
#define be16toh(x) ntohs(x)
172
+
#define le16toh(x) (x)
173
+
#define le32toh(x) (x)
174
+
#define le64toh(x) (x)
175
+
#define htobe16(x) htons(x)
176
+
#define htole16(x) (x)
177
+
#define htobe32(x) htonl(x)
178
+
#define htole32(x) (x)
179
+
#define htobe64(x) BSWAP_64(x)
180
+
#define htole64(x) (x)
181
+
# endif
182
+
143
183
#elif defined(__WINDOWS__)
144
184
145
185
# include <winsock2.h>
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4