Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
accel-ppp
提交
d32cf135
A
accel-ppp
项目概览
Achou.Wang
/
accel-ppp
通知
6
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
accel-ppp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d32cf135
编写于
10月 15, 2010
作者:
K
Kozlov Dmitry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
implemented timerfd for glibc-2.7 or earlier (debian lenny is now welcome)
上级
a7beba7a
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
138 addition
and
18 deletion
+138
-18
CMakeLists.txt
CMakeLists.txt
+1
-1
README
README
+0
-1
accel-pptpd/CMakeLists.txt
accel-pptpd/CMakeLists.txt
+13
-0
accel-pptpd/extra/sigchld.c
accel-pptpd/extra/sigchld.c
+0
-1
accel-pptpd/include/linux_ppp.h
accel-pptpd/include/linux_ppp.h
+1
-1
accel-pptpd/logs/CMakeLists.txt
accel-pptpd/logs/CMakeLists.txt
+1
-1
accel-pptpd/logs/log_file.c
accel-pptpd/logs/log_file.c
+0
-1
accel-pptpd/triton/CMakeLists.txt
accel-pptpd/triton/CMakeLists.txt
+19
-0
accel-pptpd/triton/timer.c
accel-pptpd/triton/timer.c
+24
-12
accel-pptpd/triton/timerfd.c
accel-pptpd/triton/timerfd.c
+19
-0
accel-pptpd/triton/timerfd.h
accel-pptpd/triton/timerfd.h
+60
-0
未找到文件。
CMakeLists.txt
浏览文件 @
d32cf135
PROJECT
(
accel-pptpd
)
PROJECT
(
accel-pptpd
C
)
cmake_minimum_required
(
VERSION 2.6
)
cmake_minimum_required
(
VERSION 2.6
)
ADD_SUBDIRECTORY
(
accel-pptpd
)
ADD_SUBDIRECTORY
(
accel-pptpd
)
...
...
README
浏览文件 @
d32cf135
...
@@ -30,7 +30,6 @@ Requirment
...
@@ -30,7 +30,6 @@ Requirment
----------
----------
1. modern linux distribution
1. modern linux distribution
2. kernel-2.6.25 or later
2. kernel-2.6.25 or later
3. glibc-2.8 or later
4. cmake-2.6 or later
4. cmake-2.6 or later
5. libnl-2.0 or probably later (required for l2tp and builtin shaper)
5. libnl-2.0 or probably later (required for l2tp and builtin shaper)
...
...
accel-pptpd/CMakeLists.txt
浏览文件 @
d32cf135
INCLUDE
(
CheckLibraryExists
)
INCLUDE
(
CheckIncludeFiles
)
CHECK_LIBRARY_EXISTS
(
ssl MD5_Init
""
HAVE_SSL
)
IF
(
NOT HAVE_SSL
)
MESSAGE
(
FATAL_ERROR
"openssl library not found"
)
ENDIF
(
NOT HAVE_SSL
)
CHECK_INCLUDE_FILES
(
"openssl/md5.h"
HAVE_SSL
)
IF
(
NOT HAVE_SSL
)
MESSAGE
(
FATAL_ERROR
"openssl headers not found"
)
ENDIF
(
NOT HAVE_SSL
)
SET
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wall -fvisibility=hidden -D_GNU_SOURCE -DGCC_SPINLOCK -DMEMDEBUG"
)
SET
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wall -fvisibility=hidden -D_GNU_SOURCE -DGCC_SPINLOCK -DMEMDEBUG"
)
INCLUDE_DIRECTORIES
(
include
)
INCLUDE_DIRECTORIES
(
include
)
...
...
accel-pptpd/extra/sigchld.c
浏览文件 @
d32cf135
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
#include <string.h>
#include <string.h>
#include <errno.h>
#include <errno.h>
#include <signal.h>
#include <signal.h>
#include <sys/signalfd.h>
#include <sys/wait.h>
#include <sys/wait.h>
#include "triton.h"
#include "triton.h"
...
...
accel-pptpd/include/linux_ppp.h
浏览文件 @
d32cf135
...
@@ -11,9 +11,9 @@
...
@@ -11,9 +11,9 @@
#define __aligned_u64 __u64 __attribute__((aligned(8)))
#define __aligned_u64 __u64 __attribute__((aligned(8)))
#endif
#endif
#include <linux/ppp_defs.h>
#include <linux/if.h>
#include <linux/if.h>
#include <linux/if_ppp.h>
#include <linux/if_ppp.h>
#include <linux/ppp_defs.h>
#endif
#endif
accel-pptpd/logs/CMakeLists.txt
浏览文件 @
d32cf135
ADD_LIBRARY
(
log_file SHARED log_file.c
)
ADD_LIBRARY
(
log_file SHARED log_file.c
)
TARGET_LINK_LIBRARIES
(
log_file
aio
rt
)
TARGET_LINK_LIBRARIES
(
log_file rt
)
INSTALL
(
TARGETS log_file
INSTALL
(
TARGETS log_file
LIBRARY DESTINATION usr/lib/accel-pptp
LIBRARY DESTINATION usr/lib/accel-pptp
...
...
accel-pptpd/logs/log_file.c
浏览文件 @
d32cf135
...
@@ -6,7 +6,6 @@
...
@@ -6,7 +6,6 @@
#include <unistd.h>
#include <unistd.h>
#include <limits.h>
#include <limits.h>
#include <aio.h>
#include <aio.h>
#include <sys/signalfd.h>
#include "log.h"
#include "log.h"
#include "events.h"
#include "events.h"
...
...
accel-pptpd/triton/CMakeLists.txt
浏览文件 @
d32cf135
...
@@ -9,6 +9,25 @@ SET(sources_c
...
@@ -9,6 +9,25 @@ SET(sources_c
event.c
event.c
)
)
INCLUDE
(
CheckFunctionExists
)
CHECK_FUNCTION_EXISTS
(
timerfd_create HAVE_TIMERFD
)
IF
(
HAVE_TIMERFD
)
ADD_DEFINITIONS
(
-DHAVE_TIMERFD
)
ELSE
(
HAVE_TIMERFD
)
INCLUDE
(
CheckCSourceCompiles
)
CHECK_C_SOURCE_COMPILES
(
"
#include <sys/syscall.h>
int main()
{
syscall(SYS_timerfd_create);
}"
HAVE_SYSCALL
)
IF
(
NOT HAVE_SYSCALL
)
MESSAGE
(
FATAL_ERROR
"Your system is too old and is not supported by accel-pptp, sorry..."
)
ENDIF
(
NOT HAVE_SYSCALL
)
SET
(
sources_c
${
sources_c
}
timerfd.c
)
ENDIF
(
HAVE_TIMERFD
)
INCLUDE_DIRECTORIES
(
${
CMAKE_CURRENT_SOURCE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
CMAKE_CURRENT_SOURCE_DIR
}
)
ADD_DEFINITIONS
(
-DMODULE_PATH=
"
${
CMAKE_INSTALL_PREFIX
}
/usr/lib/accel-pptp"
)
ADD_DEFINITIONS
(
-DMODULE_PATH=
"
${
CMAKE_INSTALL_PREFIX
}
/usr/lib/accel-pptp"
)
...
...
accel-pptpd/triton/timer.c
浏览文件 @
d32cf135
...
@@ -2,10 +2,16 @@
...
@@ -2,10 +2,16 @@
#include <stdlib.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/time.h>
#include <sys/epoll.h>
#include <sys/epoll.h>
#include <sys/timerfd.h>
#include <string.h>
#include <string.h>
#include <errno.h>
#include <errno.h>
#include <unistd.h>
#include <unistd.h>
#include <fcntl.h>
#ifdef HAVE_TIMERFD
#include <sys/timerfd.h>
#else
#include "timerfd.h"
#endif
#include "triton_p.h"
#include "triton_p.h"
...
@@ -94,6 +100,7 @@ void *timer_thread(void *arg)
...
@@ -94,6 +100,7 @@ void *timer_thread(void *arg)
return
NULL
;
return
NULL
;
}
}
int
__export
triton_timer_add
(
struct
triton_context_t
*
ctx
,
struct
triton_timer_t
*
ud
,
int
abs_time
)
int
__export
triton_timer_add
(
struct
triton_context_t
*
ctx
,
struct
triton_timer_t
*
ud
,
int
abs_time
)
{
{
struct
_triton_timer_t
*
t
=
mempool_alloc
(
timer_pool
);
struct
_triton_timer_t
*
t
=
mempool_alloc
(
timer_pool
);
...
@@ -106,20 +113,22 @@ int __export triton_timer_add(struct triton_context_t *ctx, struct triton_timer_
...
@@ -106,20 +113,22 @@ int __export triton_timer_add(struct triton_context_t *ctx, struct triton_timer_
t
->
ctx
=
(
struct
_triton_context_t
*
)
ctx
->
tpd
;
t
->
ctx
=
(
struct
_triton_context_t
*
)
ctx
->
tpd
;
else
else
t
->
ctx
=
(
struct
_triton_context_t
*
)
default_ctx
->
tpd
;
t
->
ctx
=
(
struct
_triton_context_t
*
)
default_ctx
->
tpd
;
t
->
fd
=
timerfd_create
(
CLOCK_MONOTONIC
,
TFD_NONBLOCK
);
t
->
fd
=
timerfd_create
(
CLOCK_MONOTONIC
,
0
);
if
(
t
->
fd
<
0
)
{
if
(
t
->
fd
<
0
)
{
triton_log_error
(
"timer:timerfd_create: %s"
,
strerror
(
errno
));
triton_log_error
(
"timer:timerfd_create: %s"
,
strerror
(
errno
));
mempool_free
(
t
);
mempool_free
(
t
);
return
-
1
;
return
-
1
;
}
}
if
(
fcntl
(
t
->
fd
,
F_SETFL
,
O_NONBLOCK
))
{
triton_log_error
(
"timer: failed to set nonblocking mode: %s
\n
"
,
strerror
(
errno
));
goto
out_err
;
}
ud
->
tpd
=
t
;
ud
->
tpd
=
t
;
if
(
triton_timer_mod
(
ud
,
abs_time
))
{
if
(
triton_timer_mod
(
ud
,
abs_time
))
close
(
t
->
fd
);
goto
out_err
;
mempool_free
(
t
);
return
-
1
;
}
spin_lock
(
&
t
->
ctx
->
lock
);
spin_lock
(
&
t
->
ctx
->
lock
);
list_add_tail
(
&
t
->
entry
,
&
t
->
ctx
->
timers
);
list_add_tail
(
&
t
->
entry
,
&
t
->
ctx
->
timers
);
...
@@ -131,15 +140,18 @@ int __export triton_timer_add(struct triton_context_t *ctx, struct triton_timer_
...
@@ -131,15 +140,18 @@ int __export triton_timer_add(struct triton_context_t *ctx, struct triton_timer_
t
->
ud
=
NULL
;
t
->
ud
=
NULL
;
list_del
(
&
t
->
entry
);
list_del
(
&
t
->
entry
);
spin_unlock
(
&
t
->
ctx
->
lock
);
spin_unlock
(
&
t
->
ctx
->
lock
);
close
(
t
->
fd
);
goto
out_err
;
mempool_free
(
t
);
ud
->
tpd
=
NULL
;
return
-
1
;
}
}
__sync_fetch_and_add
(
&
triton_stat
.
timer_count
,
1
);
__sync_fetch_and_add
(
&
triton_stat
.
timer_count
,
1
);
return
0
;
return
0
;
out_err:
ud
->
tpd
=
NULL
;
close
(
t
->
fd
);
mempool_free
(
t
);
return
-
1
;
}
}
int
__export
triton_timer_mod
(
struct
triton_timer_t
*
ud
,
int
abs_time
)
int
__export
triton_timer_mod
(
struct
triton_timer_t
*
ud
,
int
abs_time
)
{
{
...
...
accel-pptpd/triton/timerfd.c
0 → 100644
浏览文件 @
d32cf135
#include <fcntl.h>
#include <unistd.h>
#include <sys/syscall.h>
#include "timerfd.h"
int
timerfd_create
(
clockid_t
__clock_id
,
int
__flags
)
{
return
syscall
(
SYS_timerfd_create
,
__clock_id
,
__flags
);
}
int
timerfd_settime
(
int
__ufd
,
int
__flags
,
__const
struct
itimerspec
*
__utmr
,
struct
itimerspec
*
__otmr
)
{
return
syscall
(
SYS_timerfd_settime
,
__ufd
,
__flags
,
__utmr
,
__otmr
);
}
accel-pptpd/triton/timerfd.h
0 → 100644
浏览文件 @
d32cf135
/* Copyright (C) 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _SYS_TIMERFD_H
#define _SYS_TIMERFD_H 1
#include <time.h>
/* Bits to be set in the FLAGS parameter of `timerfd_create'. */
enum
{
TFD_CLOEXEC
=
02000000
,
#define TFD_CLOEXEC TFD_CLOEXEC
TFD_NONBLOCK
=
04000
#define TFD_NONBLOCK TFD_NONBLOCK
};
/* Bits to be set in the FLAGS parameter of `timerfd_settime'. */
enum
{
TFD_TIMER_ABSTIME
=
1
<<
0
#define TFD_TIMER_ABSTIME TFD_TIMER_ABSTIME
};
__BEGIN_DECLS
/* Return file descriptor for new interval timer source. */
extern
int
timerfd_create
(
clockid_t
__clock_id
,
int
__flags
)
__THROW
;
/* Set next expiration time of interval timer source UFD to UTMR. If
FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is
absolute. Optionally return the old expiration time in OTMR. */
extern
int
timerfd_settime
(
int
__ufd
,
int
__flags
,
__const
struct
itimerspec
*
__utmr
,
struct
itimerspec
*
__otmr
)
__THROW
;
/* Return the next expiration time of UFD. */
extern
int
timerfd_gettime
(
int
__ufd
,
struct
itimerspec
*
__otmr
)
__THROW
;
__END_DECLS
#endif
/* sys/timerfd.h */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录