Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
use xbt_os_time
[simgrid.git] / src / gras / Virtu / rl_process.c
1 /* $Id$ */
2
3 /* process_rl - GRAS process handling on real life                          */
4
5 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved.            */
6
7 /* This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. */
9
10 #include "gras_modinter.h" /* module initialization interface */
11 #include "gras/Virtu/virtu_rl.h"
12 #include "portable.h"
13
14 XBT_LOG_EXTERNAL_CATEGORY(process);
15 XBT_LOG_DEFAULT_CATEGORY(process);
16
17 /* globals */
18 static gras_procdata_t *_gras_procdata = NULL;
19 char const *_gras_procname = NULL;
20
21 xbt_error_t gras_process_init() {
22   _gras_procdata=xbt_new(gras_procdata_t,1);
23   gras_procdata_init();
24   return no_error;
25 }
26 xbt_error_t gras_process_exit() {
27   gras_procdata_exit();
28   free(_gras_procdata);
29   return no_error;
30 }
31
32 const char *xbt_procname(void) {
33   if(_gras_procname) return _gras_procname;
34   else return "(null)";
35 }
36
37 int gras_os_getpid(void) {
38   return getpid();
39 }
40
41 /* **************************************************************************
42  * Process data
43  * **************************************************************************/
44
45 gras_procdata_t *gras_procdata_get(void) {
46   xbt_assert0(_gras_procdata,"Run gras_process_init (ie, gras_init)!");
47
48   return _gras_procdata;
49 }