Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openairinterface5G
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bin He
openairinterface5G
Commits
bdda7643
Commit
bdda7643
authored
6 years ago
by
Cédric Roux
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/fixes-T-tracer-2018-w17' into develop_integration_2018_w19
parents
f7b3ea03
c14dd7ff
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/utils/T/T.c
+11
-7
11 additions, 7 deletions
common/utils/T/T.c
common/utils/T/local_tracer.c
+8
-8
8 additions, 8 deletions
common/utils/T/local_tracer.c
with
19 additions
and
15 deletions
common/utils/T/T.c
+
11
−
7
View file @
bdda7643
...
...
@@ -88,7 +88,7 @@ static void new_thread(void *(*f)(void *), void *data)
/* defined in local_tracer.c */
void
T_local_tracer_main
(
int
remote_port
,
int
wait_for_tracer
,
int
local_socket
);
int
local_socket
,
char
*
shm_file
);
/* We monitor the tracee and the local tracer processes.
* When one dies we forcefully kill the other.
...
...
@@ -113,6 +113,9 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
int
s
;
int
T_shm_fd
;
int
child1
,
child2
;
char
shm_file
[
128
];
sprintf
(
shm_file
,
"/%s%d"
,
T_SHM_FILENAME
,
getpid
());
if
(
socketpair
(
AF_UNIX
,
SOCK_STREAM
,
0
,
socket_pair
))
{
perror
(
"socketpair"
);
abort
();
}
...
...
@@ -122,7 +125,8 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
child1
=
fork
();
if
(
child1
==
-
1
)
abort
();
if
(
child1
==
0
)
{
close
(
socket_pair
[
1
]);
T_local_tracer_main
(
remote_port
,
wait_for_tracer
,
socket_pair
[
0
]);
T_local_tracer_main
(
remote_port
,
wait_for_tracer
,
socket_pair
[
0
],
shm_file
);
exit
(
0
);
}
close
(
socket_pair
[
0
]);
...
...
@@ -142,13 +146,13 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
T_socket
=
s
;
/* setup shared memory */
T_shm_fd
=
shm_open
(
T_SHM_FILENAME
,
O_RDWR
/*| O_SYNC*/
,
0666
);
shm_unlink
(
T_SHM_FILENAME
);
if
(
T_shm_fd
==
-
1
)
{
perror
(
T_SHM_FILENAME
);
abort
();
}
T_shm_fd
=
shm_open
(
shm_file
,
O_RDWR
/*| O_SYNC*/
,
0666
);
shm_unlink
(
shm_file
);
if
(
T_shm_fd
==
-
1
)
{
perror
(
shm_file
);
abort
();
}
T_cache
=
mmap
(
NULL
,
T_CACHE_SIZE
*
sizeof
(
T_cache_t
),
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
,
T_shm_fd
,
0
);
if
(
T_cache
==
NULL
)
{
perror
(
T_SHM_FILENAME
);
abort
();
}
if
(
T_cache
==
MAP_FAILED
)
{
perror
(
shm_file
);
abort
();
}
close
(
T_shm_fd
);
new_thread
(
T_receive_thread
,
NULL
);
...
...
This diff is collapsed.
Click to expand it.
common/utils/T/local_tracer.c
+
8
−
8
View file @
bdda7643
...
...
@@ -340,17 +340,17 @@ static void wait_message(void)
while
(
T_local_cache
[
T_busylist_head
].
busy
==
0
)
usleep
(
1000
);
}
static
void
init_shm
(
void
)
static
void
init_shm
(
char
*
shm_file
)
{
int
i
;
int
s
=
shm_open
(
T_SHM_FILENAME
,
O_RDWR
|
O_CREAT
/*| O_SYNC*/
,
0666
);
if
(
s
==
-
1
)
{
perror
(
T_SHM_FILENAME
);
abort
();
}
int
s
=
shm_open
(
shm_file
,
O_RDWR
|
O_CREAT
/*| O_SYNC*/
,
0666
);
if
(
s
==
-
1
)
{
perror
(
shm_file
);
abort
();
}
if
(
ftruncate
(
s
,
T_CACHE_SIZE
*
sizeof
(
T_cache_t
)))
{
perror
(
T_SHM_FILENAME
);
abort
();
}
{
perror
(
shm_file
);
abort
();
}
T_local_cache
=
mmap
(
NULL
,
T_CACHE_SIZE
*
sizeof
(
T_cache_t
),
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
,
s
,
0
);
if
(
T_local_cache
==
NULL
)
{
perror
(
T_SHM_FILENAME
);
abort
();
}
if
(
T_local_cache
==
MAP_FAILED
)
{
perror
(
shm_file
);
abort
();
}
close
(
s
);
/* let's garbage the memory to catch some potential problems
...
...
@@ -361,7 +361,7 @@ static void init_shm(void)
}
void
T_local_tracer_main
(
int
remote_port
,
int
wait_for_tracer
,
int
local_socket
)
int
local_socket
,
char
*
shm_file
)
{
int
s
;
int
port
=
remote_port
;
...
...
@@ -371,7 +371,7 @@ void T_local_tracer_main(int remote_port, int wait_for_tracer,
/* write on a socket fails if the other end is closed and we get SIGPIPE */
if
(
signal
(
SIGPIPE
,
SIG_IGN
)
==
SIG_ERR
)
abort
();
init_shm
();
init_shm
(
shm_file
);
s
=
local_socket
;
if
(
dont_wait
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment