Logo AND Algorithmique Numérique Distribuée

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