diff options
-rw-r--r-- | mach-defpager/default_pager.c | 9 | ||||
-rw-r--r-- | mach-defpager/mig-decls.h | 6 | ||||
-rw-r--r-- | mach-defpager/mig-mutate.h | 3 |
3 files changed, 18 insertions, 0 deletions
diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c index d40a9c92..831ed968 100644 --- a/mach-defpager/default_pager.c +++ b/mach-defpager/default_pager.c @@ -1803,6 +1803,12 @@ void pager_port_list_insert(port, ds) (hurd_ihash_key_t) port, (hurd_ihash_value_t) ds); pthread_mutex_unlock(&all_pagers.lock); + + /* Try to set a protected payload. This is an optimization, + if it fails we degrade gracefully. */ + mach_port_set_protected_payload (mach_task_self (), + port, + (unsigned long) ds); } void pager_port_list_delete(ds) @@ -1812,6 +1818,9 @@ void pager_port_list_delete(ds) hurd_ihash_locp_remove (&all_pagers.htable, ds->htable_locp); pthread_mutex_unlock(&all_pagers.lock); + + mach_port_clear_protected_payload (mach_task_self (), + ds->pager); } /* diff --git a/mach-defpager/mig-decls.h b/mach-defpager/mig-decls.h index 8118d61a..3357aa2e 100644 --- a/mach-defpager/mig-decls.h +++ b/mach-defpager/mig-decls.h @@ -31,4 +31,10 @@ begin_using_default_pager (mach_port_t port) (hurd_ihash_key_t) port); } +static inline struct dstruct * __attribute__ ((unused)) +begin_using_default_pager_payload (unsigned long payload) +{ + return (default_pager_t) payload; +} + #endif /* __MACH_DEFPAGER_MIG_DECLS_H__ */ diff --git a/mach-defpager/mig-mutate.h b/mach-defpager/mig-mutate.h index 54aeeba6..31acaa6e 100644 --- a/mach-defpager/mig-mutate.h +++ b/mach-defpager/mig-mutate.h @@ -18,5 +18,8 @@ along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ #define MEMORY_OBJECT_INTRAN default_pager_t begin_using_default_pager (mach_port_t) +#define MEMORY_OBJECT_INTRAN_PAYLOAD \ + default_pager_t begin_using_default_pager_payload + #define MEMORY_OBJECT_IMPORTS import "mig-decls.h"; #define DEFAULT_PAGER_IMPORTS import "mig-decls.h"; |