diff options
author | neal <neal> | 2008-06-24 15:45:12 +0000 |
---|---|---|
committer | neal <neal> | 2008-06-24 15:45:12 +0000 |
commit | a6ab6d27374e2ff11d0602133917b7a92f7d6faa (patch) | |
tree | 52da757d2dddc20521b3e089957e856ca89bf86c | |
parent | 0d99d4c662383e345a7eb4bf37918eb1c39b3bc1 (diff) |
2008-06-24 Neal H. Walfield <neal@gnu.org>
* server.c (server_loop): In the implementation of cap_discard, if
cap_to_object_soft fails, only return ENOENT if the version does
not match. If the object is not in memory, still clear the
content bit. Don't forget to free the memory.
-rw-r--r-- | viengoos/ChangeLog | 7 | ||||
-rw-r--r-- | viengoos/server.c | 43 |
2 files changed, 41 insertions, 9 deletions
diff --git a/viengoos/ChangeLog b/viengoos/ChangeLog index d43a8be..75cdc54 100644 --- a/viengoos/ChangeLog +++ b/viengoos/ChangeLog @@ -1,5 +1,12 @@ 2008-06-24 Neal H. Walfield <neal@gnu.org> + * server.c (server_loop): In the implementation of cap_discard, if + cap_to_object_soft fails, only return ENOENT if the version does + not match. If the object is not in memory, still clear the + content bit. Don't forget to free the memory. + +2008-06-24 Neal H. Walfield <neal@gnu.org> + * viengoos.c (main): Move assert from here... * object.c (object_init): ... to here. Use build_asserts, not asserts to check object sizes. diff --git a/viengoos/server.c b/viengoos/server.c index f4be1d3..f2bf6e2 100644 --- a/viengoos/server.c +++ b/viengoos/server.c @@ -1102,21 +1102,46 @@ server_loop (void) if (cap_type_weak_p (cap.type)) REPLY (EPERM); + struct folio *folio; + int offset; + struct object *object = cap_to_object_soft (principal, &cap); - if (! object) - REPLY (ENOENT); + if (object) + { + struct object_desc *desc = object_to_object_desc (object); - struct object_desc *desc = object_to_object_desc (object); + folio = objects_folio (principal, object); + offset = objects_folio_offset (object); + + ACTIVITY_STATS (desc->activity)->discarded ++; + + memory_object_destroy (principal, object); + memory_frame_free ((uintptr_t) object); - struct folio *folio = objects_folio (principal, object); - int offset = objects_folio_offset (object); + /* Consistent with the API, we do NOT set the discarded + bit. */ - ACTIVITY_STATS (desc->activity)->discarded ++; + folio_object_content_set (folio, offset, false); - memory_object_destroy (principal, object); + assertx (! cap_to_object_soft (principal, &cap), + ADDR_FMT ": " CAP_FMT, + ADDR_PRINTF (object_addr), CAP_PRINTF (&cap)); + } + else + /* The object is not in memory, however, we can still + clear it's content bit. */ + { + offset = (cap.oid % (1 + FOLIO_OBJECTS)) - 1; + oid_t foid = cap.oid - offset - 1; + + folio = (struct folio *) + object_find (activity, foid, OBJECT_POLICY_VOID); + + if (folio_object_version (folio, offset) != cap.version) + /* Or not, seems the object is gone! */ + REPLY (ENOENT); + } - /* Consistent with the API, we do NOT set the discarded - bit. */ folio_object_content_set (folio, offset, false); rm_object_discard_reply_marshal (&msg); |