Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
merge
[simgrid.git] / examples / msg / io-file / io-file.c
index c72e615..f5fdb14 100644 (file)
@@ -1,20 +1,8 @@
-/* Copyright (c) 2008-2010, 2012-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2008-2016. 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. */
 
-/** @addtogroup MSG_examples
- * 
- * @subsection MSG_ex_resources Other resource kinds
- * 
- * This section contains some sparse examples of how to use the other
- * kind of resources, such as disk or GPU. These resources are quite
- * experimental for now, but here we go anyway.
- * 
- * - <b>io/file.c</b> Example with the disk resource
- */
-
 #define FILENAME1 "/home/doc/simgrid/examples/platforms/g5k.xml"
 #define FILENAME2 "c:\\Windows\\setupact.log"
 #define FILENAME3 "/home/doc/simgrid/examples/platforms/g5k_cabinets.xml"
@@ -85,9 +73,13 @@ static int host(int argc, char *argv[])
   XBT_INFO("\tCapacity of the storage element '%s' is stored on: %llu / %llu",
             filename, MSG_storage_get_used_size(st), MSG_storage_get_size(st));
 
-  XBT_INFO("\tClose file '%s'",filename);
-  MSG_file_close(file);
-
+  if(!strcmp(MSG_process_get_name(MSG_process_self()),"0")){
+    XBT_INFO("\tUnlink file '%s'",MSG_file_get_name(file));
+    MSG_file_unlink(file);
+  } else {
+    XBT_INFO("\tClose file '%s'",filename);
+    MSG_file_close(file);
+  }
   return 0;
 }