Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
0484dd20f1f83729b80b9876963fddc8f2d2b5c5
[simgrid.git] / src / mc / mc_model_checker.cpp
1 /* Copyright (c) 2008-2014. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include "mc_model_checker.h"
8 #include "mc_page_store.h"
9
10 extern "C" {
11
12 mc_model_checker_t mc_model_checker = NULL;
13
14 mc_model_checker_t MC_model_checker_new(pid_t pid, int socket)
15 {
16   mc_model_checker_t mc = xbt_new0(s_mc_model_checker_t, 1);
17   mc->pages = mc_pages_store_new();
18   mc->fd_clear_refs = -1;
19   mc->fd_pagemap = -1;
20   MC_process_init(&mc->process, pid, socket);
21   mc->hosts = xbt_dict_new();
22   return mc;
23 }
24
25 void MC_model_checker_delete(mc_model_checker_t mc)
26 {
27   mc_pages_store_delete(mc->pages);
28   if(mc->record)
29     xbt_dynar_free(&mc->record);
30   MC_process_clear(&mc->process);
31   xbt_dict_free(&mc->hosts);
32 }
33
34 unsigned long MC_smx_get_maxpid(void)
35 {
36   unsigned long maxpid;
37   MC_process_read_variable(&mc_model_checker->process, "simix_process_maxpid",
38     &maxpid, sizeof(maxpid));
39   return maxpid;
40 }
41
42 }