Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
c9c814f4
Unverified
Commit
c9c814f4
authored
Feb 02, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: export __cgroup_unfreeze() for use in commands
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
ae4fcc7b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
12 deletions
+23
-12
cgfsng.c
src/lxc/cgroups/cgfsng.c
+22
-12
cgroup.h
src/lxc/cgroups/cgroup.h
+1
-0
No files found.
src/lxc/cgroups/cgfsng.c
View file @
c9c814f4
...
@@ -3550,12 +3550,12 @@ int cgroup_set(const char *name, const char *lxcpath,
...
@@ -3550,12 +3550,12 @@ int cgroup_set(const char *name, const char *lxcpath,
return
ret
;
return
ret
;
}
}
static
int
_
_cgroup_freeze
(
int
unified_fd
,
static
int
do
_cgroup_freeze
(
int
unified_fd
,
const
char
*
state_string
,
const
char
*
state_string
,
int
state_num
,
int
state_num
,
int
timeout
,
int
timeout
,
const
char
*
epoll_error
,
const
char
*
epoll_error
,
const
char
*
wait_error
)
const
char
*
wait_error
)
{
{
__do_close
int
events_fd
=
-
EBADF
;
__do_close
int
events_fd
=
-
EBADF
;
call_cleaner
(
lxc_mainloop_close
)
struct
lxc_epoll_descr
*
descr_ptr
=
NULL
;
call_cleaner
(
lxc_mainloop_close
)
struct
lxc_epoll_descr
*
descr_ptr
=
NULL
;
...
@@ -3592,6 +3592,13 @@ static int __cgroup_freeze(int unified_fd,
...
@@ -3592,6 +3592,13 @@ static int __cgroup_freeze(int unified_fd,
return
log_trace
(
0
,
"Container now %s"
,
(
state_num
==
1
)
?
"frozen"
:
"unfrozen"
);
return
log_trace
(
0
,
"Container now %s"
,
(
state_num
==
1
)
?
"frozen"
:
"unfrozen"
);
}
}
static
inline
int
__cgroup_freeze
(
int
unified_fd
,
int
timeout
)
{
return
do_cgroup_freeze
(
unified_fd
,
"1"
,
1
,
timeout
,
"Failed to create epoll instance to wait for container freeze"
,
"Failed to wait for container to be frozen"
);
}
int
cgroup_freeze
(
const
char
*
name
,
const
char
*
lxcpath
,
int
timeout
)
int
cgroup_freeze
(
const
char
*
name
,
const
char
*
lxcpath
,
int
timeout
)
{
{
__do_close
int
unified_fd
=
-
EBADF
;
__do_close
int
unified_fd
=
-
EBADF
;
...
@@ -3605,13 +3612,18 @@ int cgroup_freeze(const char *name, const char *lxcpath, int timeout)
...
@@ -3605,13 +3612,18 @@ int cgroup_freeze(const char *name, const char *lxcpath, int timeout)
return
ret_errno
(
ENOCGROUP2
);
return
ret_errno
(
ENOCGROUP2
);
lxc_cmd_notify_state_listeners
(
name
,
lxcpath
,
FREEZING
);
lxc_cmd_notify_state_listeners
(
name
,
lxcpath
,
FREEZING
);
ret
=
__cgroup_freeze
(
unified_fd
,
"1"
,
1
,
timeout
,
ret
=
__cgroup_freeze
(
unified_fd
,
timeout
);
"Failed to create epoll instance to wait for container freeze"
,
"Failed to wait for container to be frozen"
);
lxc_cmd_notify_state_listeners
(
name
,
lxcpath
,
!
ret
?
FROZEN
:
RUNNING
);
lxc_cmd_notify_state_listeners
(
name
,
lxcpath
,
!
ret
?
FROZEN
:
RUNNING
);
return
ret
;
return
ret
;
}
}
int
__cgroup_unfreeze
(
int
unified_fd
,
int
timeout
)
{
return
do_cgroup_freeze
(
unified_fd
,
"0"
,
0
,
timeout
,
"Failed to create epoll instance to wait for container freeze"
,
"Failed to wait for container to be frozen"
);
}
int
cgroup_unfreeze
(
const
char
*
name
,
const
char
*
lxcpath
,
int
timeout
)
int
cgroup_unfreeze
(
const
char
*
name
,
const
char
*
lxcpath
,
int
timeout
)
{
{
__do_close
int
unified_fd
=
-
EBADF
;
__do_close
int
unified_fd
=
-
EBADF
;
...
@@ -3625,9 +3637,7 @@ int cgroup_unfreeze(const char *name, const char *lxcpath, int timeout)
...
@@ -3625,9 +3637,7 @@ int cgroup_unfreeze(const char *name, const char *lxcpath, int timeout)
return
ret_errno
(
ENOCGROUP2
);
return
ret_errno
(
ENOCGROUP2
);
lxc_cmd_notify_state_listeners
(
name
,
lxcpath
,
THAWED
);
lxc_cmd_notify_state_listeners
(
name
,
lxcpath
,
THAWED
);
ret
=
__cgroup_freeze
(
unified_fd
,
"0"
,
0
,
timeout
,
ret
=
__cgroup_unfreeze
(
unified_fd
,
timeout
);
"Failed to create epoll instance to wait for container freeze"
,
"Failed to wait for container to be frozen"
);
lxc_cmd_notify_state_listeners
(
name
,
lxcpath
,
!
ret
?
RUNNING
:
FROZEN
);
lxc_cmd_notify_state_listeners
(
name
,
lxcpath
,
!
ret
?
RUNNING
:
FROZEN
);
return
ret
;
return
ret
;
}
}
src/lxc/cgroups/cgroup.h
View file @
c9c814f4
...
@@ -197,6 +197,7 @@ __hidden extern int cgroup_set(const char *name, const char *lxcpath,
...
@@ -197,6 +197,7 @@ __hidden extern int cgroup_set(const char *name, const char *lxcpath,
const
char
*
filename
,
const
char
*
value
);
const
char
*
filename
,
const
char
*
value
);
__hidden
extern
int
cgroup_freeze
(
const
char
*
name
,
const
char
*
lxcpath
,
int
timeout
);
__hidden
extern
int
cgroup_freeze
(
const
char
*
name
,
const
char
*
lxcpath
,
int
timeout
);
__hidden
extern
int
cgroup_unfreeze
(
const
char
*
name
,
const
char
*
lxcpath
,
int
timeout
);
__hidden
extern
int
cgroup_unfreeze
(
const
char
*
name
,
const
char
*
lxcpath
,
int
timeout
);
__hidden
extern
int
__cgroup_unfreeze
(
int
unified_fd
,
int
timeout
);
static
inline
bool
pure_unified_layout
(
const
struct
cgroup_ops
*
ops
)
static
inline
bool
pure_unified_layout
(
const
struct
cgroup_ops
*
ops
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment