Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill old $Id$ command dating from CVS
[simgrid.git] / src / gras / Virtu / sg_dns.c
1 /* sg_dns - name resolution (simulator)                                     */
2
3 /* Copyright (c) 2005 Martin Quinson. All rights reserved.                  */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8
9 #include "gras/Virtu/virtu_sg.h"
10
11 const char *gras_os_myname(void)
12 {
13   smx_host_t host;
14   smx_process_t process = SIMIX_process_self();
15
16   /*HACK: maestro used not have a simix process, now it does so 
17     SIMIX_process_self will return something different to NULL. This breaks
18     the old xbt_log logic that assumed that NULL was equivalent to maestro,
19     thus when printing it searches for maestro host name (which doesn't exists)
20     and breaks the logging.
21     As a hack we check for maestro by looking to the assigned host, if it is
22     NULL then we are sure is maestro
23   */
24   if (process != NULL && (host = SIMIX_host_self()) != NULL)
25       return SIMIX_host_get_name(host);
26  
27   return ""; 
28 }