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
2d7b0895
Unverified
Commit
2d7b0895
authored
Feb 26, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tree-wide: start replacing instances of syserrno() with syserror()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
060aaa39
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
24 deletions
+24
-24
af_unix.c
src/lxc/af_unix.c
+1
-1
attach.c
src/lxc/attach.c
+2
-2
cgfsng.c
src/lxc/cgroups/cgfsng.c
+14
-14
cgroup2_devices.c
src/lxc/cgroups/cgroup2_devices.c
+3
-3
commands.c
src/lxc/commands.c
+2
-2
conf.c
src/lxc/conf.c
+1
-1
confile_utils.c
src/lxc/confile_utils.c
+1
-1
No files found.
src/lxc/af_unix.c
View file @
2d7b0895
...
...
@@ -198,7 +198,7 @@ again:
if
(
errno
==
EINTR
)
goto
again
;
return
syserr
no
(
-
errno
,
"Failed to receive response"
);
return
syserr
or
(
"Failed to receive response"
);
}
if
(
ret
==
0
)
return
0
;
...
...
src/lxc/attach.c
View file @
2d7b0895
...
...
@@ -512,7 +512,7 @@ static int same_ns(int dfd_pid1, int dfd_pid2, const char *ns_path)
if
(
ns_fd2
<
0
)
{
if
(
errno
==
ENOENT
)
return
-
ENOENT
;
return
syserr
no
(
-
errno
,
"Failed to open %d(%s)"
,
dfd_pid2
,
ns_path
);
return
syserr
or
(
"Failed to open %d(%s)"
,
dfd_pid2
,
ns_path
);
}
ret
=
same_nsfd
(
dfd_pid1
,
dfd_pid2
,
ns_path
);
...
...
@@ -551,7 +551,7 @@ static int __prepare_namespaces_pidfd(struct attach_context *ctx)
break
;
}
return
syserr
no
(
-
errno
,
"Failed to determine whether %s namespace is shared"
,
return
syserr
or
(
"Failed to determine whether %s namespace is shared"
,
ns_info
[
i
].
proc_name
);
}
...
...
src/lxc/cgroups/cgfsng.c
View file @
2d7b0895
...
...
@@ -744,7 +744,7 @@ static int __cgroup_tree_create(int dfd_base, const char *path, mode_t mode,
ret
=
mkdirat
(
dfd_cur
,
cur
,
mode
);
if
(
ret
<
0
)
{
if
(
errno
!=
EEXIST
)
return
syserr
no
(
-
errno
,
"Failed to create %d(%s)"
,
dfd_cur
,
cur
);
return
syserr
or
(
"Failed to create %d(%s)"
,
dfd_cur
,
cur
);
ret
=
-
EEXIST
;
}
...
...
@@ -752,12 +752,12 @@ static int __cgroup_tree_create(int dfd_base, const char *path, mode_t mode,
dfd_final
=
open_at
(
dfd_cur
,
cur
,
PROTECT_OPATH_DIRECTORY
,
PROTECT_LOOKUP_BENEATH
,
0
);
if
(
dfd_final
<
0
)
return
syserr
no
(
-
errno
,
"Fail to open%s directory %d(%s)"
,
return
syserr
or
(
"Fail to open%s directory %d(%s)"
,
!
ret
?
" newly created"
:
""
,
dfd_base
,
cur
);
if
(
dfd_cur
!=
dfd_base
)
close
(
dfd_cur
);
else
if
(
cpuset_v1
&&
!
cpuset1_initialize
(
dfd_base
,
dfd_final
))
return
syserr
no
(
-
EINVAL
,
"Failed to initialize cpuset controller in the legacy hierarchy"
);
return
syserr
or_set
(
-
EINVAL
,
"Failed to initialize cpuset controller in the legacy hierarchy"
);
/*
* Leave dfd_final pointing to the last fd we opened so
* it will be automatically zapped if we return early.
...
...
@@ -1695,7 +1695,7 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
dfd_mnt_unified
=
open_at
(
rootfs
->
dfd_mnt
,
DEFAULT_CGROUP_MOUNTPOINT_RELATIVE
,
PROTECT_OPATH_DIRECTORY
,
PROTECT_LOOKUP_BENEATH_XDEV
,
0
);
if
(
dfd_mnt_unified
<
0
)
return
syserrno
(
-
errno
,
"Failed to open %d(%s)"
,
rootfs
->
dfd_mnt
,
return
syserrno
(
false
,
"Failed to open %d(%s)"
,
rootfs
->
dfd_mnt
,
DEFAULT_CGROUP_MOUNTPOINT_RELATIVE
);
/*
* If cgroup namespaces are supported but the container will
...
...
@@ -1798,7 +1798,7 @@ __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops,
dfd_mnt_tmpfs
=
open_at
(
rootfs
->
dfd_mnt
,
DEFAULT_CGROUP_MOUNTPOINT_RELATIVE
,
PROTECT_OPATH_DIRECTORY
,
PROTECT_LOOKUP_BENEATH_XDEV
,
0
);
if
(
dfd_mnt_tmpfs
<
0
)
return
syserrno
(
-
errno
,
"Failed to open %d(%s)"
,
rootfs
->
dfd_mnt
,
return
syserrno
(
false
,
"Failed to open %d(%s)"
,
rootfs
->
dfd_mnt
,
DEFAULT_CGROUP_MOUNTPOINT_RELATIVE
);
for
(
int
i
=
0
;
ops
->
hierarchies
[
i
];
i
++
)
{
...
...
@@ -2937,13 +2937,13 @@ static bool __cgfsng_delegate_controllers(struct cgroup_ops *ops, const char *cg
ret
=
lxc_writeat
(
dfd_cur
,
"cgroup.subtree_control"
,
add_controllers
,
full_len
);
if
(
ret
<
0
)
return
syserr
no
(
-
errno
,
"Could not enable
\"
%s
\"
controllers in the unified cgroup %d"
,
add_controllers
,
dfd_cur
);
return
syserr
or
(
"Could not enable
\"
%s
\"
controllers in the unified cgroup %d"
,
add_controllers
,
dfd_cur
);
TRACE
(
"Enabled
\"
%s
\"
controllers in the unified cgroup %d"
,
add_controllers
,
dfd_cur
);
dfd_final
=
open_at
(
dfd_cur
,
cur
,
PROTECT_OPATH_DIRECTORY
,
PROTECT_LOOKUP_BENEATH
,
0
);
if
(
dfd_final
<
0
)
return
syserr
no
(
-
errno
,
"Fail to open directory %d(%s)"
,
dfd_cur
,
cur
);
return
syserr
or
(
"Fail to open directory %d(%s)"
,
dfd_cur
,
cur
);
if
(
dfd_cur
!=
unified
->
dfd_base
)
close
(
dfd_cur
);
/*
...
...
@@ -3126,7 +3126,7 @@ static int __initialize_cgroups(struct cgroup_ops *ops, bool relative,
}
if
(
dfd_mnt
<
0
)
{
if
(
errno
!=
ENOENT
)
return
syserr
no
(
-
errno
,
"Failed to open %d/unified"
,
ops
->
dfd_mnt
);
return
syserr
or
(
"Failed to open %d/unified"
,
ops
->
dfd_mnt
);
SYSTRACE
(
"Unified cgroup not mounted"
);
continue
;
...
...
@@ -3138,7 +3138,7 @@ static int __initialize_cgroups(struct cgroup_ops *ops, bool relative,
PROTECT_OPATH_DIRECTORY
,
PROTECT_LOOKUP_BENEATH_XDEV
,
0
);
if
(
dfd_base
<
0
)
return
syserr
no
(
-
errno
,
"Failed to open %d/%s"
,
dfd_mnt
,
current_cgroup
);
return
syserr
or
(
"Failed to open %d/%s"
,
dfd_mnt
,
current_cgroup
);
dfd
=
dfd_base
;
}
...
...
@@ -3150,7 +3150,7 @@ static int __initialize_cgroups(struct cgroup_ops *ops, bool relative,
TRACE
(
"No controllers are enabled for delegation in the unified hierarchy"
);
controller_list
=
list_new
();
if
(
!
controller_list
)
return
syserr
no
(
-
ENOMEM
,
"Failed to create empty controller list"
);
return
syserr
or_set
(
-
ENOMEM
,
"Failed to create empty controller list"
);
}
controllers
=
strdup
(
unified_mnt
);
...
...
@@ -3181,7 +3181,7 @@ static int __initialize_cgroups(struct cgroup_ops *ops, bool relative,
PROTECT_LOOKUP_ABSOLUTE_XDEV
,
0
);
if
(
dfd_mnt
<
0
)
{
if
(
errno
!=
ENOENT
)
return
syserr
no
(
-
errno
,
"Failed to open %d/%s"
,
return
syserr
or
(
"Failed to open %d/%s"
,
ops
->
dfd_mnt
,
controllers
);
SYSTRACE
(
"%s not mounted"
,
controllers
);
...
...
@@ -3208,7 +3208,7 @@ static int __initialize_cgroups(struct cgroup_ops *ops, bool relative,
PROTECT_OPATH_DIRECTORY
,
PROTECT_LOOKUP_BENEATH_XDEV
,
0
);
if
(
dfd_base
<
0
)
return
syserr
no
(
-
errno
,
"Failed to open %d/%s"
,
return
syserr
or
(
"Failed to open %d/%s"
,
dfd_mnt
,
current_cgroup
);
dfd
=
dfd_base
;
}
...
...
@@ -3223,7 +3223,7 @@ static int __initialize_cgroups(struct cgroup_ops *ops, bool relative,
*/
controller_list
=
list_add_controllers
(
__controllers
);
if
(
!
controller_list
)
return
syserr
no
(
-
ENOMEM
,
"Failed to create controller list from %s"
,
__controllers
);
return
syserr
or_set
(
-
ENOMEM
,
"Failed to create controller list from %s"
,
__controllers
);
if
(
skip_hierarchy
(
ops
,
controller_list
))
continue
;
...
...
@@ -3280,7 +3280,7 @@ static int initialize_cgroups(struct cgroup_ops *ops, struct lxc_conf *conf)
dfd
=
open_at
(
-
EBADF
,
DEFAULT_CGROUP_MOUNTPOINT
,
PROTECT_OPATH_DIRECTORY
,
PROTECT_LOOKUP_ABSOLUTE_XDEV
,
0
);
if
(
dfd
<
0
)
return
syserr
no
(
-
errno
,
"Failed to open "
DEFAULT_CGROUP_MOUNTPOINT
);
return
syserr
or
(
"Failed to open "
DEFAULT_CGROUP_MOUNTPOINT
);
controllers_use
=
lxc_global_config_value
(
"lxc.cgroup.use"
);
if
(
controllers_use
)
{
...
...
src/lxc/cgroups/cgroup2_devices.c
View file @
2d7b0895
...
...
@@ -369,7 +369,7 @@ static int bpf_program_cgroup_attach(struct bpf_program *prog, int type,
ret
=
bpf_program_load_kernel
(
prog
);
if
(
ret
<
0
)
return
syserr
no
(
-
errno
,
"Failed to load bpf program"
);
return
syserr
or
(
"Failed to load bpf program"
);
attr
=
&
(
union
bpf_attr
){
.
attach_type
=
type
,
...
...
@@ -380,7 +380,7 @@ static int bpf_program_cgroup_attach(struct bpf_program *prog, int type,
ret
=
bpf
(
BPF_PROG_ATTACH
,
attr
,
sizeof
(
*
attr
));
if
(
ret
<
0
)
return
syserr
no
(
-
errno
,
"Failed to attach bpf program"
);
return
syserr
or
(
"Failed to attach bpf program"
);
prog
->
fd_cgroup
=
move_fd
(
fd_attach
);
prog
->
attached_type
=
type
;
...
...
@@ -414,7 +414,7 @@ int bpf_program_cgroup_detach(struct bpf_program *prog)
ret
=
bpf
(
BPF_PROG_DETACH
,
attr
,
sizeof
(
*
attr
));
if
(
ret
<
0
)
return
syserr
no
(
-
errno
,
"Failed to detach bpf program from cgroup %d"
,
fd_cgroup
);
return
syserr
or
(
"Failed to detach bpf program from cgroup %d"
,
fd_cgroup
);
TRACE
(
"Detached bpf program from cgroup %d"
,
fd_cgroup
);
...
...
src/lxc/commands.c
View file @
2d7b0895
...
...
@@ -310,7 +310,7 @@ static ssize_t lxc_cmd_rsp_recv(int sock, struct lxc_cmd_rr *cmd)
bytes_recv
=
lxc_recv_nointr
(
sock
,
rsp
->
data
,
rsp
->
datalen
,
0
);
if
(
bytes_recv
!=
rsp
->
datalen
)
return
syserr
no
(
-
errno
,
"Failed to receive response data for command
\"
%s
\"
: %zd != %d"
,
return
syserr
or
(
"Failed to receive response data for command
\"
%s
\"
: %zd != %d"
,
cur_cmdstr
,
bytes_recv
,
rsp
->
datalen
);
switch
(
cur_cmd
)
{
...
...
@@ -347,7 +347,7 @@ static int __lxc_cmd_rsp_send(int fd, struct lxc_cmd_rsp *rsp)
ret
=
lxc_send_nointr
(
fd
,
rsp
,
sizeof
(
*
rsp
),
MSG_NOSIGNAL
);
if
(
ret
<
0
||
(
size_t
)
ret
!=
sizeof
(
*
rsp
))
return
syserr
no
(
-
errno
,
"Failed to send command response %zd"
,
ret
);
return
syserr
or
(
"Failed to send command response %zd"
,
ret
);
if
(
!
rsp
->
data
||
rsp
->
datalen
<=
0
)
return
0
;
...
...
src/lxc/conf.c
View file @
2d7b0895
...
...
@@ -1842,7 +1842,7 @@ static int lxc_setup_console(const struct lxc_handler *handler,
else
ret
=
lxc_terminal_set_stdfds
(
fd_pty
);
if
(
ret
<
0
)
return
syserr
no
(
-
errno
,
"Failed to redirect std{in,out,err} to pty file descriptor %d"
,
fd_pty
);
return
syserr
or
(
"Failed to redirect std{in,out,err} to pty file descriptor %d"
,
fd_pty
);
}
return
ret
;
...
...
src/lxc/confile_utils.c
View file @
2d7b0895
...
...
@@ -654,7 +654,7 @@ int set_config_path_item(char **conf_item, const char *value)
normalized
=
lxc_deslashify
(
value
);
if
(
!
normalized
)
return
syserr
no
(
-
errno
,
"Failed to normalize path config item"
);
return
syserr
or_set
(
-
ENOMEM
,
"Failed to normalize path config item"
);
return
set_config_string_item_max
(
conf_item
,
normalized
,
PATH_MAX
);
}
...
...
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