Logo AND Algorithmique Numérique Distribuée

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