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
fa4b063c
Commit
fa4b063c
authored
Oct 07, 2009
by
Michel Normand
Committed by
Daniel Lezcano
Oct 07, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove dead code in monitor.c
This code is not used in lxc. Signed-off-by:
Michel Normand
<
normand@fr.ibm.com
>
Signed-off-by:
Daniel Lezcano
<
dlezcano@fr.ibm.com
>
parent
28034e53
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
72 deletions
+0
-72
lxc.h
src/lxc/lxc.h
+0
-11
monitor.c
src/lxc/monitor.c
+0
-61
No files found.
src/lxc/lxc.h
View file @
fa4b063c
...
@@ -83,17 +83,6 @@ extern int lxc_start(const char *name, char *const argv[]);
...
@@ -83,17 +83,6 @@ extern int lxc_start(const char *name, char *const argv[]);
extern
int
lxc_stop
(
const
char
*
name
);
extern
int
lxc_stop
(
const
char
*
name
);
/*
/*
* Monitor the container, each time the state of the container
* is changed, a state data is send through a file descriptor passed to
* the function with output_fd.
* The function will block until the container is destroyed.
* @name : the name of the container
* @output_fd : the file descriptor where to send the states
* Returns 0 on success, < 0 otherwise
*/
extern
int
lxc_monitor
(
const
char
*
name
,
int
output_fd
);
/*
* Open the monitoring mechanism for a specific container
* Open the monitoring mechanism for a specific container
* The function will return an fd corresponding to the events
* The function will return an fd corresponding to the events
* Returns a file descriptor on success, < 0 otherwise
* Returns a file descriptor on success, < 0 otherwise
...
...
src/lxc/monitor.c
View file @
fa4b063c
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/param.h>
#include <sys/inotify.h>
#include <sys/socket.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <netinet/in.h>
...
@@ -46,66 +45,6 @@ lxc_log_define(lxc_monitor, lxc);
...
@@ -46,66 +45,6 @@ lxc_log_define(lxc_monitor, lxc);
#define UNIX_PATH_MAX 108
#define UNIX_PATH_MAX 108
#endif
#endif
int
lxc_monitor
(
const
char
*
name
,
int
output_fd
)
{
char
path
[
MAXPATHLEN
];
int
err
=
-
1
,
nfd
,
wfd
,
state
;
nfd
=
inotify_init
();
if
(
nfd
<
0
)
{
SYSERROR
(
"failed to initialize inotify"
);
return
-
1
;
}
snprintf
(
path
,
MAXPATHLEN
,
LXCPATH
"/%s/state"
,
name
);
wfd
=
inotify_add_watch
(
nfd
,
path
,
IN_DELETE_SELF
|
IN_CLOSE_WRITE
);
if
(
wfd
<
0
)
{
SYSERROR
(
"failed to add a watch on %s"
,
path
);
goto
out
;
}
for
(;;)
{
struct
inotify_event
evt
;
if
(
read
(
nfd
,
&
evt
,
sizeof
(
evt
))
<
0
)
{
SYSERROR
(
"failed to read inotify event"
);
goto
out
;
}
if
(
evt
.
mask
&
IN_CLOSE_WRITE
)
{
state
=
lxc_getstate
(
name
);
if
(
state
<
0
)
{
ERROR
(
"failed to get the state for %s"
,
name
);
goto
out
;
}
if
(
write
(
output_fd
,
&
state
,
sizeof
(
state
))
<
0
)
{
SYSERROR
(
"failed to send state to %d"
,
output_fd
);
goto
out
;
}
continue
;
}
if
(
evt
.
mask
&
IN_DELETE_SELF
)
{
close
(
output_fd
);
err
=
0
;
goto
out
;
}
ERROR
(
"unknown evt for inotity (%d)"
,
evt
.
mask
);
goto
out
;
}
out:
inotify_rm_watch
(
nfd
,
wfd
);
close
(
nfd
);
return
err
;
}
static
void
lxc_monitor_send
(
struct
lxc_msg
*
msg
)
static
void
lxc_monitor_send
(
struct
lxc_msg
*
msg
)
{
{
int
fd
;
int
fd
;
...
...
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