paul@65 | 1 | /* |
paul@65 | 2 | * Test pipe operations. |
paul@65 | 3 | * |
paul@65 | 4 | * Copyright (C) 2020, 2021 Paul Boddie <paul@boddie.org.uk> |
paul@65 | 5 | * |
paul@65 | 6 | * This program is free software; you can redistribute it and/or |
paul@65 | 7 | * modify it under the terms of the GNU General Public License as |
paul@65 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@65 | 9 | * the License, or (at your option) any later version. |
paul@65 | 10 | * |
paul@65 | 11 | * This program is distributed in the hope that it will be useful, |
paul@65 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@65 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@65 | 14 | * GNU General Public License for more details. |
paul@65 | 15 | * |
paul@65 | 16 | * You should have received a copy of the GNU General Public License |
paul@65 | 17 | * along with this program; if not, write to the Free Software |
paul@65 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@65 | 19 | * Boston, MA 02110-1301, USA |
paul@65 | 20 | */ |
paul@65 | 21 | |
paul@65 | 22 | #include <l4/sys/err.h> |
paul@65 | 23 | |
paul@65 | 24 | #include <stdio.h> |
paul@65 | 25 | |
paul@65 | 26 | #include "memory.h" |
paul@65 | 27 | #include "pipe_opener_resource.h" |
paul@65 | 28 | #include "resource_server.h" |
paul@65 | 29 | |
paul@65 | 30 | |
paul@65 | 31 | |
paul@65 | 32 | const unsigned int MEMORY_PAGES = 20; |
paul@65 | 33 | |
paul@65 | 34 | int main(void) |
paul@65 | 35 | { |
paul@65 | 36 | /* Some memory plus infrastructure. */ |
paul@65 | 37 | |
paul@65 | 38 | Memory mem(MEMORY_PAGES); |
paul@66 | 39 | PipeOpenerResource opener; |
paul@65 | 40 | |
paul@65 | 41 | /* Register a server associating it with the given object. */ |
paul@65 | 42 | |
paul@65 | 43 | ResourceServer server(&opener); |
paul@65 | 44 | long err = server.bind("server"); |
paul@65 | 45 | |
paul@65 | 46 | if (err) |
paul@65 | 47 | { |
paul@65 | 48 | printf("Could not bind server: %s\n", l4sys_errtostr(err)); |
paul@65 | 49 | return 1; |
paul@65 | 50 | } |
paul@65 | 51 | |
paul@65 | 52 | printf("Starting server...\n"); |
paul@65 | 53 | server.start(); |
paul@65 | 54 | return 0; |
paul@65 | 55 | } |