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
c422f3af
Unverified
Commit
c422f3af
authored
Jan 30, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log: add lxc_log_get_fd()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
ef1a597f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
log.c
src/lxc/log.c
+16
-2
log.h
src/lxc/log.h
+2
-1
No files found.
src/lxc/log.c
View file @
c422f3af
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
int
lxc_log_fd
=
-
EBADF
;
int
lxc_log_fd
=
-
EBADF
;
static
bool
wants_syslog
=
false
;
static
bool
wants_syslog
=
false
;
static
int
lxc_quiet_specified
;
static
int
lxc_quiet_specified
;
int
lxc_log_use_global_fd
;
bool
lxc_log_use_global_fd
=
false
;
static
int
lxc_loglevel_specified
;
static
int
lxc_loglevel_specified
;
static
char
log_prefix
[
LXC_LOG_PREFIX_SIZE
]
=
"lxc"
;
static
char
log_prefix
[
LXC_LOG_PREFIX_SIZE
]
=
"lxc"
;
...
@@ -92,6 +92,20 @@ static const char *lxc_log_get_container_name(void)
...
@@ -92,6 +92,20 @@ static const char *lxc_log_get_container_name(void)
return
log_vmname
;
return
log_vmname
;
}
}
int
lxc_log_get_fd
(
void
)
{
int
fd_log
=
-
EBADF
;
#ifndef NO_LXC_CONF
if
(
current_config
&&
!
lxc_log_use_global_fd
)
fd_log
=
current_config
->
logfd
;
#endif
if
(
fd_log
<
0
)
fd_log
=
lxc_log_fd
;
return
fd_log
;
}
static
char
*
lxc_log_get_va_msg
(
struct
lxc_log_event
*
event
)
static
char
*
lxc_log_get_va_msg
(
struct
lxc_log_event
*
event
)
{
{
__do_free
char
*
msg
=
NULL
;
__do_free
char
*
msg
=
NULL
;
...
@@ -659,7 +673,7 @@ int lxc_log_init(struct lxc_log *log)
...
@@ -659,7 +673,7 @@ int lxc_log_init(struct lxc_log *log)
if
(
ret
<
0
)
if
(
ret
<
0
)
return
log_error_errno
(
-
1
,
errno
,
"Failed to enable logfile"
);
return
log_error_errno
(
-
1
,
errno
,
"Failed to enable logfile"
);
lxc_log_use_global_fd
=
1
;
lxc_log_use_global_fd
=
true
;
}
else
{
}
else
{
/* if no name was specified, there nothing to do */
/* if no name was specified, there nothing to do */
if
(
!
log
->
name
)
if
(
!
log
->
name
)
...
...
src/lxc/log.h
View file @
c422f3af
...
@@ -85,7 +85,7 @@ struct lxc_log_category {
...
@@ -85,7 +85,7 @@ struct lxc_log_category {
};
};
#ifndef NO_LXC_CONF
#ifndef NO_LXC_CONF
extern
int
lxc_log_use_global_fd
;
extern
bool
lxc_log_use_global_fd
;
#endif
#endif
/*
/*
...
@@ -574,5 +574,6 @@ __hidden extern const char *lxc_log_get_file(void);
...
@@ -574,5 +574,6 @@ __hidden extern const char *lxc_log_get_file(void);
__hidden
extern
void
lxc_log_set_prefix
(
const
char
*
prefix
);
__hidden
extern
void
lxc_log_set_prefix
(
const
char
*
prefix
);
__hidden
extern
const
char
*
lxc_log_get_prefix
(
void
);
__hidden
extern
const
char
*
lxc_log_get_prefix
(
void
);
__hidden
extern
void
lxc_log_options_no_override
(
void
);
__hidden
extern
void
lxc_log_options_no_override
(
void
);
__hidden
extern
int
lxc_log_get_fd
(
void
);
#endif
/* __LXC_LOG_H */
#endif
/* __LXC_LOG_H */
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