[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 85/87: mach-defpager: use protected payloads for object lookups
From: |
Samuel Thibault |
Subject: |
[hurd] 85/87: mach-defpager: use protected payloads for object lookups |
Date: |
Sun, 09 Nov 2014 11:05:07 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 282e4ae275dc1b9b0b5bba6eb1b145cd1e80fa33
Author: Justus Winter <address@hidden>
Date: Fri Mar 14 00:29:02 2014 +0100
mach-defpager: use protected payloads for object lookups
* mach-defpager/default_pager.c (pager_port_list_insert): Set
protected payload.
(pager_port_list_delete): Clear protected payload.
* mach-defpager/mig-decls.h (begin_using_default_pager_payload): New
function.
* mach-defpager/mig-mutate.h: Add mutator.
---
mach-defpager/default_pager.c | 9 +++++++++
mach-defpager/mig-decls.h | 6 ++++++
mach-defpager/mig-mutate.h | 3 +++
3 files changed, 18 insertions(+)
diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c
index d40a9c9..831ed96 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 8118d61..3357aa2 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 54aeeba..31acaa6 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";
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 20/87: libdiskfs: avoid implicit integer conversion, (continued)
- [hurd] 20/87: libdiskfs: avoid implicit integer conversion, Samuel Thibault, 2014/11/09
- [hurd] 67/87: procfs: implement /proc/N/maps, Samuel Thibault, 2014/11/09
- [hurd] 69/87: procfs: do not test whether /hurd/mtab exists, Samuel Thibault, 2014/11/09
- [hurd] 16/87: libnetfs: fix memory leak, Samuel Thibault, 2014/11/09
- [hurd] 13/87: Fix buffer allocation on io_read, Samuel Thibault, 2014/11/09
- [hurd] 77/87: pfinet: fix path in comment, Samuel Thibault, 2014/11/09
- [hurd] 76/87: libports: lock-less reference counting for port_info objects, Samuel Thibault, 2014/11/09
- [hurd] 81/87: Fix unlocking translator list, Samuel Thibault, 2014/11/09
- [hurd] 63/87: Update NEWS file, Samuel Thibault, 2014/11/09
- [hurd] 09/87: Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/hurd, Samuel Thibault, 2014/11/09
- [hurd] 85/87: mach-defpager: use protected payloads for object lookups,
Samuel Thibault <=
- [hurd] 87/87: Merge remote-tracking branch 'upstream/master' into upstream, Samuel Thibault, 2014/11/09
- [hurd] 12/87: build: Remove checks for 'getgrouplist' and 'uselocale'., Samuel Thibault, 2014/11/09
- [hurd] 10/87: libstore: provide function declaration until available upstream, Samuel Thibault, 2014/11/09
- [hurd] 01/87: Do not include the terminating zero in /proc/slabinfo, Samuel Thibault, 2014/11/09
- [hurd] 06/87: libdiskfs: remove the statistics code from the name cache, Samuel Thibault, 2014/11/09
- [hurd] 84/87: Fix optional definitions in static binaries, Samuel Thibault, 2014/11/09
- [hurd] 03/87: libnetfs: add netfs_make_node_alloc to allocate fat nodes, Samuel Thibault, 2014/11/09
- [hurd] 72/87: libports: use a global hash table for the lookups, Samuel Thibault, 2014/11/09
- [hurd] 08/87: Disable linking when cross-compiling, Samuel Thibault, 2014/11/09
- [hurd] 04/87: trans/fakeroot: use fat nodes to simplify the node cache, Samuel Thibault, 2014/11/09