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
cd54d859
Commit
cd54d859
authored
Jul 22, 2009
by
Daniel Lezcano
Committed by
Daniel Lezcano
Jul 22, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make use of the logging facility and add some traces
Now we have a logging facility, let's use it and add some traces in the code. Signed-off-by:
Daniel Lezcano
<
dlezcano@fr.ibm.com
>
parent
958f5c9e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
3 deletions
+57
-3
conf.c
src/lxc/conf.c
+51
-3
utils.c
src/lxc/utils.c
+6
-0
No files found.
src/lxc/conf.c
View file @
cd54d859
...
@@ -806,6 +806,8 @@ static int setup_utsname(const char *name)
...
@@ -806,6 +806,8 @@ static int setup_utsname(const char *name)
return
-
1
;
return
-
1
;
}
}
INFO
(
"'%s' hostname has been setup"
,
utsname
.
nodename
);
return
0
;
return
0
;
}
}
...
@@ -835,6 +837,8 @@ static int setup_tty(const char *name, const struct lxc_tty_info *tty_info)
...
@@ -835,6 +837,8 @@ static int setup_tty(const char *name, const struct lxc_tty_info *tty_info)
}
}
}
}
INFO
(
"%d tty(s) has been setup"
,
tty_info
->
nbtty
);
return
0
;
return
0
;
}
}
...
@@ -854,6 +858,8 @@ static int setup_rootfs(const char *name)
...
@@ -854,6 +858,8 @@ static int setup_rootfs(const char *name)
return
-
1
;
return
-
1
;
}
}
INFO
(
"chrooted to '%s'"
,
path
);
return
0
;
return
0
;
}
}
...
@@ -890,6 +896,8 @@ static int setup_pts(const char *name)
...
@@ -890,6 +896,8 @@ static int setup_pts(const char *name)
SYSERROR
(
"mount failed '/dev/pts/ptmx'->'/dev/ptmx'"
);
SYSERROR
(
"mount failed '/dev/pts/ptmx'->'/dev/ptmx'"
);
return
-
1
;
return
-
1
;
}
}
INFO
(
"created new pts instance"
);
out:
out:
return
0
;
return
0
;
}
}
...
@@ -908,6 +916,8 @@ static int setup_console(const char *name, const char *tty)
...
@@ -908,6 +916,8 @@ static int setup_console(const char *name, const char *tty)
return
-
1
;
return
-
1
;
}
}
INFO
(
"console '%s' mounted to '%s'"
,
tty
,
console
);
return
0
;
return
0
;
}
}
...
@@ -924,10 +934,17 @@ static int setup_cgroup_cb(void* buffer, void *data)
...
@@ -924,10 +934,17 @@ static int setup_cgroup_cb(void* buffer, void *data)
*
value
=
'\0'
;
*
value
=
'\0'
;
value
+=
1
;
value
+=
1
;
/* remove spurious '\n'*/
if
(
value
[
strlen
(
value
)
-
1
]
==
'\n'
)
value
[
strlen
(
value
)
-
1
]
=
'\0'
;
ret
=
lxc_cgroup_set
(
name
,
key
,
value
);
ret
=
lxc_cgroup_set
(
name
,
key
,
value
);
if
(
ret
)
if
(
ret
)
ERROR
(
"failed to set cgroup '%s' = '%s' for '%s'"
,
ERROR
(
"failed to set cgroup '%s' = '%s' for '%s'"
,
key
,
value
,
name
);
key
,
value
,
name
);
DEBUG
(
"cgroup '%s' set to '%s'"
,
key
,
value
);
return
ret
;
return
ret
;
}
}
...
@@ -984,6 +1001,7 @@ static int setup_cgroup(const char *name)
...
@@ -984,6 +1001,7 @@ static int setup_cgroup(const char *name)
char
filename
[
MAXPATHLEN
];
char
filename
[
MAXPATHLEN
];
char
line
[
MAXPATHLEN
];
char
line
[
MAXPATHLEN
];
struct
stat
s
;
struct
stat
s
;
int
ret
;
snprintf
(
filename
,
MAXPATHLEN
,
LXCPATH
"/%s/cgroup"
,
name
);
snprintf
(
filename
,
MAXPATHLEN
,
LXCPATH
"/%s/cgroup"
,
name
);
...
@@ -999,8 +1017,14 @@ static int setup_cgroup(const char *name)
...
@@ -999,8 +1017,14 @@ static int setup_cgroup(const char *name)
}
}
}
}
return
lxc_file_for_each_line
(
filename
,
setup_cgroup_cb
,
ret
=
lxc_file_for_each_line
(
filename
,
setup_cgroup_cb
,
line
,
MAXPATHLEN
,
(
void
*
)
name
);
line
,
MAXPATHLEN
,
(
void
*
)
name
);
if
(
ret
)
return
ret
;
INFO
(
"cgroup has been setup"
);
return
0
;
}
}
static
void
parse_mntopt
(
char
*
opt
,
unsigned
long
*
flags
,
char
**
data
)
static
void
parse_mntopt
(
char
*
opt
,
unsigned
long
*
flags
,
char
**
data
)
...
@@ -1096,9 +1120,15 @@ static int setup_mount(const char *name)
...
@@ -1096,9 +1120,15 @@ static int setup_mount(const char *name)
goto
out
;
goto
out
;
}
}
DEBUG
(
"mounted %s on %s, type %s"
,
mntent
->
mnt_fsname
,
mntent
->
mnt_dir
,
mntent
->
mnt_type
);
free
(
mntdata
);
free
(
mntdata
);
}
}
ret
=
0
;
ret
=
0
;
INFO
(
"mount points have been setup"
);
out:
out:
endmntent
(
file
);
endmntent
(
file
);
return
ret
;
return
ret
;
...
@@ -1135,6 +1165,8 @@ static int setup_ipv4_addr_cb(void *buffer, void *data)
...
@@ -1135,6 +1165,8 @@ static int setup_ipv4_addr_cb(void *buffer, void *data)
return
-
1
;
return
-
1
;
}
}
DEBUG
(
"address '%s/%s' on '%s' has been setup"
,
addr
,
prefix
,
ifname
);
return
0
;
return
0
;
}
}
...
@@ -1169,6 +1201,8 @@ static int setup_ipv6_addr_cb(void *buffer, void *data)
...
@@ -1169,6 +1201,8 @@ static int setup_ipv6_addr_cb(void *buffer, void *data)
return
-
1
;
return
-
1
;
}
}
INFO
(
"address '%s/%s' on '%s' has been setup"
,
addr
,
prefix
,
ifname
);
return
0
;
return
0
;
}
}
...
@@ -1197,6 +1231,8 @@ static int setup_hw_addr(char *hwaddr, const char *ifname)
...
@@ -1197,6 +1231,8 @@ static int setup_hw_addr(char *hwaddr, const char *ifname)
if
(
ret
)
if
(
ret
)
ERROR
(
"ioctl failure : %s"
,
strerror
(
errno
));
ERROR
(
"ioctl failure : %s"
,
strerror
(
errno
));
DEBUG
(
"mac address '%s' on '%s' has been setup"
,
hwaddr
,
ifname
);
return
ret
;
return
ret
;
}
}
...
@@ -1311,15 +1347,25 @@ static int setup_network_cb(const char *name, const char *directory,
...
@@ -1311,15 +1347,25 @@ static int setup_network_cb(const char *name, const char *directory,
}
}
}
}
DEBUG
(
"'%s' has been setup"
,
current_ifname
);
return
0
;
return
0
;
}
}
static
int
setup_network
(
const
char
*
name
)
static
int
setup_network
(
const
char
*
name
)
{
{
char
directory
[
MAXPATHLEN
];
char
directory
[
MAXPATHLEN
];
int
ret
;
snprintf
(
directory
,
MAXPATHLEN
,
LXCPATH
"/%s/network"
,
name
);
snprintf
(
directory
,
MAXPATHLEN
,
LXCPATH
"/%s/network"
,
name
);
return
lxc_dir_for_each
(
name
,
directory
,
setup_network_cb
,
NULL
);
ret
=
lxc_dir_for_each
(
name
,
directory
,
setup_network_cb
,
NULL
);
if
(
ret
)
return
ret
;
INFO
(
"network has been setup"
);
return
0
;
}
}
int
conf_has
(
const
char
*
name
,
const
char
*
info
)
int
conf_has
(
const
char
*
name
,
const
char
*
info
)
...
@@ -1848,5 +1894,7 @@ int lxc_setup(const char *name, const char *cons,
...
@@ -1848,5 +1894,7 @@ int lxc_setup(const char *name, const char *cons,
return
-
1
;
return
-
1
;
}
}
NOTICE
(
"'%s' is setup."
,
name
);
return
0
;
return
0
;
}
}
src/lxc/utils.c
View file @
cd54d859
...
@@ -196,6 +196,8 @@ int lxc_close_inherited_fd(int fd)
...
@@ -196,6 +196,8 @@ int lxc_close_inherited_fd(int fd)
break
;
break
;
}
}
DEBUG
(
"closing fd '%d'"
,
fd
);
return
close
(
fd
);
return
close
(
fd
);
}
}
...
@@ -217,6 +219,8 @@ again:
...
@@ -217,6 +219,8 @@ again:
continue
;
continue
;
}
}
DEBUG
(
"closing fd '%d'"
,
entry
->
fd
);
if
(
close
(
entry
->
fd
))
if
(
close
(
entry
->
fd
))
WARN
(
"failed to close fd '%d': %s"
,
entry
->
fd
,
WARN
(
"failed to close fd '%d': %s"
,
entry
->
fd
,
strerror
(
errno
));
strerror
(
errno
));
...
@@ -225,5 +229,7 @@ again:
...
@@ -225,5 +229,7 @@ again:
goto
again
;
goto
again
;
}
}
DEBUG
(
"closed all inherited file descriptors"
);
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