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
ee555b28
Unverified
Commit
ee555b28
authored
Mar 17, 2020
by
Stéphane Graber
Committed by
GitHub
Mar 17, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3303 from brauner/2020-03-17/fixes
tools: fix -g and -u parameters for lxc-execute and lxc-attach and fix pidfd detection logic
parents
a1d5a1d4
8ad4fa68
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
10 deletions
+18
-10
commands.c
src/lxc/commands.c
+1
-1
raw_syscalls.c
src/lxc/raw_syscalls.c
+5
-5
lxc_attach.c
src/lxc/tools/lxc_attach.c
+4
-2
lxc_execute.c
src/lxc/tools/lxc_execute.c
+4
-2
utils.c
src/lxc/utils.c
+4
-0
No files found.
src/lxc/commands.c
View file @
ee555b28
...
@@ -689,7 +689,7 @@ static int lxc_cmd_stop_callback(int fd, struct lxc_cmd_req *req,
...
@@ -689,7 +689,7 @@ static int lxc_cmd_stop_callback(int fd, struct lxc_cmd_req *req,
stopsignal
=
handler
->
conf
->
stopsignal
;
stopsignal
=
handler
->
conf
->
stopsignal
;
memset
(
&
rsp
,
0
,
sizeof
(
rsp
));
memset
(
&
rsp
,
0
,
sizeof
(
rsp
));
if
(
handler
->
pidfd
>=
0
)
if
(
handler
->
pidfd
>=
0
)
rsp
.
ret
=
lxc_raw_pidfd_send_signal
(
handler
->
pidfd
,
stopsignal
,
NULL
,
0
);
rsp
.
ret
=
lxc_raw_pidfd_send_signal
(
handler
->
pidfd
,
stopsignal
,
NULL
,
0
);
else
else
rsp
.
ret
=
kill
(
handler
->
pid
,
stopsignal
);
rsp
.
ret
=
kill
(
handler
->
pid
,
stopsignal
);
...
...
src/lxc/raw_syscalls.c
View file @
ee555b28
...
@@ -123,13 +123,13 @@ pid_t lxc_raw_clone_cb(int (*fn)(void *), void *args, unsigned long flags,
...
@@ -123,13 +123,13 @@ pid_t lxc_raw_clone_cb(int (*fn)(void *), void *args, unsigned long flags,
return
pid
;
return
pid
;
}
}
/* For all the architectures we care about it's the same syscall number. */
#ifndef __NR_pidfd_send_signal
#define __NR_pidfd_send_signal 424
#endif
int
lxc_raw_pidfd_send_signal
(
int
pidfd
,
int
sig
,
siginfo_t
*
info
,
int
lxc_raw_pidfd_send_signal
(
int
pidfd
,
int
sig
,
siginfo_t
*
info
,
unsigned
int
flags
)
unsigned
int
flags
)
{
{
#ifdef __NR_pidfd_send_signal
return
syscall
(
__NR_pidfd_send_signal
,
pidfd
,
sig
,
info
,
flags
);
return
syscall
(
__NR_pidfd_send_signal
,
pidfd
,
sig
,
info
,
flags
);
#else
errno
=
ENOSYS
;
return
-
1
;
#endif
}
}
src/lxc/tools/lxc_attach.c
View file @
ee555b28
...
@@ -132,6 +132,8 @@ Options :\n\
...
@@ -132,6 +132,8 @@ Options :\n\
.
checker
=
NULL
,
.
checker
=
NULL
,
.
log_priority
=
"ERROR"
,
.
log_priority
=
"ERROR"
,
.
log_file
=
"none"
,
.
log_file
=
"none"
,
.
uid
=
LXC_INVALID_UID
,
.
gid
=
LXC_INVALID_GID
,
};
};
static
int
my_parser
(
struct
lxc_arguments
*
args
,
int
c
,
char
*
arg
)
static
int
my_parser
(
struct
lxc_arguments
*
args
,
int
c
,
char
*
arg
)
...
@@ -345,10 +347,10 @@ int main(int argc, char *argv[])
...
@@ -345,10 +347,10 @@ int main(int argc, char *argv[])
goto
out
;
goto
out
;
}
}
if
(
my_args
.
uid
)
if
(
my_args
.
uid
!=
LXC_INVALID_UID
)
attach_options
.
uid
=
my_args
.
uid
;
attach_options
.
uid
=
my_args
.
uid
;
if
(
my_args
.
gid
)
if
(
my_args
.
gid
!=
LXC_INVALID_GID
)
attach_options
.
gid
=
my_args
.
gid
;
attach_options
.
gid
=
my_args
.
gid
;
if
(
command
.
program
)
{
if
(
command
.
program
)
{
...
...
src/lxc/tools/lxc_execute.c
View file @
ee555b28
...
@@ -63,6 +63,8 @@ Options :\n\
...
@@ -63,6 +63,8 @@ Options :\n\
.
log_priority
=
"ERROR"
,
.
log_priority
=
"ERROR"
,
.
log_file
=
"none"
,
.
log_file
=
"none"
,
.
daemonize
=
0
,
.
daemonize
=
0
,
.
uid
=
LXC_INVALID_UID
,
.
gid
=
LXC_INVALID_GID
,
};
};
static
int
my_parser
(
struct
lxc_arguments
*
args
,
int
c
,
char
*
arg
)
static
int
my_parser
(
struct
lxc_arguments
*
args
,
int
c
,
char
*
arg
)
...
@@ -190,7 +192,7 @@ int main(int argc, char *argv[])
...
@@ -190,7 +192,7 @@ int main(int argc, char *argv[])
if
(
!
bret
)
if
(
!
bret
)
goto
out
;
goto
out
;
if
(
my_args
.
uid
)
{
if
(
my_args
.
uid
!=
LXC_INVALID_UID
)
{
char
buf
[
256
];
char
buf
[
256
];
ret
=
snprintf
(
buf
,
256
,
"%d"
,
my_args
.
uid
);
ret
=
snprintf
(
buf
,
256
,
"%d"
,
my_args
.
uid
);
...
@@ -202,7 +204,7 @@ int main(int argc, char *argv[])
...
@@ -202,7 +204,7 @@ int main(int argc, char *argv[])
goto
out
;
goto
out
;
}
}
if
(
my_args
.
gid
)
{
if
(
my_args
.
gid
!=
LXC_INVALID_GID
)
{
char
buf
[
256
];
char
buf
[
256
];
ret
=
snprintf
(
buf
,
256
,
"%d"
,
my_args
.
gid
);
ret
=
snprintf
(
buf
,
256
,
"%d"
,
my_args
.
gid
);
...
...
src/lxc/utils.c
View file @
ee555b28
...
@@ -1833,5 +1833,9 @@ bool lxc_can_use_pidfd(int pidfd)
...
@@ -1833,5 +1833,9 @@ bool lxc_can_use_pidfd(int pidfd)
if
(
ret
<
0
)
if
(
ret
<
0
)
return
log_error_errno
(
false
,
errno
,
"Kernel does not support waiting on processes through pidfds"
);
return
log_error_errno
(
false
,
errno
,
"Kernel does not support waiting on processes through pidfds"
);
ret
=
lxc_raw_pidfd_send_signal
(
pidfd
,
0
,
NULL
,
0
);
if
(
ret
)
return
log_error_errno
(
false
,
errno
,
"Kernel does not support sending singals through pidfds"
);
return
log_trace
(
true
,
"Kernel supports pidfds"
);
return
log_trace
(
true
,
"Kernel supports pidfds"
);
}
}
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