L4Re/departure

Changeset

500:f1c4592015e3
2023-03-06 Paul Boddie raw files shortlog changelog graph Added a convenience function for unmapping capabilities from tasks.
libipc/include/ipc/map.h (file) libipc/lib/src/map.c (file)
     1.1 --- a/libipc/include/ipc/map.h	Mon Mar 06 00:14:52 2023 +0100
     1.2 +++ b/libipc/include/ipc/map.h	Mon Mar 06 16:04:23 2023 +0100
     1.3 @@ -1,7 +1,7 @@
     1.4  /*
     1.5   * Capability mapping between tasks.
     1.6   *
     1.7 - * Copyright (C) 2022 Paul Boddie <paul@boddie.org.uk>
     1.8 + * Copyright (C) 2022, 2023 Paul Boddie <paul@boddie.org.uk>
     1.9   *
    1.10   * This program is free software; you can redistribute it and/or
    1.11   * modify it under the terms of the GNU General Public License as
    1.12 @@ -38,6 +38,8 @@
    1.13  long ipc_map_capabilities(l4_cap_idx_t task, struct ipc_mapped_cap mapped_caps[],
    1.14                            unsigned int *count);
    1.15  
    1.16 +long ipc_unmap_capability(l4_cap_idx_t task, l4_cap_idx_t mapped_cap);
    1.17 +
    1.18  EXTERN_C_END
    1.19  
    1.20  /* vim: tabstop=2 expandtab shiftwidth=2
     2.1 --- a/libipc/lib/src/map.c	Mon Mar 06 00:14:52 2023 +0100
     2.2 +++ b/libipc/lib/src/map.c	Mon Mar 06 16:04:23 2023 +0100
     2.3 @@ -1,7 +1,7 @@
     2.4  /*
     2.5   * Capability mapping between tasks.
     2.6   *
     2.7 - * Copyright (C) 2022 Paul Boddie <paul@boddie.org.uk>
     2.8 + * Copyright (C) 2022, 2023 Paul Boddie <paul@boddie.org.uk>
     2.9   *
    2.10   * This program is free software; you can redistribute it and/or
    2.11   * modify it under the terms of the GNU General Public License as
    2.12 @@ -55,4 +55,13 @@
    2.13    return err;
    2.14  }
    2.15  
    2.16 +/* Unmap a capability from another task. */
    2.17 +
    2.18 +long ipc_unmap_capability(l4_cap_idx_t task, l4_cap_idx_t mapped_cap)
    2.19 +{
    2.20 +  return l4_error(l4_task_unmap(task,
    2.21 +                                l4_obj_fpage(mapped_cap, 0, L4_CAP_FPAGE_RWSD),
    2.22 +                                L4_FP_ALL_SPACES));
    2.23 +}
    2.24 +
    2.25  // vim: tabstop=2 expandtab shiftwidth=2