AC_DEFUN([LVE_OPENVZ],[ AC_MSG_CHECKING([virtinfo.h has VIRTINFO_EXEC]) LVE_LINUX_TRY_COMPILE([ #include ],[ int v; v = VIRTINFO_EXEC; ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_EXEC_NOTIFIER, 1, [virtinfo.h has VIRTINFO_EXEC]) ],[ AC_MSG_RESULT(NO) ]) # OpenVZ-el6 ub_precharge_snapshot AC_MSG_CHECKING([ub_precharge_snapshot exists in kernel]) LVE_LINUX_TRY_COMPILE([ #include ],[ void (*lve_sym)(struct user_beancounter *ub, int *precharge); lve_sym = ub_precharge_snapshot; ],[ LVE_SYM_ADDR(ub_precharge_snapshot) if test $sym_addr != "0x0"; then SYM_UB_SNAPSHOT="lve_ub_prechange_snapshot = $sym_addr;" fi ],[ sym_addr=0 ]) AC_SUBST([SYM_UB_SNAPSHOT]) AC_MSG_RESULT([$sym_addr]) AC_MSG_CHECKING([do_setublimit_by_id exists in kernel]) LVE_SYM_ADDR(do_setublimit_by_id) if test $sym_addr != "0x0"; then AC_DEFINE(UBC_CL_API, 1, [use CL based api to change limits]) AC_MSG_RESULT(YES) else AC_MSG_RESULT(NO) fi # not exist at any header :( AC_MSG_CHECKING([do_setublimit exists in kernel]) LVE_SYM_ADDR(do_setublimit) if test $sym_addr != "0x0"; then SYM_UB_SETLIMIT="lve_setublimit = $sym_addr;" fi AC_SUBST([SYM_UB_SETLIMIT]) AC_MSG_RESULT([$sym_addr]) # -- FIND_UB_ATTACH_TASK AC_MSG_CHECKING([ub_attach_task exists in kernel]) LVE_LINUX_TRY_COMPILE([ #include #include ],[ int (*lve_sym)(struct user_beancounter *ub, struct task_struct *task); lve_sym = ub_attach_task; ],[ LVE_SYM_ADDR(ub_attach_task) if test $sym_addr != "0x0"; then AC_DEFINE([HAVE_UB_ATTACH_TASK], [], [use ub_attach_task]) SYM_UB_ATTACH_TASK="_lve_ub_attach_task = $sym_addr;" fi ],[ sym_addr=0 ]) AC_SUBST([SYM_UB_ATTACH_TASK]) AC_MSG_RESULT([$sym_addr]) # -- FIND_UB_ATTACH AC_MSG_CHECKING([ub_attach exists in kernel]) LVE_LINUX_TRY_COMPILE([ #include #include ],[ int (*lve_sym)(struct user_beancounter *ub); lve_sym = ub_attach; ],[ LVE_SYM_ADDR(ub_attach) if test $sym_addr != "0x0"; then SYM_UB_ATTACH="_lve_ub_attach = $sym_addr;" AC_DEFINE([HAVE_UB_ATTACH], [], [use ub_attach]) fi ],[ sym_addr=0 ]) AC_SUBST([SYM_UB_ATTACH]) AC_MSG_RESULT([$sym_addr]) # -- UB_GET_CSS AC_MSG_CHECKING([ub_get_css exists in kernel]) LVE_LINUX_TRY_COMPILE([ #include #include ],[ struct cgroup_subsys_state *(*lve_sym)(struct user_beancounter *ub, int idx); lve_sym = __ub_get_css; ],[ LVE_SYM_ADDR(__ub_get_css) if test $sym_addr != "0x0"; then SYM_UB_GET_CSS="lve_ub_get_css = $sym_addr;" AC_DEFINE([HAVE_UB_GET_CSS], [], [have ub_get_css]) fi ],[ sym_addr=0 ]) AC_SUBST([SYM_UB_GET_CSS]) AC_MSG_RESULT([$sym_addr]) # -- GET_BEANCOUNTER_BYUID AC_MSG_CHECKING([get_beancounter_byuid exists in kernel]) LVE_LINUX_TRY_COMPILE([ #include ],[ struct user_beancounter *(*lve_sym)(uid_t uid, int create); lve_sym = get_beancounter_byuid; ],[ LVE_SYM_ADDR(get_beancounter_byuid) if test $sym_addr != "0x0"; then AC_DEFINE(HAVE_GET_BEANCOUNTER_BYUID, 1, [get_beancounter_byuid exists]) SYM_GET_BEANCOUNTER_BYUID="lve_get_beancounter_byuid = $sym_addr;" fi ],[ sym_addr=0 ]) AC_SUBST([SYM_GET_BEANCOUNTER_BYUID]) AC_MSG_RESULT([$sym_addr]) # -- GET_BEANCOUNTER_BYUID AC_MSG_CHECKING([get_beancounter_byuid exists in kernel]) LVE_LINUX_TRY_COMPILE([ #include ],[ struct user_beancounter *(*lve_sym)(const char *name, int create); lve_sym = get_beancounter_by_name; ],[ LVE_SYM_ADDR(get_beancounter_by_name) if test $sym_addr != "0x0"; then AC_DEFINE(HAVE_GET_BEANCOUNTER_BYNAME, 1, [get_beancounter_by_name exists]) SYM_GET_BEANCOUNTER_BYNAME="lve_get_beancounter_by_name = $sym_addr;" fi ],[ sym_addr=0 ]) AC_SUBST([SYM_GET_BEANCOUNTER_BYNAME]) AC_MSG_RESULT([$sym_addr]) # -- UB_CGROUP_ROOT AC_MSG_CHECKING([ub_cgroup_root exists in kernel]) LVE_SYM_ADDR(ub_cgroup_root) if test $sym_addr != "0x0"; then SYM_UB_CGROUP_ROOT="lve_ub_cgroup_root = $sym_addr;" AC_DEFINE(HAVE_UB_CGROUP_ROOT, 1, [ub_cgroup_root exists]) fi AC_SUBST([SYM_UB_CGROUP_ROOT]) AC_MSG_RESULT([$sym_addr]) # -- VE_TASK_INFO AC_MSG_CHECKING([VE_CLEANUP_CHAIN in ve_proto.h]) LVE_LINUX_TRY_COMPILE([ #include ],[ int chain; chain = VE_CLEANUP_CHAIN; ],[ AC_MSG_RESULT(yes) AC_DEFINE([HAVE_VE_CLEANUP_CHAIN], [], [have ve_cleanup_chain in ve_proto.h]) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([in_ub_memcg_attach in sched.h]) LVE_LINUX_TRY_COMPILE([ #include ],[ struct task_struct *t; t->in_ub_memcg_attach = 0; ],[ AC_MSG_RESULT(yes) AC_DEFINE([HAVE_IN_UB_MEMCG_ATTACH], [], [have in_ub_memcg_attach in sched.h]) ],[ AC_MSG_RESULT(no) ]) # -- UB_SYNC_MEMCG AC_MSG_CHECKING([ub_sync_memcg is exported]) LVE_LINUX_TRY_COMPILE([ #include ],[ void (*lve_sym)(struct user_beancounter *ub); lve_sym = ub_sync_memcg; ],[ LVE_SYM_ADDR(ub_sync_memcg) if test $sym_addr != "0x0"; then SYM_UB_SYNC_MEMCG="ub_sync_memcg = $sym_addr;" AC_DEFINE([HAVE_UB_SYNC_MEMCG], [], [ub_sync_memcg exported]) fi ],[ sym_addr=0 ]) AC_SUBST([SYM_UB_SYNC_MEMCG]) AC_MSG_RESULT([$sym_addr]) # -- UB_CGROUP_MNT AC_MSG_CHECKING([ub_cgroup_mnt exists in kernel]) LVE_SYM_ADDR(ub_cgroup_mnt) if test $sym_addr != "0x0"; then SYM_UB_CGROUP_MNT="lve_ub_cgroup_mnt = $sym_addr;" AC_DEFINE(HAVE_UB_CGROUP_MNT, 1, [ub_cgroup_mnt exists]) fi AC_SUBST([SYM_UB_CGROUP_MNT]) AC_MSG_RESULT([$sym_addr]) # -- TRY_TO_FREE_GANG_PAGES AC_MSG_CHECKING([try_to_free_gang_pages exists in kernel]) LVE_LINUX_TRY_COMPILE([ #include #include ],[ unsigned long (*lve_sym)(struct gang_set *gs, gfp_t gfp_mask); lve_sym = try_to_free_gang_pages; ],[ LVE_SYM_ADDR(try_to_free_gang_pages) if test $sym_addr != "0x0"; then SYM_TRY_TO_FREE_GANG_PAGES="lve_try_to_free_gang_pages = $sym_addr;" AC_DEFINE(HAVE_TRY_TO_FREE_GANG_PAGES, [], [try_to_free_gang_pages exists]) fi ],[ sym_addr=0 ]) AC_SUBST([SYM_TRY_TO_FREE_GANG_PAGES]) AC_MSG_RESULT([$sym_addr]) # -- NETWORK TRAFFIC CONTROL AC_MSG_CHECKING([network traffic control exists in kernel]) LVE_LINUX_TRY_COMPILE([ #include ],[ int rc; rc = VIRTINFO_TRAF_IN_ACCOUNT | VIRTINFO_TRAF_OUT_ACCOUNT | VIRTINFO_TRAF_OUT_MARK; ],[ AC_DEFINE(HAVE_LVE_TRAF_CONTROL, [], [network traffic control exists]) AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING([virtinfo.h has VIRTINFO_SOCKADDR]) LVE_LINUX_TRY_COMPILE([ #include ],[ int rc; rc = VIRTINFO_SOCKADDR; ],[ AC_DEFINE(HAVE_LVE_PORT_CONTROL, [], [network tcp port control exists]) AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) ]) # ub_set_shortage_cb is "static inline" function so we can't use LVE_LINUX_CHECK_SYMBOL AC_MSG_CHECKING([for ub_set_shortage_cb exist]) LVE_LINUX_TRY_COMPILE([ #include static struct user_beancounter ub; // too big to store it on stack static void cb(struct user_beancounter * ubc, int resource) {} ],[ ub_set_shortage_cb(&ub, cb); ],[ AC_MSG_RESULT(yes) AC_DEFINE([HAVE_UB_SHORTAGE_CB], [1], [user beancounter shortage callback]) ],[ AC_MSG_RESULT(no) ]) # -- UB_CGROUP AC_MSG_CHECKING([ub_cgroup in struct user_beancounter]) LVE_LINUX_TRY_COMPILE([ #include ],[ struct user_beancounter ub; ub.ub_cgroup = NULL; ],[ AC_MSG_RESULT(yes) AC_DEFINE([HAVE_UB_CGROUP], [], [have ub_cgroup in struct user_beancounter]) ],[ AC_MSG_RESULT(no) ]) # -- PROC_ROOT AC_MSG_CHECKING([proc_root in struct ve_struct]) LVE_LINUX_TRY_COMPILE([ #include #include ],[ struct ve_struct ve; ve.proc_root = NULL; ],[ AC_MSG_RESULT(yes) AC_DEFINE([HAVE_VE_PROC_ROOT], [], [have proc_root in struct ve_struct]) ],[ AC_MSG_RESULT(no) ]) # -- VE_TASK_INFO AC_MSG_CHECKING([ve_task_info in struct task_struct]) LVE_LINUX_TRY_COMPILE([ #include #include ],[ struct task_struct task; task.ve_task_info.owner_env->proc_root = NULL; ],[ AC_MSG_RESULT(yes) AC_DEFINE([HAVE_VE_TASK_INFO], [], [have ve_task_info in struct task_struct]) ],[ AC_MSG_RESULT(no) ]) # -- HAVE SUB UBC AC_MSG_CHECKING([sub ubc exist in kernel]) LVE_LINUX_TRY_COMPILE([ #include ],[ get_sub_beancounter_by_name(NULL, 10, 1); ],[ AC_DEFINE(HAVE_SUB_UBC, 1, [sub ubc exist in kernel]) AC_MSG_RESULT([yes]) ],[ AC_MSG_RESULT([no]) ]) ])