summaryrefslogtreecommitdiff
path: root/viengoos/rm.h
blob: 04e2a06496d09a0bbc0f377c4e96db1fe4bf1a9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* rm.h - Resource manager interface.
   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
   Written by Neal H. Walfield <neal@gnu.org>.

   This file is part of the GNU Hurd.

   The GNU Hurd is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; either version 3 of the
   License, or (at your option) any later version.

   The GNU Hurd is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see
   <http://www.gnu.org/licenses/>.  */

#ifndef RM_RM_H
#define RM_RM_H

#include <hurd/startup.h>
#include <hurd/folio.h>
#include <hurd/exceptions.h>
#include <hurd/thread.h>
#include <hurd/activity.h>
#include <hurd/futex.h>

enum rm_method_id
  {
    RM_write = 100,
    RM_as_dump,
  };

static inline const char *
rm_method_id_string (int id)
{
  switch (id)
    {
    case RM_write:
      return "write";
    case RM_as_dump:
      return "as_dump";
    case RM_folio_alloc:
      return "folio_alloc";
    case RM_folio_free:
      return "folio_free";
    case RM_folio_object_alloc:
      return "folio_object_alloc";
    case RM_cap_copy:
      return "cap_copy";
    case RM_cap_rubout:
      return "cap_rubout";
    case RM_cap_read:
      return "cap_read";
    case RM_object_slot_copy_out:
      return "object_slot_copy_out";
    case RM_object_slot_copy_in:
      return "object_slot_copy_in";
    case RM_object_slot_read:
      return "object_slot_read";
    case RM_object_discarded_clear:
      return "object_discarded_clear";
    case RM_object_discard:
      return "object_discard";
    case RM_object_status:
      return "object_status";
    case RM_object_name:
      return "object_name";
    case RM_exception_collect:
      return "exception_collect";
    case RM_thread_exregs:
      return "thread_exregs";
    case RM_thread_wait_object_destroyed:
      return "thread_wait_object_destroyed";
    case RM_activity_policy:
      return "activity_policy";
    case RM_activity_info:
      return "activity_info";
    case RM_futex:
      return "futex";
    default:
      return "unknown method id";
    }
}

#define RPC_STUB_PREFIX rm
#define RPC_ID_PREFIX RM
#undef RPC_TARGET_NEED_ARG
#define RPC_TARGET \
  ({ \
    extern struct hurd_startup_data *__hurd_startup_data; \
    __hurd_startup_data->rm; \
  })

#include <hurd/rpc.h>

struct io_buffer
{
  /* The length.  */
  unsigned char len;
  char data[127];
};

/* Echo the character CHR on the manager console.  */
RPC_SIMPLE(write, 1, 0, struct io_buffer, io)

/* Dump the address space rooted at ROOT.  */
RPC(as_dump, 2, 0, addr_t, principal, addr_t, root)

#endif