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
70f7755e
Commit
70f7755e
authored
Aug 19, 2009
by
Daniel Lezcano
Committed by
Daniel Lezcano
Aug 19, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix lxc-cgroup-get
Make lxc_cgroup_get returns the number of bytes read and use this value to "printf" it. Signed-off-by:
Daniel Lezcano
<
dlezcano@fr.ibm.com
>
parent
b333f86e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
cgroup.c
src/lxc/cgroup.c
+3
-6
lxc.h
src/lxc/lxc.h
+1
-1
lxc_cgroup.c
src/lxc/lxc_cgroup.c
+6
-3
No files found.
src/lxc/cgroup.c
View file @
70f7755e
...
@@ -198,13 +198,10 @@ int lxc_cgroup_get(const char *name, const char *subsystem,
...
@@ -198,13 +198,10 @@ int lxc_cgroup_get(const char *name, const char *subsystem,
return
-
1
;
return
-
1
;
}
}
if
(
read
(
fd
,
value
,
len
)
<
0
)
{
ret
=
read
(
fd
,
value
,
len
);
if
(
ret
<
0
)
ERROR
(
"read %s : %s"
,
path
,
strerror
(
errno
));
ERROR
(
"read %s : %s"
,
path
,
strerror
(
errno
));
goto
out
;
}
ret
=
0
;
out:
close
(
fd
);
close
(
fd
);
return
ret
;
return
ret
;
}
}
src/lxc/lxc.h
View file @
70f7755e
...
@@ -164,7 +164,7 @@ extern int lxc_cgroup_set(const char *name, const char *subsystem, const char *v
...
@@ -164,7 +164,7 @@ extern int lxc_cgroup_set(const char *name, const char *subsystem, const char *v
* @subsystem : the subsystem
* @subsystem : the subsystem
* @value : the value to be set
* @value : the value to be set
* @len : the len of the value variable
* @len : the len of the value variable
* Returns
0 on success, < 0 otherwise
* Returns
the number of bytes read, < 0 on error
*/
*/
extern
int
lxc_cgroup_get
(
const
char
*
name
,
const
char
*
subsystem
,
extern
int
lxc_cgroup_get
(
const
char
*
name
,
const
char
*
subsystem
,
char
*
value
,
size_t
len
);
char
*
value
,
size_t
len
);
...
...
src/lxc/lxc_cgroup.c
View file @
70f7755e
...
@@ -83,14 +83,17 @@ int main(int argc, char *argv[])
...
@@ -83,14 +83,17 @@ int main(int argc, char *argv[])
}
}
}
else
{
}
else
{
const
unsigned
long
len
=
4096
;
const
unsigned
long
len
=
4096
;
int
ret
;
char
buffer
[
len
];
char
buffer
[
len
];
if
(
lxc_cgroup_get
(
my_args
.
name
,
subsystem
,
buffer
,
len
))
{
ret
=
lxc_cgroup_get
(
my_args
.
name
,
subsystem
,
buffer
,
len
);
if
(
ret
<
0
)
{
ERROR
(
"failed to retrieve value of '%s' for '%s'"
,
ERROR
(
"failed to retrieve value of '%s' for '%s'"
,
subsystem
,
my_args
.
name
);
subsystem
,
my_args
.
name
);
return
-
1
;
return
-
1
;
}
}
printf
(
"%
s"
,
buffer
);
printf
(
"%
*s"
,
ret
,
buffer
);
}
}
return
0
;
return
0
;
...
...
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