X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/bf99bcb79b0e9e19c8a5d1b5d447d86a349ba2f5..53cde8dfb94134348e908b3c2845200ffc582dc7:/src/gras/Virtu/sg_process.c diff --git a/src/gras/Virtu/sg_process.c b/src/gras/Virtu/sg_process.c index 1ea5b265f3..1841604c5c 100644 --- a/src/gras/Virtu/sg_process.c +++ b/src/gras/Virtu/sg_process.c @@ -28,7 +28,7 @@ void gras_agent_spawn(const char *name, { smx_process_t process; - SIMIX_req_process_create(&process, name, code, NULL, + simcall_process_create(&process, name, code, NULL, gras_os_myname(), argc, argv, properties); } @@ -38,6 +38,7 @@ void gras_agent_spawn(const char *name, void gras_process_init() { + smx_process_t self = SIMIX_process_self(); gras_hostdata_t *hd = (gras_hostdata_t *) SIMIX_host_self_get_data(); gras_procdata_t *pd = xbt_new0(gras_procdata_t, 1); @@ -54,21 +55,21 @@ void gras_process_init() hd->refcount++; } - SIMIX_process_self_set_data((void *) pd); + SIMIX_process_self_set_data(self, (void *) pd); gras_procdata_init(); trp_pd = (gras_trp_procdata_t) gras_libdata_by_name("gras_trp"); pd->pid = pid; - if (SIMIX_process_self() != NULL) { + if (self != NULL) { pd->ppid = gras_os_getpid(); } else pd->ppid = -1; - trp_pd->msg_selectable_sockets = xbt_queue_new(0, sizeof(gras_socket_t)); + trp_pd->msg_selectable_sockets = xbt_queue_new(0, sizeof(xbt_socket_t)); trp_pd->meas_selectable_sockets = - xbt_queue_new(0, sizeof(gras_socket_t)); + xbt_queue_new(0, sizeof(xbt_socket_t)); XBT_VERB("Creating process '%s' (%d)", SIMIX_process_self_get_name(), gras_os_getpid()); @@ -78,12 +79,12 @@ void gras_process_exit() { xbt_dynar_t sockets = ((gras_trp_procdata_t) gras_libdata_by_name("gras_trp"))->sockets; - gras_socket_t sock_iter; + xbt_socket_t sock_iter; unsigned int cursor; gras_hostdata_t *hd = (gras_hostdata_t *) SIMIX_host_self_get_data(); gras_procdata_t *pd = - (gras_procdata_t *) SIMIX_req_process_get_data(SIMIX_process_self()); + (gras_procdata_t *) simcall_process_get_data(SIMIX_process_self()); gras_msg_procdata_t msg_pd = (gras_msg_procdata_t) gras_libdata_by_name("gras_msg"); @@ -98,20 +99,20 @@ void gras_process_exit() xbt_assert(hd, "Run gras_process_init (ie, gras_init)!!"); XBT_VERB("GRAS: Finalizing process '%s' (%d)", - SIMIX_req_process_get_name(SIMIX_process_self()), gras_os_getpid()); + simcall_process_get_name(SIMIX_process_self()), gras_os_getpid()); - if (xbt_dynar_length(msg_pd->msg_queue)) { + if (!xbt_dynar_is_empty(msg_pd->msg_queue)) { unsigned int cpt; s_gras_msg_t msg; XBT_WARN - ("process %d terminated, but %ld messages are still queued. Message list:", + ("process %d terminated, but %lu messages are still queued. Message list:", gras_os_getpid(), xbt_dynar_length(msg_pd->msg_queue)); xbt_dynar_foreach(msg_pd->msg_queue, cpt, msg) { XBT_WARN(" Message %s (%s) from %s@%s:%d", msg.type->name, e_gras_msg_kind_names[msg.kind], - gras_socket_peer_proc(msg.expe), - gras_socket_peer_name(msg.expe), - gras_socket_peer_port(msg.expe)); + xbt_socket_peer_proc(msg.expe), + xbt_socket_peer_name(msg.expe), + xbt_socket_peer_port(msg.expe)); } } @@ -137,7 +138,7 @@ void gras_process_exit() gras_procdata_t *gras_procdata_get(void) { gras_procdata_t *pd = - (gras_procdata_t *) SIMIX_req_process_get_data(SIMIX_process_self()); + (gras_procdata_t *) simcall_process_get_data(SIMIX_process_self()); xbt_assert(pd, "Run gras_process_init! (ie, gras_init)"); @@ -146,12 +147,12 @@ gras_procdata_t *gras_procdata_get(void) void *gras_libdata_by_name_from_remote(const char *name, smx_process_t p) { - gras_procdata_t *pd = (gras_procdata_t *) SIMIX_req_process_get_data(p); + gras_procdata_t *pd = (gras_procdata_t *) simcall_process_get_data(p); xbt_assert(pd, "process '%s' on '%s' didn't run gras_process_init! (ie, gras_init)", - SIMIX_req_process_get_name(p), - SIMIX_req_host_get_name(SIMIX_req_process_get_host(p))); + simcall_process_get_name(p), + simcall_host_get_name(simcall_process_get_host(p))); return gras_libdata_by_name_from_procdata(name, pd); } @@ -159,7 +160,7 @@ void *gras_libdata_by_name_from_remote(const char *name, smx_process_t p) /** @brief retrieve the value of a given process property (or NULL if not defined) */ const char *gras_process_property_value(const char *name) { - return xbt_dict_get_or_null(SIMIX_req_process_get_properties + return xbt_dict_get_or_null(simcall_process_get_properties (SIMIX_process_self()), name); } @@ -168,7 +169,7 @@ const char *gras_process_property_value(const char *name) */ xbt_dict_t gras_process_properties(void) { - return SIMIX_req_process_get_properties(SIMIX_process_self()); + return simcall_process_get_properties(SIMIX_process_self()); } /* ************************************************************************** @@ -179,7 +180,7 @@ xbt_dict_t gras_process_properties(void) int gras_os_getpid(void) { gras_procdata_t *data; - data = (gras_procdata_t *) SIMIX_process_self_get_data(); + data = (gras_procdata_t *) SIMIX_process_self_get_data(SIMIX_process_self()); if (data != NULL) return data->pid; @@ -190,8 +191,8 @@ int gras_os_getpid(void) const char *gras_os_host_property_value(const char *name) { return - xbt_dict_get_or_null(SIMIX_req_host_get_properties - (SIMIX_req_process_get_host(SIMIX_process_self())), + xbt_dict_get_or_null(simcall_host_get_properties + (simcall_process_get_host(SIMIX_process_self())), name); } @@ -201,7 +202,7 @@ const char *gras_os_host_property_value(const char *name) xbt_dict_t gras_os_host_properties(void) { return - SIMIX_req_host_get_properties(SIMIX_req_process_get_host + simcall_host_get_properties(simcall_process_get_host (SIMIX_process_self())); }