L4Re/departure

Annotated libexec/include/exec/process_monitor.h

652:e4d464fd40c1
6 months ago Paul Boddie Make more pages available to the block and filesystem servers. libc_newlib
paul@543 1
/*
paul@543 2
 * A process monitor abstraction.
paul@543 3
 *
paul@618 4
 * Copyright (C) 2022, 2023, 2024 Paul Boddie <paul@boddie.org.uk>
paul@543 5
 *
paul@543 6
 * This program is free software; you can redistribute it and/or
paul@543 7
 * modify it under the terms of the GNU General Public License as
paul@543 8
 * published by the Free Software Foundation; either version 2 of
paul@543 9
 * the License, or (at your option) any later version.
paul@543 10
 *
paul@543 11
 * This program is distributed in the hope that it will be useful,
paul@543 12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
paul@543 13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
paul@543 14
 * GNU General Public License for more details.
paul@543 15
 *
paul@543 16
 * You should have received a copy of the GNU General Public License
paul@543 17
 * along with this program; if not, write to the Free Software
paul@543 18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
paul@543 19
 * Boston, MA  02110-1301, USA
paul@543 20
 */
paul@543 21
paul@543 22
#pragma once
paul@543 23
paul@543 24
#include <fsserver/notification.h>
paul@543 25
#include <resource/resource.h>
paul@543 26
paul@543 27
#include "parent_notification_object_interface.h"
paul@543 28
paul@543 29
paul@543 30
paul@543 31
/* A process monitor receiving signals from a task. */
paul@543 32
paul@543 33
class ProcessMonitor : public ParentNotificationObject, public NotificationSupport,
paul@543 34
                       public Resource
paul@543 35
{
paul@543 36
protected:
paul@618 37
  bool _debug;
paul@543 38
paul@543 39
  /* Resources associated with the created process. */
paul@543 40
paul@543 41
  l4_cap_idx_t _pager = L4_INVALID_CAP, _mapped_pager = L4_INVALID_CAP,
paul@543 42
               _parent = L4_INVALID_CAP, _mapped_parent = L4_INVALID_CAP,
paul@543 43
               _task = L4_INVALID_CAP, _mapped_task = L4_INVALID_CAP,
paul@543 44
               _thread = L4_INVALID_CAP, _mapped_thread = L4_INVALID_CAP;
paul@543 45
paul@548 46
  /* Notification support. */
paul@548 47
paul@548 48
  l4_cap_idx_t _notifier = L4_INVALID_CAP;
paul@548 49
paul@543 50
public:
paul@618 51
  explicit ProcessMonitor(bool debug = false);
paul@543 52
paul@543 53
  /* Server details. */
paul@543 54
paul@543 55
  virtual ipc_server_default_config_type config();
paul@543 56
paul@543 57
  virtual void *interface()
paul@543 58
  { return static_cast<ParentNotificationObject *>(this); }
paul@543 59
paul@543 60
  /* Capability management. */
paul@543 61
paul@543 62
  virtual void set_pager(l4_cap_idx_t cap, l4_cap_idx_t mapped_cap);
paul@543 63
  virtual void set_parent(l4_cap_idx_t cap, l4_cap_idx_t mapped_cap);
paul@543 64
  virtual void set_task(l4_cap_idx_t cap, l4_cap_idx_t mapped_cap);
paul@543 65
  virtual void set_thread(l4_cap_idx_t cap, l4_cap_idx_t mapped_cap);
paul@543 66
paul@543 67
  /* Lifecycle management. */
paul@543 68
paul@543 69
  virtual void pager_ended();
paul@543 70
paul@543 71
  /* Resource methods. */
paul@543 72
paul@543 73
  virtual void close();
paul@543 74
paul@543 75
  /* Parent methods. */
paul@543 76
paul@543 77
  virtual long signal(unsigned long sig, unsigned long val);
paul@543 78
paul@543 79
  /* Notification methods. */
paul@543 80
paul@543 81
  virtual long subscribe(l4_cap_idx_t notifier, notify_flags_t flags);
paul@543 82
paul@548 83
  virtual long unsubscribe();
paul@543 84
};
paul@543 85
paul@543 86
/* vim: tabstop=2 expandtab shiftwidth=2
paul@543 87
*/