Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG UE
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
Michael Black
OpenXG UE
Commits
ec3c3a95
Commit
ec3c3a95
authored
May 15, 2018
by
Cedric Roux
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/fixes-T-tracer-2018-w17' into develop_integration_2018_w19
parents
2dc987e8
4d50de20
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
15 deletions
+19
-15
common/utils/T/T.c
common/utils/T/T.c
+11
-7
common/utils/T/local_tracer.c
common/utils/T/local_tracer.c
+8
-8
No files found.
common/utils/T/T.c
View file @
ec3c3a95
...
...
@@ -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
);
...
...
common/utils/T/local_tracer.c
View file @
ec3c3a95
...
...
@@ -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
)
{
...
...
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