Logo AND Algorithmique Numérique Distribuée

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