# HG changeset patch # User Paul Boddie # Date 1678115063 -3600 # Node ID f1c4592015e304fb98cec211d969964cd8681eff # Parent 86fe98e135bc9f362d8fb33a1fd143b6ae6d72dc Added a convenience function for unmapping capabilities from tasks. diff -r 86fe98e135bc -r f1c4592015e3 libipc/include/ipc/map.h --- a/libipc/include/ipc/map.h Mon Mar 06 00:14:52 2023 +0100 +++ b/libipc/include/ipc/map.h Mon Mar 06 16:04:23 2023 +0100 @@ -1,7 +1,7 @@ /* * Capability mapping between tasks. * - * Copyright (C) 2022 Paul Boddie + * Copyright (C) 2022, 2023 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -38,6 +38,8 @@ long ipc_map_capabilities(l4_cap_idx_t task, struct ipc_mapped_cap mapped_caps[], unsigned int *count); +long ipc_unmap_capability(l4_cap_idx_t task, l4_cap_idx_t mapped_cap); + EXTERN_C_END /* vim: tabstop=2 expandtab shiftwidth=2 diff -r 86fe98e135bc -r f1c4592015e3 libipc/lib/src/map.c --- a/libipc/lib/src/map.c Mon Mar 06 00:14:52 2023 +0100 +++ b/libipc/lib/src/map.c Mon Mar 06 16:04:23 2023 +0100 @@ -1,7 +1,7 @@ /* * Capability mapping between tasks. * - * Copyright (C) 2022 Paul Boddie + * Copyright (C) 2022, 2023 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -55,4 +55,13 @@ return err; } +/* Unmap a capability from another task. */ + +long ipc_unmap_capability(l4_cap_idx_t task, l4_cap_idx_t mapped_cap) +{ + return l4_error(l4_task_unmap(task, + l4_obj_fpage(mapped_cap, 0, L4_CAP_FPAGE_RWSD), + L4_FP_ALL_SPACES)); +} + // vim: tabstop=2 expandtab shiftwidth=2