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
26b2d152
Commit
26b2d152
authored
Apr 29, 2010
by
Michel Normand
Committed by
Daniel Lezcano
Apr 29, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get_init_pid moved to lxc/commands.c
as will be used later on in other patches. Signed-off-by:
Michel Normand
<
normand@fr.ibm.com
>
Signed-off-by:
Daniel Lezcano
<
dlezcano@fr.ibm.com
>
parent
501cbc71
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
28 deletions
+29
-28
commands.c
src/lxc/commands.c
+28
-0
commands.h
src/lxc/commands.h
+1
-0
lxc_attach.c
src/lxc/lxc_attach.c
+0
-28
No files found.
src/lxc/commands.c
View file @
26b2d152
...
@@ -111,6 +111,34 @@ out_close:
...
@@ -111,6 +111,34 @@ out_close:
goto
out
;
goto
out
;
}
}
pid_t
get_init_pid
(
const
char
*
name
)
{
struct
lxc_command
command
=
{
.
request
=
{
.
type
=
LXC_COMMAND_PID
},
};
int
ret
,
stopped
=
0
;
ret
=
lxc_command
(
name
,
&
command
,
&
stopped
);
if
(
ret
<
0
&&
stopped
)
{
ERROR
(
"'%s' is not running"
,
name
);
return
-
1
;
}
if
(
ret
<
0
)
{
ERROR
(
"failed to send command"
);
return
-
1
;
}
if
(
command
.
answer
.
ret
)
{
ERROR
(
"failed to retrieve the init pid: %s"
,
strerror
(
-
command
.
answer
.
ret
));
return
-
1
;
}
return
command
.
answer
.
pid
;
}
extern
void
lxc_console_remove_fd
(
int
,
struct
lxc_tty_info
*
);
extern
void
lxc_console_remove_fd
(
int
,
struct
lxc_tty_info
*
);
extern
int
lxc_console_callback
(
int
,
struct
lxc_request
*
,
struct
lxc_handler
*
);
extern
int
lxc_console_callback
(
int
,
struct
lxc_request
*
,
struct
lxc_handler
*
);
extern
int
lxc_stop_callback
(
int
,
struct
lxc_request
*
,
struct
lxc_handler
*
);
extern
int
lxc_stop_callback
(
int
,
struct
lxc_request
*
,
struct
lxc_handler
*
);
...
...
src/lxc/commands.h
View file @
26b2d152
...
@@ -47,6 +47,7 @@ struct lxc_command {
...
@@ -47,6 +47,7 @@ struct lxc_command {
struct
lxc_answer
answer
;
struct
lxc_answer
answer
;
};
};
extern
pid_t
get_init_pid
(
const
char
*
name
);
extern
int
lxc_command
(
const
char
*
name
,
struct
lxc_command
*
command
,
extern
int
lxc_command
(
const
char
*
name
,
struct
lxc_command
*
command
,
int
*
stopped
);
int
*
stopped
);
...
...
src/lxc/lxc_attach.c
View file @
26b2d152
...
@@ -55,34 +55,6 @@ Options :\n\
...
@@ -55,34 +55,6 @@ Options :\n\
.
checker
=
NULL
,
.
checker
=
NULL
,
};
};
pid_t
get_init_pid
(
const
char
*
name
)
{
struct
lxc_command
command
=
{
.
request
=
{
.
type
=
LXC_COMMAND_PID
},
};
int
ret
,
stopped
=
0
;
ret
=
lxc_command
(
name
,
&
command
,
&
stopped
);
if
(
ret
<
0
&&
stopped
)
{
ERROR
(
"'%s' is not running"
,
name
);
return
-
1
;
}
if
(
ret
<
0
)
{
ERROR
(
"failed to send command"
);
return
-
1
;
}
if
(
command
.
answer
.
ret
)
{
ERROR
(
"failed to retrieve the init pid: %s"
,
strerror
(
-
command
.
answer
.
ret
));
return
-
1
;
}
return
command
.
answer
.
pid
;
}
int
main
(
int
argc
,
char
*
argv
[],
char
*
envp
[])
int
main
(
int
argc
,
char
*
argv
[],
char
*
envp
[])
{
{
int
ret
;
int
ret
;
...
...
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