Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
d0c34e8c48b0565375e7504cff91b3ded63883b4
[simgrid.git] / include / gras / virtu.h
1 /* $Id$                    */
2
3 /* gras/virtu.h - public interface to virtualization (cross-OS portability) */
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 #ifndef GRAS_VIRTU_H
11 #define GRAS_VIRTU_H
12
13 #include "xbt/misc.h"           /* SG_BEGIN_DECL */
14 #include "xbt/time.h"
15 #include "xbt/dict.h"
16
17 SG_BEGIN_DECL()
18
19 /* Initialization of the simulation world. Do not call them in RL. 
20    Indeed, do not call them at all. Let gras_stub_generator do it for you. */
21      void gras_global_init(int *argc, char **argv);
22      void gras_create_environment(const char *file);
23      void gras_function_register(const char *name, xbt_main_func_t code);
24      void gras_launch_application(const char *file);
25      void gras_clean(void);
26      void gras_main(void);
27
28
29 /** @addtogroup GRAS_virtu  
30  *  @brief System call abstraction layer.
31  *
32  *
33  *  @{
34  */
35
36 /** @brief Get the current time
37  *  @return number of second since the Epoch.
38  *  (00:00:00 UTC, January 1, 1970 in Real Life, and begining of simulation in SG)
39  */
40 #define gras_os_time() xbt_time()
41 /** @brief sleeps for the given amount of time.
42  *  @param sec: number of seconds to sleep
43  */
44 #define gras_os_sleep(sec) xbt_sleep(sec)
45 /** @brief get the fully-qualified name of the current host
46  *
47  * Returns the fully-qualified name of the host machine, or "localhost" if the name
48  * cannot be determined.  Always returns the same value, so multiple calls
49  * cause no problems.
50  */
51 XBT_PUBLIC(const char *) gras_os_myname(void);
52
53 /** @brief returns the number on which this process is listening for incoming messages */
54 XBT_PUBLIC(int) gras_os_myport(void);
55
56 /** @brief get the uri of the current process
57  *
58  * Returns the concatenation of gras_os_myname():gras_os_myport(). Please do not free the result.
59  */
60 XBT_PUBLIC(const char *) gras_os_hostport(void);
61
62 /** @brief get process identification
63  *
64  * Returns the process ID of the current process.  (This is often used
65    by routines that generate unique temporary file names.)
66  */
67 XBT_PUBLIC(int) gras_os_getpid(void);
68
69
70 /* Properties related */
71 XBT_PUBLIC(xbt_dict_t) gras_process_properties(void);
72 XBT_PUBLIC(const char *) gras_process_property_value(const char *name);
73
74 XBT_PUBLIC(xbt_dict_t) gras_os_host_properties(void);
75 XBT_PUBLIC(const char *) gras_os_host_property_value(const char *name);
76
77 /** @} */
78 SG_END_DECL()
79 #endif /* GRAS_VIRTU_H */