paul@491 | 1 | /* |
paul@491 | 2 | * Support for creating a new process. |
paul@491 | 3 | * |
paul@615 | 4 | * Copyright (C) 2022, 2023, 2024 Paul Boddie <paul@boddie.org.uk> |
paul@491 | 5 | * |
paul@491 | 6 | * This program is free software; you can redistribute it and/or |
paul@491 | 7 | * modify it under the terms of the GNU General Public License as |
paul@491 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@491 | 9 | * the License, or (at your option) any later version. |
paul@491 | 10 | * |
paul@491 | 11 | * This program is distributed in the hope that it will be useful, |
paul@491 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@491 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@491 | 14 | * GNU General Public License for more details. |
paul@491 | 15 | * |
paul@491 | 16 | * You should have received a copy of the GNU General Public License |
paul@491 | 17 | * along with this program; if not, write to the Free Software |
paul@491 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@491 | 19 | * Boston, MA 02110-1301, USA |
paul@491 | 20 | */ |
paul@491 | 21 | |
paul@491 | 22 | #pragma once |
paul@491 | 23 | |
paul@491 | 24 | #include <fsserver/simple_pager.h> |
paul@491 | 25 | |
paul@491 | 26 | #include "process_creator_context_object_interface.h" |
paul@491 | 27 | |
paul@491 | 28 | |
paul@491 | 29 | |
paul@491 | 30 | /* Forward declaration. */ |
paul@491 | 31 | |
paul@491 | 32 | class ProcessCreatorResource; |
paul@491 | 33 | |
paul@491 | 34 | |
paul@491 | 35 | |
paul@491 | 36 | /* A process creating context employing a simple pager to transfer process |
paul@491 | 37 | details. */ |
paul@491 | 38 | |
paul@491 | 39 | class ProcessCreatorContextResource : public SimplePager, |
paul@491 | 40 | public ProcessCreatorContextObject |
paul@491 | 41 | { |
paul@491 | 42 | protected: |
paul@491 | 43 | ProcessCreatorResource *_creator; |
paul@491 | 44 | |
paul@491 | 45 | public: |
paul@491 | 46 | explicit ProcessCreatorContextResource(ProcessCreatorResource *creator); |
paul@491 | 47 | |
paul@491 | 48 | virtual ~ProcessCreatorContextResource(); |
paul@491 | 49 | |
paul@491 | 50 | /* Server details. */ |
paul@491 | 51 | |
paul@491 | 52 | ipc_server_default_config_type config(); |
paul@491 | 53 | |
paul@491 | 54 | void *interface() |
paul@491 | 55 | { return static_cast<ProcessCreatorContextObject *>(this); } |
paul@491 | 56 | |
paul@491 | 57 | /* Process creator context interface methods. */ |
paul@491 | 58 | |
paul@615 | 59 | virtual long start(int argc, l4_cap_idx_t reader, l4_cap_idx_t writer, |
paul@615 | 60 | l4_cap_idx_t *process); |
paul@491 | 61 | |
paul@491 | 62 | /* Pager/dataspace methods. */ |
paul@491 | 63 | |
paul@491 | 64 | long map(offset_t offset, map_address_t hot_spot, map_flags_t flags, |
paul@491 | 65 | l4_snd_fpage_t *region) |
paul@491 | 66 | { return SimplePager::map(offset, hot_spot, flags, region); } |
paul@491 | 67 | |
paul@632 | 68 | long info(ds_stats_t *stats) |
paul@632 | 69 | { return SimplePager::info(stats); } |
paul@491 | 70 | }; |
paul@491 | 71 | |
paul@491 | 72 | /* vim: tabstop=2 expandtab shiftwidth=2 |
paul@491 | 73 | */ |