2 * \brief Client handling internals for the process manager.
4 * Copyright (c) 2017, ETH Zurich.
7 * This file is distributed under the terms in the attached LICENSE file.
8 * If you do not find this file, copies can be found by writing to:
9 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
12 #include <collections/hash_table.h>
15 #include "pending_clients.h"
17 static collections_hash_table* pending_clients_table = NULL;
19 errval_t pending_clients_add(struct capref domain_cap,
20 struct proc_mgmt_binding *b, enum ClientType type,
23 if (pending_clients_table == NULL) {
24 collections_hash_create_with_buckets(&pending_clients_table,
25 HASH_INDEX_BUCKETS, NULL);
26 if (pending_clients_table == NULL) {
27 return PROC_MGMT_ERR_CREATE_CLIENTS_TABLE;
32 errval_t err = domain_cap_hash(domain_cap, &key);
33 if (err_is_fail(err)) {
37 struct pending_client *client = (struct pending_client*) malloc(
38 sizeof(struct pending_client));
40 client->core_id = core_id;
42 collections_hash_insert(pending_clients_table, key, client);
47 errval_t pending_clients_release(struct capref domain_cap,
48 struct pending_client *ret_cl)
51 errval_t err = domain_cap_hash(domain_cap, &key);
52 if (err_is_fail(err)) {
56 void *table_entry = collections_hash_find(pending_clients_table, key);
57 if (table_entry == NULL) {
58 return PROC_MGMT_ERR_CLIENTS_TABLE_FIND;
61 *ret_cl = *((struct pending_client*) table_entry);
64 collections_hash_delete(pending_clients_table, key);