Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangwenhui
OpenXG-RAN
Commits
fa561475
Commit
fa561475
authored
Jun 28, 2018
by
Haruki NAOI
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some warnings.
parent
c8bff02e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
38 deletions
+47
-38
openair2/UTIL/LOG/log.c
openair2/UTIL/LOG/log.c
+47
-38
No files found.
openair2/UTIL/LOG/log.c
View file @
fa561475
...
...
@@ -516,9 +516,9 @@ int logInit (void)
}
extern
int
oai_exit
;
void
*
log_mem_write
(
void
)
void
*
log_mem_write
(
void
*
arg
)
{
int
*
fp
;
int
fp
;
char
f_name
[
1024
];
struct
timespec
slp_tm
;
slp_tm
.
tv_sec
=
0
;
...
...
@@ -540,7 +540,9 @@ void * log_mem_write(void)
}
snprintf
(
f_name
,
1024
,
"%s_%d.log"
,
log_mem_filename
,
log_mem_file_cnt
);
fp
=
open
(
f_name
,
O_WRONLY
|
O_CREAT
,
0666
);
write
(
fp
,
log_mem_d
[
log_mem_write_side
].
buf_p
,
log_mem_d
[
log_mem_write_side
].
buf_index
);
if
(
write
(
fp
,
log_mem_d
[
log_mem_write_side
].
buf_p
,
log_mem_d
[
log_mem_write_side
].
buf_index
)
<
log_mem_d
[
log_mem_write_side
].
buf_index
)
{
// TODO assert ?
}
close
(
fp
);
log_mem_file_cnt
++
;
log_mem_d
[
log_mem_write_side
].
buf_index
=
0
;
...
...
@@ -550,6 +552,7 @@ void * log_mem_write(void)
nanosleep
(
&
slp_tm
,
NULL
);
}
}
return
0
;
}
int
logInit_log_mem
(
void
)
...
...
@@ -567,7 +570,7 @@ int logInit_log_mem (void)
if
((
pthread_mutex_init
(
&
log_mem_lock
,
NULL
)
!=
0
)
||
(
pthread_cond_init
(
&
log_mem_notify
,
NULL
)
!=
0
))
{
log_mem_d
[
1
].
enable_flag
=
0
;
return
;
return
-
1
;
}
pthread_create
(
&
log_mem_thread
,
NULL
,
log_mem_write
,
(
void
*
)
NULL
);
}
else
{
...
...
@@ -1488,7 +1491,7 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
va_end
(
args
);
// OAI printf compatibility
if
((
g_log
->
onlinelog
==
1
)
&&
(
level
!=
LOG_FILE
))
if
((
g_log
->
onlinelog
==
1
)
&&
(
level
!=
LOG_FILE
))
{
if
(
log_mem_flag
==
1
){
if
(
log_mem_d
[
log_mem_side
].
enable_flag
==
1
){
temp_index
=
log_mem_d
[
log_mem_side
].
buf_index
;
...
...
@@ -1524,6 +1527,7 @@ void logRecord_mt(const char *file, const char *func, int line, int comp,
}
else
{
fwrite
(
log_buffer
,
len
,
1
,
stdout
);
}
}
if
(
g_log
->
syslog
)
{
syslog
(
g_log
->
level
,
"%s"
,
log_buffer
);
...
...
@@ -1852,8 +1856,7 @@ void log_set_instance_type (log_instance_type_t instance)
#endif
void
output_log_mem
(
void
){
int
cnt
,
cnt2
;
int
*
fp
;
int
fp
;
char
f_name
[
1024
];
if
(
log_mem_flag
==
1
){
...
...
@@ -1866,18 +1869,24 @@ void output_log_mem(void){
if
(
log_mem_multi
==
1
){
snprintf
(
f_name
,
1024
,
"%s_%d.log"
,
log_mem_filename
,
log_mem_file_cnt
);
fp
=
open
(
f_name
,
O_WRONLY
|
O_CREAT
,
0666
);
write
(
fp
,
log_mem_d
[
0
].
buf_p
,
log_mem_d
[
0
].
buf_index
);
if
(
write
(
fp
,
log_mem_d
[
0
].
buf_p
,
log_mem_d
[
0
].
buf_index
)
<
log_mem_d
[
0
].
buf_index
)
{
// TODO assert ?
}
close
(
fp
);
free
(
log_mem_d
[
0
].
buf_p
);
snprintf
(
f_name
,
1024
,
"%s_%d.log"
,
log_mem_filename
,
log_mem_file_cnt
);
fp
=
open
(
f_name
,
O_WRONLY
|
O_CREAT
,
0666
);
write
(
fp
,
log_mem_d
[
1
].
buf_p
,
log_mem_d
[
1
].
buf_index
);
if
(
write
(
fp
,
log_mem_d
[
1
].
buf_p
,
log_mem_d
[
1
].
buf_index
)
<
log_mem_d
[
1
].
buf_index
)
{
// TODO assert ?
}
close
(
fp
);
free
(
log_mem_d
[
1
].
buf_p
);
}
else
{
fp
=
open
(
log_mem_filename
,
O_WRONLY
|
O_CREAT
,
0666
);
write
(
fp
,
log_mem_d
[
0
].
buf_p
,
log_mem_d
[
0
].
buf_index
);
if
(
write
(
fp
,
log_mem_d
[
0
].
buf_p
,
log_mem_d
[
0
].
buf_index
)
<
log_mem_d
[
0
].
buf_index
)
{
// TODO assert ?
}
close
(
fp
);
free
(
log_mem_d
[
0
].
buf_p
);
}
...
...
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