X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/18d865e6985d7a5903eac874c8942b7001310625..488566dad1ae2b42f26a8e291824ff9b16a976f7:/src/gras/Virtu/sg_dns.c diff --git a/src/gras/Virtu/sg_dns.c b/src/gras/Virtu/sg_dns.c index 1d67ee49ae..9269b0eeef 100644 --- a/src/gras/Virtu/sg_dns.c +++ b/src/gras/Virtu/sg_dns.c @@ -1,8 +1,7 @@ -/* $Id$ */ - /* sg_dns - name resolution (simulator) */ -/* Copyright (c) 2005 Martin Quinson. All rights reserved. */ +/* Copyright (c) 2005, 2007, 2009, 2010. The SimGrid Team. + * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -10,6 +9,21 @@ #include "gras/Virtu/virtu_sg.h" -const char *gras_os_myname(void) { - return MSG_host_get_name(MSG_host_self()); +const char *gras_os_myname(void) +{ + smx_host_t host; + smx_process_t process = SIMIX_process_self(); + + /*HACK: maestro used not have a simix process, now it does so + SIMIX_process_self will return something different to NULL. This breaks + the old xbt_log logic that assumed that NULL was equivalent to maestro, + thus when printing it searches for maestro host name (which doesn't exists) + and breaks the logging. + As a hack we check for maestro by looking to the assigned host, if it is + NULL then we are sure is maestro + */ + if (process != NULL && (host = SIMIX_host_self()) != NULL) + return SIMIX_host_get_name(host); + + return ""; }