A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Use 0 to indicate an invalid PID instead of -1. Someone may consider it unsigned...
[simgrid.git]
/
src
/
msg
/
m_process.c
diff --git
a/src/msg/m_process.c
b/src/msg/m_process.c
index
6e025d3
..
7e71699
100644
(file)
--- a/
src/msg/m_process.c
+++ b/
src/msg/m_process.c
@@
-134,7
+134,7
@@
void MSG_process_kill(m_process_t process)
{
simdata_process_t p_simdata = process->simdata;
- DEBUG3("Killing %s(%
l
d) on %s",process->name, p_simdata->PID, p_simdata->host->name);
+ DEBUG3("Killing %s(%d) on %s",process->name, p_simdata->PID, p_simdata->host->name);
if(p_simdata->waiting_task) {
DEBUG1("Canceling waiting task %s",p_simdata->waiting_task->name);
@@
-215,7
+215,7
@@
m_host_t MSG_process_get_host(m_process_t process)
whose PID is equal to \a PID. If no host is found, \c NULL is returned.
Note that the PID are uniq in the whole simulation, not only on a given host.
*/
-m_process_t MSG_process_from_PID(
long
int PID)
+m_process_t MSG_process_from_PID(int PID)
{
xbt_fifo_item_t i = NULL;
m_process_t process = NULL;
@@
-230,11
+230,14
@@
m_process_t MSG_process_from_PID(long int PID)
* \brief Returns the process ID of \a process.
*
* This functions checks whether \a process is a valid pointer or not
- and return its PID.
+ and return its PID
(or 0 in case of problem)
.
*/
-
long
int MSG_process_get_PID(m_process_t process)
+int MSG_process_get_PID(m_process_t process)
{
- xbt_assert0(((process != NULL) && (process->simdata)), "Invalid parameters");
+ /* Do not raise an exception here: this function is used in the logs,
+ and it will be called back by the exception handling stuff */
+ if (process == NULL || process->simdata == NULL)
+ return 0;
return (((simdata_process_t) process->simdata)->PID);
}
@@
-246,7
+249,7
@@
long int MSG_process_get_PID(m_process_t process)
and return its PID. Returns -1 if the agent has not been created by
another agent.
*/
-
long
int MSG_process_get_PPID(m_process_t process)
+int MSG_process_get_PPID(m_process_t process)
{
xbt_assert0(((process != NULL) && (process->simdata)), "Invalid parameters");
@@
-271,7
+274,7
@@
const char *MSG_process_get_name(m_process_t process)
*
* This functions returns the PID of the currently running #m_process_t.
*/
-
long
int MSG_process_self_PID(void)
+int MSG_process_self_PID(void)
{
return (MSG_process_get_PID(MSG_process_self()));
}
@@
-282,7
+285,7
@@
long int MSG_process_self_PID(void)
* This functions returns the PID of the parent of the currently
* running #m_process_t.
*/
-
long
int MSG_process_self_PPID(void)
+int MSG_process_self_PPID(void)
{
return (MSG_process_get_PPID(MSG_process_self()));
}