Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
1a4b6d54
提交
1a4b6d54
authored
4月 08, 2010
作者:
Moises Silva
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix freetdm win compilation
上级
48ec0c28
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
98 行增加
和
55 行删除
+98
-55
freetdm.2008.vcproj
libs/freetdm/msvc/freetdm.2008.vcproj
+32
-28
ftdm_cpu_monitor.c
libs/freetdm/src/ftdm_cpu_monitor.c
+13
-10
ftdm_io.c
libs/freetdm/src/ftdm_io.c
+10
-4
ftdm_threadmutex.c
libs/freetdm/src/ftdm_threadmutex.c
+39
-6
ftmod_wanpipe.c
libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c
+4
-7
没有找到文件。
libs/freetdm/msvc/freetdm.2008.vcproj
浏览文件 @
1a4b6d54
...
...
@@ -327,63 +327,63 @@
UniqueIdentifier=
"{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=
"..\src\include\f
sk
.h"
RelativePath=
"..\src\include\f
reetdm
.h"
>
</File>
<File
RelativePath=
"..\src\include\
g711
.h"
RelativePath=
"..\src\include\
fsk
.h"
>
</File>
<File
RelativePath=
"..\src\include\
hashtable
.h"
RelativePath=
"..\src\include\
ftdm_buffer
.h"
>
</File>
<File
RelativePath=
"..\src\include\
hashtable_itr
.h"
RelativePath=
"..\src\include\
ftdm_config
.h"
>
</File>
<File
RelativePath=
"..\src\include\
hashtable_private
.h"
RelativePath=
"..\src\include\
ftdm_dso
.h"
>
</File>
<File
RelativePath=
"..\src\include\
libteletone
.h"
RelativePath=
"..\src\include\
ftdm_threadmutex
.h"
>
</File>
<File
RelativePath=
"..\src\include\
libteletone_detect
.h"
RelativePath=
"..\src\include\
ftdm_types
.h"
>
</File>
<File
RelativePath=
"..\src\include\
libteletone_generate
.h"
RelativePath=
"..\src\include\
g711
.h"
>
</File>
<File
RelativePath=
"..\src\include\
freetdm
.h"
RelativePath=
"..\src\include\
hashtable
.h"
>
</File>
<File
RelativePath=
"..\src\include\
uart
.h"
RelativePath=
"..\src\include\
hashtable_itr
.h"
>
</File>
<File
RelativePath=
"..\src\include\
ftdm_buffer
.h"
RelativePath=
"..\src\include\
hashtable_private
.h"
>
</File>
<File
RelativePath=
"..\src\include\
ftdm_config
.h"
RelativePath=
"..\src\include\
libteletone
.h"
>
</File>
<File
RelativePath=
"..\src\include\
ftdm_dso
.h"
RelativePath=
"..\src\include\
libteletone_detect
.h"
>
</File>
<File
RelativePath=
"..\src\include\
ftdm_threadmutex
.h"
RelativePath=
"..\src\include\
libteletone_generate
.h"
>
</File>
<File
RelativePath=
"..\src\include\
ftdm_types
.h"
RelativePath=
"..\src\include\
uart
.h"
>
</File>
</Filter>
...
...
@@ -397,55 +397,59 @@
>
</File>
<File
RelativePath=
"..\src\
g711
.c"
RelativePath=
"..\src\
ftdm_buffer
.c"
>
</File>
<File
RelativePath=
"..\src\
hashtable
.c"
RelativePath=
"..\src\
ftdm_callerid
.c"
>
</File>
<File
RelativePath=
"..\src\
hashtable_itr
.c"
RelativePath=
"..\src\
ftdm_config
.c"
>
</File>
<File
RelativePath=
"..\src\
libteletone_detect
.c"
RelativePath=
"..\src\
ftdm_cpu_monitor
.c"
>
</File>
<File
RelativePath=
"..\src\
libteletone_generate
.c"
RelativePath=
"..\src\
ftdm_dso
.c"
>
</File>
<File
RelativePath=
"..\src\
uart
.c"
RelativePath=
"..\src\
ftdm_io
.c"
>
</File>
<File
RelativePath=
"..\src\ftdm_
buffer
.c"
RelativePath=
"..\src\ftdm_
queue
.c"
>
</File>
<File
RelativePath=
"..\src\ftdm_
callerid
.c"
RelativePath=
"..\src\ftdm_
threadmutex
.c"
>
</File>
<File
RelativePath=
"..\src\
ftdm_config
.c"
RelativePath=
"..\src\
g711
.c"
>
</File>
<File
RelativePath=
"..\src\
ftdm_dso
.c"
RelativePath=
"..\src\
hashtable
.c"
>
</File>
<File
RelativePath=
"..\src\
ftdm_io
.c"
RelativePath=
"..\src\
hashtable_itr
.c"
>
</File>
<File
RelativePath=
"..\src\
ftdm_queue
.c"
RelativePath=
"..\src\
libteletone_detect
.c"
>
</File>
<File
RelativePath=
"..\src\ftdm_threadmutex.c"
RelativePath=
"..\src\libteletone_generate.c"
>
</File>
<File
RelativePath=
"..\src\uart.c"
>
</File>
</Filter>
...
...
libs/freetdm/src/ftdm_cpu_monitor.c
浏览文件 @
1a4b6d54
...
...
@@ -201,28 +201,31 @@ FT_DECLARE(ftdm_status_t) ftdm_cpu_get_system_idle_time (struct ftdm_cpu_monitor
return
FTDM_SUCCESS
;
}
#elif defined (
WIN32) || defined (WIN64
)
#elif defined (
__WINDOWS__
)
FT_DECLARE
(
ftdm_status_t
)
ftdm_cpu_get_system_idle_time
(
struct
ftdm_cpu_monitor_stats
*
p
,
double
*
idle_percentage
)
{
FILETIME
idleTime
;
FILETIME
kernelTime
;
FILETIME
userTime
;
int64_t
i64UserTime
;
int64_t
i64KernelTime
;
int64_t
i64IdleTime
;
if
(
!
::
GetSystemTimes
(
&
idleTime
,
&
kernelTime
,
&
userTime
))
{
return
false
;
if
(
!
GetSystemTimes
(
&
idleTime
,
&
kernelTime
,
&
userTime
))
{
return
FTDM_FAIL
;
}
__int64
i64UserTime
=
(
__int64
)
userTime
.
dwLowDateTime
|
((
__int64
)
userTime
.
dwHighDateTime
<<
32
);
i64UserTime
=
(
int64_t
)
userTime
.
dwLowDateTime
|
((
int64_t
)
userTime
.
dwHighDateTime
<<
32
);
__int64
i64KernelTime
=
(
__int64
)
kernelTime
.
dwLowDateTime
|
((
__int64
)
kernelTime
.
dwHighDateTime
<<
32
);
i64KernelTime
=
(
int64_t
)
kernelTime
.
dwLowDateTime
|
((
int64_t
)
kernelTime
.
dwHighDateTime
<<
32
);
__int64
i64IdleTime
=
(
__int64
)
idleTime
.
dwLowDateTime
|
((
__int64
)
idleTime
.
dwHighDateTime
<<
32
);
i64IdleTime
=
(
int64_t
)
idleTime
.
dwLowDateTime
|
((
int64_t
)
idleTime
.
dwHighDateTime
<<
32
);
if
(
p
->
valid_last_times
)
{
__int64
i64User
=
i64UserTime
-
p
->
i64LastUserTime
;
__int64
i64Kernel
=
i64KernelTime
-
p
->
i64LastKernelTime
;
__int64
i64Idle
=
i64IdleTime
-
p
->
i64LastIdleTime
;
__int64
i64System
=
i64User
+
i64Kernel
;
int64_t
i64User
=
i64UserTime
-
p
->
i64LastUserTime
;
int64_t
i64Kernel
=
i64KernelTime
-
p
->
i64LastKernelTime
;
int64_t
i64Idle
=
i64IdleTime
-
p
->
i64LastIdleTime
;
int64_t
i64System
=
i64User
+
i64Kernel
;
*
idle_percentage
=
100
.
0
*
i64Idle
/
i64System
;
}
else
{
*
idle_percentage
=
100
.
0
;
...
...
libs/freetdm/src/ftdm_io.c
浏览文件 @
1a4b6d54
...
...
@@ -2855,6 +2855,7 @@ static ftdm_status_t load_config(void)
ftdm_config_t
cfg
;
char
*
var
,
*
val
;
int
catno
=
-
1
;
int
intparam
=
0
;
int
currindex
=
0
;
ftdm_span_t
*
span
=
NULL
;
unsigned
configured
=
0
,
d
=
0
;
...
...
@@ -3059,14 +3060,16 @@ static ftdm_status_t load_config(void)
ftdm_log
(
FTDM_LOG_ERROR
,
"Invalid cpu monitoring interval %s
\n
"
,
val
);
}
}
else
if
(
!
strncasecmp
(
var
,
"cpu_set_alarm_threshold"
,
sizeof
(
"cpu_set_alarm_threshold"
)
-
1
))
{
if
(
atoi
(
val
)
>
0
&&
atoi
(
val
)
<
100
)
{
globals
.
cpu_monitor
.
set_alarm_threshold
=
atoi
(
val
);
intparam
=
atoi
(
val
);
if
(
intparam
>
0
&&
intparam
<
100
)
{
globals
.
cpu_monitor
.
set_alarm_threshold
=
(
uint8_t
)
intparam
;
}
else
{
ftdm_log
(
FTDM_LOG_ERROR
,
"Invalid cpu alarm set threshold %s
\n
"
,
val
);
}
}
else
if
(
!
strncasecmp
(
var
,
"cpu_reset_alarm_threshold"
,
sizeof
(
"cpu_reset_alarm_threshold"
)
-
1
))
{
if
(
atoi
(
val
)
>
0
&&
atoi
(
val
)
<
100
)
{
globals
.
cpu_monitor
.
reset_alarm_threshold
=
atoi
(
val
);
intparam
=
atoi
(
val
);
if
(
intparam
>
0
&&
intparam
<
100
)
{
globals
.
cpu_monitor
.
reset_alarm_threshold
=
(
uint8_t
)
intparam
;
if
(
globals
.
cpu_monitor
.
reset_alarm_threshold
>
globals
.
cpu_monitor
.
set_alarm_threshold
)
{
globals
.
cpu_monitor
.
reset_alarm_threshold
=
globals
.
cpu_monitor
.
set_alarm_threshold
-
10
;
ftdm_log
(
FTDM_LOG_ERROR
,
"Cpu alarm reset threshold must be lower than set threshold"
...
...
@@ -3652,6 +3655,9 @@ static void *ftdm_cpu_monitor_run(ftdm_thread_t *me, void *obj)
ftdm_delete_cpu_monitor
(
cpu_stats
);
monitor
->
running
=
0
;
return
NULL
;
#ifdef __WINDOWS__
UNREFERENCED_PARAMETER
(
me
);
#endif
}
static
ftdm_status_t
ftdm_cpu_monitor_start
(
void
)
...
...
libs/freetdm/src/ftdm_threadmutex.c
浏览文件 @
1a4b6d54
...
...
@@ -314,7 +314,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_wait(ftdm_interrupt_t *interrupt, int m
num
++
;
ints
[
1
]
=
interrupt
->
device
;
}
res
=
WaitForMultipleObjects
(
num
,
&
ints
,
FALSE
,
ms
>=
0
?
ms
:
INFINITE
);
res
=
WaitForMultipleObjects
(
num
,
ints
,
FALSE
,
ms
>=
0
?
ms
:
INFINITE
);
switch
(
res
)
{
case
WAIT_TIMEOUT
:
return
FTDM_TIMEOUT
;
...
...
@@ -366,7 +366,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_signal(ftdm_interrupt_t *interrupt)
{
ftdm_assert_return
(
interrupt
!=
NULL
,
FTDM_FAIL
,
"Interrupt is null!
\n
"
);
#ifdef WIN32
if
(
!
SetEvent
(
interrupt
->
interrup
t
))
{
if
(
!
SetEvent
(
interrupt
->
even
t
))
{
ftdm_log
(
FTDM_LOG_ERROR
,
"Failed to signal interrupt
\n
"
);
return
FTDM_FAIL
;
}
...
...
@@ -400,10 +400,42 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_destroy(ftdm_interrupt_t **ininterrupt)
FT_DECLARE
(
ftdm_status_t
)
ftdm_interrupt_multiple_wait
(
ftdm_interrupt_t
*
interrupts
[],
ftdm_size_t
size
,
int
ms
)
{
#ifndef WIN32
int
i
;
int
res
=
0
;
int
numdevices
=
0
;
unsigned
i
;
#if defined(__WINDOWS__)
DWORD
res
=
0
;
HANDLE
ints
[
20
];
if
(
size
>
(
ftdm_array_len
(
ints
)
/
2
))
{
/* improve if needed: dynamically allocate the list of interrupts *only* when exceeding the default size */
ftdm_log
(
FTDM_LOG_CRIT
,
"Unsupported size of interrupts: %d, implement me!
\n
"
,
size
);
return
FTDM_FAIL
;
}
for
(
i
=
0
;
i
<
size
;
i
++
)
{
ints
[
i
]
=
interrupts
[
i
]
->
event
;
if
(
interrupts
[
i
]
->
device
!=
FTDM_INVALID_SOCKET
)
{
ints
[
i
+
numdevices
]
=
interrupts
[
i
]
->
device
;
numdevices
++
;
}
}
res
=
WaitForMultipleObjects
(
size
+
numdevices
,
ints
,
FALSE
,
ms
>=
0
?
ms
:
INFINITE
);
switch
(
res
)
{
case
WAIT_TIMEOUT
:
return
FTDM_TIMEOUT
;
case
WAIT_FAILED
:
case
WAIT_ABANDONED
:
/* is it right to fail with abandoned? */
return
FTDM_FAIL
;
default
:
if
(
res
>=
(
size
+
numdevices
))
{
ftdm_log
(
FTDM_LOG_ERROR
,
"Error waiting for freetdm interrupt event (WaitForSingleObject returned %d)
\n
"
,
res
);
return
FTDM_FAIL
;
}
/* fall-through to FTDM_SUCCESS at the end of the function */
}
#elif defined(__linux__)
int
res
=
0
;
char
pipebuf
[
255
];
struct
pollfd
ints
[
size
*
2
];
...
...
@@ -432,6 +464,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interru
return
FTDM_TIMEOUT
;
}
/* check for events in the pipes, NOT in the devices */
for
(
i
=
0
;
i
<
size
;
i
++
)
{
if
(
ints
[
i
].
revents
&
POLLIN
)
{
res
=
read
(
ints
[
i
].
fd
,
pipebuf
,
sizeof
(
pipebuf
));
...
...
@@ -440,7 +473,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interru
}
}
}
#else
#endif
return
FTDM_SUCCESS
;
}
...
...
libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c
浏览文件 @
1a4b6d54
...
...
@@ -101,8 +101,6 @@ static struct {
FIO_SPAN_POLL_EVENT_FUNCTION
(
wanpipe_poll_event
);
FIO_SPAN_NEXT_EVENT_FUNCTION
(
wanpipe_next_event
);
#define WP_INVALID_SOCKET -1
/**
* \brief Poll for event on a wanpipe socket
* \param fd Wanpipe socket descriptor
...
...
@@ -224,7 +222,7 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start
}
for
(
x
=
start
;
x
<
end
;
x
++
)
{
ftdm_channel_t
*
chan
;
ftdm_socket_t
sockfd
=
WP
_INVALID_SOCKET
;
ftdm_socket_t
sockfd
=
FTDM
_INVALID_SOCKET
;
const
char
*
dtmf
=
"none"
;
if
(
!
strncasecmp
(
span
->
name
,
"smg_prid_nfas"
,
8
)
&&
span
->
trunk_type
==
FTDM_TRUNK_T1
&&
x
==
24
)
{
#ifdef LIBSANGOMA_VERSION
...
...
@@ -236,7 +234,7 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start
sockfd
=
tdmv_api_open_span_chan
(
spanno
,
x
);
}
if
(
sockfd
==
WP
_INVALID_SOCKET
)
{
if
(
sockfd
==
FTDM
_INVALID_SOCKET
)
{
ftdm_log
(
FTDM_LOG_ERROR
,
"Failed to open wanpipe device span %d channel %d
\n
"
,
spanno
,
x
);
continue
;
}
...
...
@@ -1166,9 +1164,8 @@ static FIO_CHANNEL_DESTROY_FUNCTION(wanpipe_channel_destroy)
}
#endif
if
(
ftdmchan
->
sockfd
>
-
1
)
{
close
(
ftdmchan
->
sockfd
);
ftdmchan
->
sockfd
=
WP_INVALID_SOCKET
;
if
(
ftdmchan
->
sockfd
!=
FTDM_INVALID_SOCKET
)
{
sangoma_close
(
&
ftdmchan
->
sockfd
);
}
return
FTDM_SUCCESS
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论