diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-11-27 23:49:56 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2012-11-27 23:53:01 +0000 |
commit | 33831f0ba604d4060d552a6c93f1d23b29672538 (patch) | |
tree | e7388bf7ce1b569fc2009275d0a1b00ec19ba3b3 /debian/patches | |
parent | b32f3bc9edfbbab5c250da92c451c6eb99a079cb (diff) |
New ustream snapshot
- Migrates everything to libpthread.
- Bump libc0.3-dev build dependency to get pthread_hurd_cond_wait.
- Break libthreads-based netdde.
- Remove install-msgids.diff, pflocal.patch,
runsystem_setup_pflocal.patch, makedev_keep_options.patch,
makedev_parted_store.patch, ext2fs_nowait.patch, libpager_deadlock.patch,
libdiskfs_self-reauth.patch, libdiskfs_sync.patch, merged upstream
- Refresh exec_filename_exec.patch, exec_filename_fs.patch,
ext2fs_large_stores.patch, external.patch, init_try_runsystem.gnu.patch,
libdde_workqueue.patch, libports_stability.patch, pfinet_dhcp.patch,
posix-sigcodes.patch, proxy-defpager.diff.
* New patch ext2fs_large_stores_pthread.patch to move ext2fs large store
support to pthread.
Diffstat (limited to 'debian/patches')
-rw-r--r-- | debian/patches/ext2fs_large_stores_pthread.patch | 20 | ||||
-rw-r--r-- | debian/patches/ext2fs_nowait.patch | 156 | ||||
-rw-r--r-- | debian/patches/install-msgids.diff | 38 | ||||
-rw-r--r-- | debian/patches/libdiskfs_self-reauth.patch | 34 | ||||
-rw-r--r-- | debian/patches/libdiskfs_sync.patch | 16 | ||||
-rw-r--r-- | debian/patches/libpager_deadlock.patch | 22 | ||||
-rw-r--r-- | debian/patches/makedev_keep_options.patch | 60 | ||||
-rw-r--r-- | debian/patches/makedev_parted_store.patch | 75 | ||||
-rw-r--r-- | debian/patches/pflocal.patch | 675 | ||||
-rw-r--r-- | debian/patches/runsystem_setup_pflocal.patch | 22 | ||||
-rw-r--r-- | debian/patches/series | 9 |
11 files changed, 2 insertions, 1125 deletions
diff --git a/debian/patches/ext2fs_large_stores_pthread.patch b/debian/patches/ext2fs_large_stores_pthread.patch index d4108381..71f76a34 100644 --- a/debian/patches/ext2fs_large_stores_pthread.patch +++ b/debian/patches/ext2fs_large_stores_pthread.patch @@ -4,6 +4,8 @@ Date: Mon Sep 3 22:19:16 2012 +0200 Move large storage patch to pthreads +TODO: merge into ext2fs_large_stores.patch. + Index: hurd-debian/ext2fs/ext2fs.h =================================================================== --- hurd-debian.orig/ext2fs/ext2fs.h 2012-11-26 00:24:49.000000000 +0000 @@ -340,21 +342,3 @@ index 24533e7..0d71db7 100644 } } -diff --git a/libpager/lock-object.c b/libpager/lock-object.c -index 93c89f0..c022d0c 100644 ---- a/libpager/lock-object.c -+++ b/libpager/lock-object.c -@@ -65,11 +65,11 @@ _pager_lock_object (struct pager *p, - } - } - -- mutex_unlock (&p->interlock); -+ pthread_mutex_unlock (&p->interlock); - memory_object_lock_request (p->memobjcntl, offset, size, should_return, - should_flush, lock_value, - sync ? p->port.port_right : MACH_PORT_NULL); -- mutex_lock (&p->interlock); -+ pthread_mutex_lock (&p->interlock); - - if (sync) - { diff --git a/debian/patches/ext2fs_nowait.patch b/debian/patches/ext2fs_nowait.patch deleted file mode 100644 index c38b3251..00000000 --- a/debian/patches/ext2fs_nowait.patch +++ /dev/null @@ -1,156 +0,0 @@ -Avoid waiting for disk I/O completion. This improves performance quite a bit, -and should not be less safe. - -Merged upstream. - -diff --git a/ext2fs/dir.c b/ext2fs/dir.c -index 66d8c8a..f0f52f7 100644 ---- a/ext2fs/dir.c -+++ b/ext2fs/dir.c -@@ -690,7 +690,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np, - } - } - -- diskfs_file_update (dp, 1); -+ diskfs_file_update (dp, diskfs_synchronous); - - return 0; - } -@@ -727,7 +727,7 @@ diskfs_dirremove_hard (struct node *dp, struct dirstat *ds) - if (dp->dn->dirents && dp->dn->dirents[ds->idx] != -1) - dp->dn->dirents[ds->idx]--; - -- diskfs_file_update (dp, 1); -+ diskfs_file_update (dp, diskfs_synchronous); - - return 0; - } -@@ -753,7 +753,7 @@ diskfs_dirrewrite_hard (struct node *dp, struct node *np, struct dirstat *ds) - - munmap ((caddr_t) ds->mapbuf, ds->mapextent); - -- diskfs_file_update (dp, 1); -+ diskfs_file_update (dp, diskfs_synchronous); - - return 0; - } -diff --git a/ext2fs/truncate.c b/ext2fs/truncate.c -index 077225b..2058a1c 100644 ---- a/ext2fs/truncate.c -+++ b/ext2fs/truncate.c -@@ -294,7 +294,7 @@ diskfs_truncate (struct node *node, off_t length) - node->dn_stat.st_size = length; - node->dn_set_mtime = 1; - node->dn_set_ctime = 1; -- diskfs_node_update (node, 1); -+ diskfs_node_update (node, diskfs_synchronous); - return 0; - } - -@@ -309,6 +309,7 @@ diskfs_truncate (struct node *node, off_t length) - { - diskfs_node_rdwr (node, (void *)zeroblock, length, block_size - offset, - 1, 0, 0); -+ /* Make sure that really happens to avoid leaks. */ - diskfs_file_update (node, 1); - } - -@@ -323,7 +324,7 @@ diskfs_truncate (struct node *node, off_t length) - node->dn_stat.st_size = length; - node->dn_set_mtime = 1; - node->dn_set_ctime = 1; -- diskfs_node_update (node, 1); -+ diskfs_node_update (node, diskfs_synchronous); - - err = diskfs_catch_exception (); - if (!err) -diff --git a/libdiskfs/dir-init.c b/libdiskfs/dir-init.c -index 2cba3a4..4efded0 100644 ---- a/libdiskfs/dir-init.c -+++ b/libdiskfs/dir-init.c -@@ -63,6 +63,6 @@ diskfs_init_dir (struct node *dp, struct node *pdp, struct protid *cred) - return err; - } - -- diskfs_node_update (dp, 1); -+ diskfs_node_update (dp, diskfs_synchronous); - return 0; - } -diff --git a/libdiskfs/dir-link.c b/libdiskfs/dir-link.c -index 7cc8863..df1bb6a 100644 ---- a/libdiskfs/dir-link.c -+++ b/libdiskfs/dir-link.c -@@ -101,7 +101,7 @@ diskfs_S_dir_link (struct protid *dircred, - } - np->dn_stat.st_nlink++; - np->dn_set_ctime = 1; -- diskfs_node_update (np, 1); -+ diskfs_node_update (np, diskfs_synchronous); - - /* Attach it */ - if (tnp) -diff --git a/libdiskfs/dir-rename.c b/libdiskfs/dir-rename.c -index 867e395..298669b 100644 ---- a/libdiskfs/dir-rename.c -+++ b/libdiskfs/dir-rename.c -@@ -164,7 +164,7 @@ diskfs_S_dir_rename (struct protid *fromcred, - } - fnp->dn_stat.st_nlink++; - fnp->dn_set_ctime = 1; -- diskfs_node_update (fnp, 1); -+ diskfs_node_update (fnp, diskfs_synchronous); - - if (tnp) - { -diff --git a/libdiskfs/dir-renamed.c b/libdiskfs/dir-renamed.c -index ce8f415..319a41a 100644 ---- a/libdiskfs/dir-renamed.c -+++ b/libdiskfs/dir-renamed.c -@@ -177,7 +177,7 @@ diskfs_rename_dir (struct node *fdp, struct node *fnp, const char *fromname, - } - fnp->dn_stat.st_nlink++; - fnp->dn_set_ctime = 1; -- diskfs_node_update (fnp, 1); -+ diskfs_node_update (fnp, diskfs_synchronous); - - if (tnp) - { -diff --git a/libdiskfs/file-set-trans.c b/libdiskfs/file-set-trans.c -index 26a19eb..c9b2c61 100644 ---- a/libdiskfs/file-set-trans.c -+++ b/libdiskfs/file-set-trans.c -@@ -196,7 +196,7 @@ diskfs_S_file_set_translator (struct protid *cred, - if (!error) - { - np->dn_stat.st_mode = newmode; -- diskfs_node_update (np, 1); -+ diskfs_node_update (np, diskfs_synchronous); - } - mutex_unlock (&np->lock); - return error; -diff --git a/libdiskfs/node-create.c b/libdiskfs/node-create.c -index 4a7d108..5b5e463 100644 ---- a/libdiskfs/node-create.c -+++ b/libdiskfs/node-create.c -@@ -131,7 +131,7 @@ diskfs_create_node (struct node *dir, - if (S_ISDIR (mode)) - err = diskfs_init_dir (np, dir, cred); - -- diskfs_node_update (np, 1); -+ diskfs_node_update (np, diskfs_synchronous); - - if (err) - { -diff --git a/libdiskfs/node-drop.c b/libdiskfs/node-drop.c -index f44966b..c3d32c9 100644 ---- a/libdiskfs/node-drop.c -+++ b/libdiskfs/node-drop.c -@@ -78,7 +78,7 @@ diskfs_drop_node (struct node *np) - np->dn_stat.st_mode = 0; - np->dn_stat.st_rdev = 0; - np->dn_set_ctime = np->dn_set_atime = 1; -- diskfs_node_update (np, 1); -+ diskfs_node_update (np, diskfs_synchronous); - diskfs_free_node (np, savemode); - } - else diff --git a/debian/patches/install-msgids.diff b/debian/patches/install-msgids.diff deleted file mode 100644 index 975d38e2..00000000 --- a/debian/patches/install-msgids.diff +++ /dev/null @@ -1,38 +0,0 @@ -2005-08-25 Alfred M. Szmidt <ams@gnu.org> - - * Makefile (MSGIDS): New variable. - (all, install-msgids, $(datadir)/msgids): New targets. - (install): Specify install-header and install-msgids as - prerequisites. - -merged upstream - ---- - hurd/Makefile | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - ---- a/hurd/Makefile -+++ b/hurd/Makefile -@@ -22,15 +22,20 @@ DIST_FILES = subsystems $(notdir $(hdrs) - - INSTHDRS = hurd_types.h version.h ioctl_types.h paths.h shared.h console.h \ - $(notdir $(wildcard $(srcdir)/*.defs)) -+MSGIDS := hurd.msgids $(patsubst %.defs,%.msgids,$(filter %.defs,$(INSTHDRS))) - - include ../Makeconf - --install-headers install: $(includedir)/hurd \ -+all: $(MSGIDS) -+ -+install: install-msgids install-headers -+install-headers: $(includedir)/hurd \ - $(addprefix $(includedir)/hurd/,$(INSTHDRS)) -+install-msgids: $(MSGIDS) $(datadir)/msgids; $(INSTALL_DATA) $^ - - $(includedir)/hurd/%: $(srcdir)/%; $(INSTALL_DATA) $< $@ - --$(includedir)/hurd:;mkdir -p $@ -+$(datadir)/msgids $(includedir)/hurd:;mkdir -p $@ - - %.msgids: $(srcdir)/%.defs - if grep -q '^subsystem' $<; \ diff --git a/debian/patches/libdiskfs_self-reauth.patch b/debian/patches/libdiskfs_self-reauth.patch deleted file mode 100644 index 24de3939..00000000 --- a/debian/patches/libdiskfs_self-reauth.patch +++ /dev/null @@ -1,34 +0,0 @@ -"RPC to self with rendez-vous leading to duplicate port destroy" - -http://lists.gnu.org/archive/html/bug-hurd/2011-03/msg00045.html - -Merged upstream - -diff --git a/libfshelp/fetch-root.c b/libfshelp/fetch-root.c -index 54d3c0c..6585052 100644 ---- a/libfshelp/fetch-root.c -+++ b/libfshelp/fetch-root.c -@@ -79,7 +79,9 @@ fshelp_fetch_root (struct transbox *box, void *cookie, - if (err) - ret = MACH_PORT_NULL; - -- mach_port_destroy (mach_task_self (), rend); -+ /* crdir could be ourselves, and thus diskfs_S_io_reauthenticate -+ * would get the same name, so don't _destroy_ it !! */ -+ mach_port_mod_refs (mach_task_self (), rend, MACH_PORT_RIGHT_RECEIVE, -1); - - return ret; - } -diff --git a/libshouldbeinlibc/exec-reauth.c b/libshouldbeinlibc/exec-reauth.c -index dd267ef..12b34fc 100644 ---- a/libshouldbeinlibc/exec-reauth.c -+++ b/libshouldbeinlibc/exec-reauth.c -@@ -59,7 +59,7 @@ exec_reauth (auth_t auth, int secure, int must_reauth, - if (!err) - err = auth_user_authenticate (auth, ref, MACH_MSG_TYPE_MAKE_SEND, - &newport); -- mach_port_destroy (mach_task_self (), ref); -+ mach_port_mod_refs (mach_task_self (), ref, MACH_PORT_RIGHT_RECEIVE, -1); - if (err) - { - if (must_reauth) diff --git a/debian/patches/libdiskfs_sync.patch b/debian/patches/libdiskfs_sync.patch deleted file mode 100644 index 19e45170..00000000 --- a/debian/patches/libdiskfs_sync.patch +++ /dev/null @@ -1,16 +0,0 @@ -Set diskfs stores as readonly on shutdown before enabling RPCs again. - -diff --git a/libdiskfs/init-startup.c b/libdiskfs/init-startup.c -index bf1acf2..700a26e 100644 ---- a/libdiskfs/init-startup.c -+++ b/libdiskfs/init-startup.c -@@ -148,6 +148,9 @@ diskfs_S_startup_dosync (mach_port_t handle) - diskfs_set_hypermetadata (1, 1); - _diskfs_diskdirty = 0; - -+ diskfs_readonly = 1; -+ diskfs_readonly_changed (1); -+ - ports_resume_class_rpcs (diskfs_protid_class); - } - diff --git a/debian/patches/libpager_deadlock.patch b/debian/patches/libpager_deadlock.patch deleted file mode 100644 index b9bc4e18..00000000 --- a/debian/patches/libpager_deadlock.patch +++ /dev/null @@ -1,22 +0,0 @@ -See http://lists.gnu.org/archive/html/bug-hurd/2010-03/msg00127.html -for the story. This should be completely safe, but Sergio believes -memory_object_lock_request shouldn't actually block. - -merged upstream - -diff --git a/libpager/lock-object.c b/libpager/lock-object.c -index d108666..d8d4a1b 100644 ---- a/libpager/lock-object.c -+++ b/libpager/lock-object.c -@@ -65,9 +65,11 @@ _pager_lock_object (struct pager *p, - } - } - -+ mutex_unlock (&p->interlock); - memory_object_lock_request (p->memobjcntl, offset, size, should_return, - should_flush, lock_value, - sync ? p->port.port_right : MACH_PORT_NULL); -+ mutex_lock (&p->interlock); - - if (sync) - { diff --git a/debian/patches/makedev_keep_options.patch b/debian/patches/makedev_keep_options.patch deleted file mode 100644 index f9674461..00000000 --- a/debian/patches/makedev_keep_options.patch +++ /dev/null @@ -1,60 +0,0 @@ -Add options -k and -K to MAKEDEV.sh to chose not to overwrite existing entries. - -TODO: submit to bug-hurd - -merged upstream - -Index: hurd/sutils/MAKEDEV.sh -=================================================================== ---- hurd.orig/sutils/MAKEDEV.sh 2010-07-01 18:14:22.000000000 +0200 -+++ hurd/sutils/MAKEDEV.sh 2010-07-01 18:17:37.000000000 +0200 -@@ -8,6 +8,8 @@ - ECHO=: # Change to "echo" to echo commands. - EXEC="" # Change to ":" to suppress command execution. - DEVDIR=`pwd` # Reset below by -D/--devdir command line option. -+STFLAGS="-g" # Set to -k if active translators are to be kept. -+KEEP= # Set to something if existing files are to be left alone. - - while :; do - case "$1" in -@@ -18,6 +20,8 @@ - - -D, --devdir=DIR Use DIR when a device node name must be - embedded in a translator; default is the cwd -+ -k, --keep-active Leave any existing active translator running -+ -K, --keep-all Don't overwrite existing files - -n, --dry-run Don't actually execute any commands - -v, --verbose Show what commands are executed to make the devices - -?, --help Give this help list -@@ -28,11 +32,14 @@ - --devdir=*) DEVDIR="`echo "$1" | sed 's/^--devdir=//'`"; shift 1;; - -D) DEVDIR="$2"; shift 2;; - -D*) DEVDIR="`echo "$1" | sed 's/^-D//'`"; shift 1;; -+ --keep-active|-k) STFLAGS="-k"; shift;; -+ --keep-all|-K) KEEP=1; shift;; - --verbose|-v) ECHO=echo; shift;; - --dry-run|-n) EXEC=:; shift;; - -nv|-vn) ECHO=echo; EXEC=:; shift;; - --usage) -- echo "Usage: $0 [-V?] [-D DIR] [--help] [--usage] [--version] [--devdir=DIR] DEVNAME..." -+ echo "Usage: $0 [-V?] [-D DIR] [--help] [--usage] [--version]" -+ echo " [--devdir=DIR] [--keep-active] [--keep-all] DEVNAME..." - exit 0;; - --version|-V) - echo "STANDARD_HURD_VERSION_MAKEDEV_"; exit 0;; -@@ -61,10 +68,13 @@ - local OWNER="$2" - local PERM="$3" - shift 3 -- if cmd settrans -cg "$NODE"; then -+ if [ "$KEEP" ] && showtrans "$NODE" > /dev/null 2>&1 ; then -+ return; -+ fi -+ if cmd settrans $STFLAGS -c "$NODE"; then - cmd chown "$OWNER" "$NODE" - cmd chmod "$PERM" "$NODE" -- cmd settrans "$NODE" "$@" -+ cmd settrans $STFLAGS "$NODE" "$@" - fi - } - diff --git a/debian/patches/makedev_parted_store.patch b/debian/patches/makedev_parted_store.patch deleted file mode 100644 index f4d45294..00000000 --- a/debian/patches/makedev_parted_store.patch +++ /dev/null @@ -1,75 +0,0 @@ -Add option -p to MAKEDEV to use user-space parted stores for partition devices. - -TODO: use in installed system, test, and submit to bug-hurd. IIRC the issue with -it was that the swapper does not like parted-based stores. - -merged upstream - -Index: hurd/sutils/MAKEDEV.sh -=================================================================== ---- hurd.orig/sutils/MAKEDEV.sh 2010-07-08 00:48:13.000000000 +0000 -+++ hurd/sutils/MAKEDEV.sh 2010-07-08 01:18:26.000000000 +0000 -@@ -10,6 +10,7 @@ - DEVDIR=`pwd` # Reset below by -D/--devdir command line option. - STFLAGS="-g" # Set to -k if active translators are to be kept. - KEEP= # Set to something if existing files are to be left alone. -+USE_PARTSTORE= # Whether to use the newer part: stores - - while :; do - case "$1" in -@@ -22,6 +23,8 @@ - embedded in a translator; default is the cwd - -k, --keep-active Leave any existing active translator running - -K, --keep-all Don't overwrite existing files -+ -p, --parted Prefer user-space parted stores to kernel devices -+ for partition devices - -n, --dry-run Don't actually execute any commands - -v, --verbose Show what commands are executed to make the devices - -?, --help Give this help list -@@ -34,11 +37,12 @@ - -D*) DEVDIR="`echo "$1" | sed 's/^-D//'`"; shift 1;; - --keep-active|-k) STFLAGS="-k"; shift;; - --keep-all|-K) KEEP=1; shift;; -+ --parted|-p) USE_PARTSTORE=1; shift;; - --verbose|-v) ECHO=echo; shift;; - --dry-run|-n) EXEC=:; shift;; - -nv|-vn) ECHO=echo; EXEC=:; shift;; - --usage) -- echo "Usage: $0 [-V?] [-D DIR] [--help] [--usage] [--version]" -+ echo "Usage: $0 [-V?] [-D DIR] [--help] [--usage] [--version] [--parted]" - echo " [--devdir=DIR] [--keep-active] [--keep-all] DEVNAME..." - exit 0;; - --version|-V) -@@ -150,6 +154,7 @@ - ;; - - [hrsc]d*) -+ local sliceno= - local n="${I#?d}" - local major="${n%%[!0-9]*}" - if [ -z "$major" ]; then -@@ -170,7 +175,9 @@ - ;; - esac - case "$rest" in -- '') ;; # Whole slice -+ '') # Whole slice, can use parted stores -+ sliceno=$slice -+ ;; - [a-z]) ;; # BSD partition after slice - *) - lose "$I: Invalid partition \`$rest'" -@@ -183,7 +190,12 @@ - esac - - # The device name passed all syntax checks, so finally use it! -- st $I root 640 /hurd/storeio $I -+ if [ "$USE_PARTSTORE" ] && [ -z "$rest" ] && [ "$sliceno" ]; then -+ local dev=${I%s[0-9]*} -+ st $I root 640 /hurd/storeio -T typed part:$sliceno:device:$dev -+ else -+ st $I root 640 /hurd/storeio $I -+ fi - ;; - - netdde) diff --git a/debian/patches/pflocal.patch b/debian/patches/pflocal.patch deleted file mode 100644 index 7ebba8d5..00000000 --- a/debian/patches/pflocal.patch +++ /dev/null @@ -1,675 +0,0 @@ -2005-05-17 Neal H. Walfield <neal@gnu.org> - - * connq.h (struct connq_request): Remove forward. - (connq_listen): Wait for a request to be queued not until there is - a connection attempt. Remove REQ parameter. Update callers. - (connq_request_complete): Remove declaration. - (connq_connect): Wait for a slot to queue a request not until - there is an acceptor. Remove SOCK parameter. Update callers. - (connq_connect_complete): New declaration. - (connq_connect_cancel): New declaration. - - * connq.c (struct connq): Remove fields noqueue, queue, length, - head and tail. Add fields head, tail, count, max, connectors and - num_connectors. That is, replace the circular buffer with a - singly linked list. - (qnext): Remove function. - (struct connq_request): Remove field signal, lock, completed and - err. Add field next. - (connq_request_init): Rewrite according to new semantics. - (connq_request_enqueue): New function. - (connq_request_dequeue): New function. - (connq_create): Update according to new semantics. - (connq_destroy): Likewise. - (connq_listen): Rewrite to not block until there is a connector - but until there is a request in the queue. - (connq_request_complete): Remove function. - (connq_connect): Rewrite to not block until there is an acceptor - but until there is space for a request. - (connq_connect_complete): New function. - (connq_connect_cancel): New function. - (connq_compress): Remove dead code. - (connq_set_length): Rewrite. - - * socket.c (S_socket_connect): Create the server socket here... - (S_socket_accept): ... not here. - -merged upstream ---- - pflocal/connq.c | 341 +++++++++++++++++++++++++++++-------------------------- - pflocal/connq.h | 39 +++--- - pflocal/io.c | 8 - - pflocal/socket.c | 72 +++++------ - 4 files changed, 245 insertions(+), 215 deletions(-) - ---- a/pflocal/connq.c -+++ b/pflocal/connq.c -@@ -26,31 +26,22 @@ - /* A queue for queueing incoming connections. */ - struct connq - { -- /* True if all connection requests should be treated as non-blocking. */ -- int noqueue; -- - /* The connection request queue. */ -- struct connq_request **queue; -- unsigned length; -- /* Head is the position in QUEUE of the first request, and TAIL is the -- first free position in the queue. If HEAD == TAIL, then the queue is -- empty. Starting at HEAD, successive positions can be calculated by -- using qnext(). */ -- unsigned head, tail; -+ struct connq_request *head; -+ struct connq_request **tail; -+ unsigned count; -+ unsigned max; - - /* Threads that have done an accept on this queue wait on this condition. */ - struct condition listeners; - unsigned num_listeners; - -+ /* Threads that have done a connect on this queue wait on this condition. */ -+ struct condition connectors; -+ unsigned num_connectors; -+ - struct mutex lock; - }; -- --/* Returns the position CQ's queue after POS. */ --static inline unsigned --qnext (struct connq *cq, unsigned pos) --{ -- return (pos + 1 == cq->length) ? 0 : pos + 1; --} - - /* ---------------------------------------------------------------- */ - -@@ -58,30 +49,50 @@ qnext (struct connq *cq, unsigned pos) - get information from and to the thread. */ - struct connq_request - { -+ struct connq_request *next; -+ - /* The socket that's waiting to connect. */ - struct sock *sock; -- -- /* What the waiting thread blocks on. */ -- struct condition signal; -- struct mutex lock; -- -- /* Set to true when this request has been dealt with, to guard against -- spurious conditions being signaled. */ -- int completed; -- -- /* After the waiting thread is unblocked, this is the result, either 0 if -- SOCK has been connected, or an error. */ -- error_t err; - }; - - static inline void - connq_request_init (struct connq_request *req, struct sock *sock) - { -- req->err = 0; - req->sock = sock; -- req->completed = 0; -- condition_init (&req->signal); -- mutex_init (&req->lock); -+} -+ -+/* Enqueue connection request REQ onto CQ. CQ must be locked. */ -+static void -+connq_request_enqueue (struct connq *cq, struct connq_request *req) -+{ -+ assert (! mutex_try_lock (&cq->lock)); -+ -+ req->next = NULL; -+ *cq->tail = req; -+ cq->tail = &req->next; -+ -+ cq->count ++; -+} -+ -+/* Dequeue a pending request from CQ. CQ must be locked and must not -+ be empty. */ -+static struct connq_request * -+connq_request_dequeue (struct connq *cq) -+{ -+ struct connq_request *req; -+ -+ assert (! mutex_try_lock (&cq->lock)); -+ assert (cq->head); -+ -+ req = cq->head; -+ cq->head = req->next; -+ if (! cq->head) -+ /* We just dequeued the last element. Fixup the tail pointer. */ -+ cq->tail = &cq->head; -+ -+ cq->count --; -+ -+ return req; - } - - /* ---------------------------------------------------------------- */ -@@ -95,16 +106,20 @@ connq_create (struct connq **cq) - struct connq *new = malloc (sizeof (struct connq)); - - if (!new) -- return ENOMEM; -+ return ENOBUFS; -+ -+ new->head = NULL; -+ new->tail = &new->head; -+ new->count = 0; -+ /* By default, don't queue requests. */ -+ new->max = 0; - -- new->noqueue = 1; /* By default, don't queue requests. */ -- new->length = 0; -- new->head = new->tail = 0; -- new->queue = NULL; - new->num_listeners = 0; -+ new->num_connectors = 0; - - mutex_init (&new->lock); - condition_init (&new->listeners); -+ condition_init (&new->connectors); - - *cq = new; - return 0; -@@ -116,175 +131,189 @@ connq_destroy (struct connq *cq) - { - /* Everybody in the queue should hold a reference to the socket - containing the queue. */ -- assert (cq->length == 0); -- /* Nevertheless, malloc(0) or realloc(0) might allocate some small -- space. */ -- if (cq->queue) -- free (cq->queue); -+ assert (! cq->head); -+ assert (cq->count == 0); -+ - free (cq); - } - - /* ---------------------------------------------------------------- */ - --/* Wait for a connection attempt to be made on CQ, and return the connecting -- socket in SOCK, and a request tag in REQ. If REQ is NULL, the request is -- left in the queue, otherwise connq_request_complete must be called on REQ -- to allow the requesting thread to continue. If NOBLOCK is true, -- EWOULDBLOCK is returned when there are no immediate connections -- available. */ -+/* Return a connection request on CQ. If SOCK is NULL, the request is -+ left in the queue. If NOBLOCK is true, EWOULDBLOCK is returned -+ when there are no immediate connections available. */ - error_t --connq_listen (struct connq *cq, int noblock, -- struct connq_request **req, struct sock **sock) -+connq_listen (struct connq *cq, int noblock, struct sock **sock) - { -+ error_t err = 0; -+ - mutex_lock (&cq->lock); - -- if (noblock && cq->head == cq->tail) -+ if (noblock && cq->count == 0 && cq->num_connectors == 0) - { - mutex_unlock (&cq->lock); - return EWOULDBLOCK; - } - -+ if (! sock && (cq->count > 0 || cq->num_connectors > 0)) -+ /* The caller just wants to know if a connection ready. */ -+ { -+ mutex_unlock (&cq->lock); -+ return 0; -+ } -+ - cq->num_listeners++; - -- while (cq->head == cq->tail) -- if (hurd_condition_wait (&cq->listeners, &cq->lock)) -- { -- cq->num_listeners--; -- mutex_unlock (&cq->lock); -- return EINTR; -- } -+ if (cq->count == 0) -+ /* The request queue is empty. */ -+ { -+ assert (! cq->head); -+ -+ if (cq->num_connectors > 0) -+ /* Someone is waiting for an acceptor. Signal that we can -+ service their request. */ -+ condition_signal (&cq->connectors); -+ -+ do -+ if (hurd_condition_wait (&cq->listeners, &cq->lock)) -+ { -+ cq->num_listeners--; -+ err = EINTR; -+ goto out; -+ } -+ while (cq->count == 0); -+ } -+ -+ assert (cq->head); - -- if (req != NULL) -+ if (sock) - /* Dequeue the next request, if desired. */ - { -- *req = cq->queue[cq->head]; -- cq->head = qnext (cq, cq->head); -- if (sock != NULL) -- *sock = (*req)->sock; -+ struct connq_request *req = connq_request_dequeue (cq); -+ *sock = req->sock; -+ free (req); - } -+ else if (cq->num_listeners > 0) -+ /* The caller will not actually process this request but someone -+ else could. (This case is rare but possible: it would require -+ one thread to do a select on the socket and a second to do an -+ accept.) */ -+ condition_signal (&cq->listeners); -+ else -+ /* There is no one else to process the request and the connection -+ has now been initiated. This is not actually a problem as even -+ if the current queue limit is 0, the connector will queue the -+ request and another listener (should) eventually come along. -+ (In fact it is very probably as the caller has likely done a -+ select and will now follow up with an accept.) */ -+ ; - -- cq->num_listeners--; -- -+ out: - mutex_unlock (&cq->lock); -- -- return 0; --} -- --/* Return the error code ERR to the thread that made the listen request REQ, -- returned from a previous connq_listen. */ --void --connq_request_complete (struct connq_request *req, error_t err) --{ -- mutex_lock (&req->lock); -- req->err = err; -- req->completed = 1; -- condition_signal (&req->signal); -- mutex_unlock (&req->lock); -+ return err; - } - --/* Try to connect SOCK with the socket listening on CQ. If NOBLOCK is true, -- then return EWOULDBLOCK immediately when there are no immediate -- connections available. Neither SOCK nor CQ should be locked. */ -+/* Try to connect SOCK with the socket listening on CQ. If NOBLOCK is -+ true, then return EWOULDBLOCK if there are no connections -+ immediately available. On success, this call must be followed up -+ either connq_connect_complete or connq_connect_cancel. */ - error_t --connq_connect (struct connq *cq, int noblock, struct sock *sock) -+connq_connect (struct connq *cq, int noblock) - { -- error_t err = 0; -- unsigned next; -- - mutex_lock (&cq->lock); - - /* Check for listeners after we've locked CQ for good. */ -- if ((noblock || cq->noqueue) && cq->num_listeners == 0) -+ -+ if (noblock -+ && cq->count + cq->num_connectors >= cq->max + cq->num_listeners) -+ /* We are in non-blocking mode and would have to wait to secure an -+ entry in the listen queue. */ - { - mutex_unlock (&cq->lock); - return EWOULDBLOCK; - } - -- next = qnext (cq, cq->tail); -- if (next == cq->tail) -- /* The queue is full. */ -- err = ECONNREFUSED; -- else -- { -- struct connq_request req; -+ cq->num_connectors ++; -+ -+ while (cq->count + cq->num_connectors > cq->max + cq->num_listeners) -+ /* The queue is full and there is no immediate listener to service -+ us. Block until we can get a slot. */ -+ if (hurd_condition_wait (&cq->connectors, &cq->lock)) -+ { -+ cq->num_connectors --; -+ mutex_unlock (&cq->lock); -+ return EINTR; -+ } - -- connq_request_init (&req, sock); -+ mutex_unlock (&cq->lock); - -- cq->queue[cq->tail] = &req; -- cq->tail = next; -+ return 0; -+} - -- /* Hold REQ.LOCK before we signal the condition so that we're sure -- to be woken up. */ -- mutex_lock (&req.lock); -- condition_signal (&cq->listeners); -- mutex_unlock (&cq->lock); -+/* Follow up to connq_connect. Completes the connect, SOCK is the new -+ server socket. */ -+void -+connq_connect_complete (struct connq *cq, struct sock *sock) -+{ -+ struct connq_request *req; -+ -+ req = malloc (sizeof (struct connq_request)); -+ if (! req) -+ abort (); -+ -+ connq_request_init (req, sock); - -- while (!req.completed) -- condition_wait (&req.signal, &req.lock); -- err = req.err; -+ mutex_lock (&cq->lock); -+ -+ assert (cq->num_connectors > 0); -+ cq->num_connectors --; -+ -+ connq_request_enqueue (cq, req); - -- mutex_unlock (&req.lock); -+ if (cq->num_listeners > 0) -+ /* Wake a listener up. We must consume the listener ref here as -+ someone else might call this function before the listener -+ thread dequeues this request. */ -+ { -+ cq->num_listeners --; -+ condition_signal (&cq->listeners); - } - -- return err; -+ mutex_unlock (&cq->lock); - } -- --#if 0 --/* `Compresses' CQ, by removing any NULL entries. CQ should be locked. */ --static void --connq_compress (struct connq *cq) -+ -+/* Follow up to connq_connect. Cancel the connect. */ -+void -+connq_connect_cancel (struct connq *cq) - { -- unsigned pos; -- unsigned comp_tail = cq->head; -+ mutex_lock (&cq->lock); - -- /* Now compress the queue to remove any null entries we put in. */ -- for (pos = cq->head; pos != cq->tail; pos = qnext (cq, pos)) -- if (cq->queue[pos] != NULL) -- /* This position has a non-NULL request, so move it to the end of the -- compressed queue. */ -- { -- cq->queue[comp_tail] = cq->queue[pos]; -- comp_tail = qnext (cq, comp_tail); -- } -+ assert (cq->num_connectors > 0); -+ cq->num_connectors --; - -- /* Move back tail to only include what we kept in the queue. */ -- cq->tail = comp_tail; -+ if (cq->count + cq->num_connectors >= cq->max + cq->num_listeners) -+ /* A connector is blocked and could use the spot we reserved. */ -+ condition_signal (&cq->connectors); -+ -+ mutex_unlock (&cq->lock); - } --#endif - --/* Set CQ's queue length to LENGTH. Any sockets already waiting for a -- connections that are past the new length will fail with ECONNREFUSED. */ -+/* Set CQ's queue length to LENGTH. */ - error_t --connq_set_length (struct connq *cq, int length) -+connq_set_length (struct connq *cq, int max) - { -- mutex_lock (&cq->lock); -+ int omax; - -- if (length > cq->length) -- /* Growing the queue is simple... */ -- cq->queue = realloc (cq->queue, sizeof (struct connq_request *) * length); -- else -- /* Shrinking it less so. */ -- { -- int i; -- struct connq_request **new_queue = -- malloc (sizeof (struct connq_request *) * length); -- -- for (i = 0; i < cq->length && cq->head != cq->tail; i++) -- { -- if (i < length) -- /* Keep this connect request in the queue. */ -- new_queue[length - i] = cq->queue[cq->head]; -- else -- /* Punt this one. */ -- connq_request_complete (cq->queue[cq->head], ECONNREFUSED); -- cq->head = qnext (cq, cq->head); -- } -- -- free (cq->queue); -- cq->queue = new_queue; -- } -+ mutex_lock (&cq->lock); -+ omax = cq->max; -+ cq->max = max; - -- cq->noqueue = 0; /* Turn on queueing. */ -+ if (max > omax && cq->count >= omax && cq->count < max -+ && cq->num_connectors >= cq->num_listeners) -+ /* This is an increase in the number of connection slots which has -+ made some slots available and there are waiting threads. Wake -+ them up. */ -+ condition_broadcast (&cq->listeners); - - mutex_unlock (&cq->lock); - ---- a/pflocal/connq.h -+++ b/pflocal/connq.h -@@ -23,9 +23,8 @@ - - #include <errno.h> - --/* Unknown types */ -+/* Forward. */ - struct connq; --struct connq_request; - struct sock; - - /* Create a new listening queue, returning it in CQ. The resulting queue -@@ -36,26 +35,26 @@ error_t connq_create (struct connq **cq) - /* Destroy a queue. */ - void connq_destroy (struct connq *cq); - --/* Wait for a connection attempt to be made on CQ, and return the connecting -- socket in SOCK, and a request tag in REQ. If REQ is NULL, the request is -- left in the queue, otherwise connq_request_complete must be called on REQ -- to allow the requesting thread to continue. If NOBLOCK is true, -- EWOULDBLOCK is returned when there are no immediate connections -- available. CQ should be unlocked. */ --error_t connq_listen (struct connq *cq, int noblock, -- struct connq_request **req, struct sock **sock); -- --/* Return the error code ERR to the thread that made the listen request REQ, -- returned from a previous connq_listen. */ --void connq_request_complete (struct connq_request *req, error_t err); -+/* Return a connection request on CQ. If SOCK is NULL, the request is -+ left in the queue. If NOBLOCK is true, EWOULDBLOCK is returned -+ when there are no immediate connections available. */ -+error_t connq_listen (struct connq *cq, int noblock, struct sock **sock); -+ -+/* Try to connect SOCK with the socket listening on CQ. If NOBLOCK is -+ true, then return EWOULDBLOCK if there are no connections -+ immediately available. On success, this call must be followed up -+ either connq_connect_complete or connq_connect_cancel. */ -+error_t connq_connect (struct connq *cq, int noblock); -+ -+/* Follow up to connq_connect. Completes the connection, SOCK is the -+ new server socket. */ -+void connq_connect_complete (struct connq *cq, struct sock *sock); -+ -+/* Follow up to connq_connect. Cancel the connect. */ -+void connq_connect_cancel (struct connq *cq); - - /* Set CQ's queue length to LENGTH. Any sockets already waiting for a -- connections that are past the new length will fail with ECONNREFUSED. */ -+ connections that are past the new length remain. */ - error_t connq_set_length (struct connq *cq, int length); - --/* Try to connect SOCK with the socket listening on CQ. If NOBLOCK is true, -- then return EWOULDBLOCK immediately when there are no immediate -- connections available. Neither SOCK nor CQ should be locked. */ --error_t connq_connect (struct connq *cq, int noblock, struct sock *sock); -- - #endif /* __CONNQ_H__ */ ---- a/pflocal/io.c -+++ b/pflocal/io.c -@@ -199,16 +199,16 @@ S_io_select (struct sock_user *user, - - if (*select_type & SELECT_READ) - { -- /* Wait for a connect. Passing in NULL for REQ means that the -- request won't be dequeued. */ -- if (connq_listen (sock->listen_queue, 1, NULL, NULL) == 0) -+ /* Wait for a connect. Passing in NULL for SOCK means that -+ the request won't be dequeued. */ -+ if (connq_listen (sock->listen_queue, 1, NULL) == 0) - /* We can satisfy this request immediately. */ - return 0; - else - /* Gotta wait... */ - { - ports_interrupt_self_on_port_death (user, reply); -- return connq_listen (sock->listen_queue, 0, NULL, NULL); -+ return connq_listen (sock->listen_queue, 0, NULL); - } - } - } ---- a/pflocal/socket.c -+++ b/pflocal/socket.c -@@ -110,7 +110,7 @@ S_socket_connect (struct sock_user *user - else if (sock->flags & SOCK_CONNECTED) - /* SOCK_CONNECTED is only set for connection-oriented sockets, - which can only ever connect once. [If we didn't do this test -- here, it would eventually fail when it the listening socket -+ here, it would eventually fail when the listening socket - tried to accept our connection request.] */ - err = EISCONN; - else -@@ -118,16 +118,35 @@ S_socket_connect (struct sock_user *user - /* Assert that we're trying to connect, so anyone else trying - to do so will fail with EALREADY. */ - sock->connect_queue = cq; -- mutex_unlock (&sock->lock); /* Unlock SOCK while waiting. */ -+ /* Unlock SOCK while waiting. */ -+ mutex_unlock (&sock->lock); - -- /* Try to connect. */ -- err = connq_connect (cq, sock->flags & SOCK_NONBLOCK, sock); -+ err = connq_connect (peer->listen_queue, -+ sock->flags & SOCK_NONBLOCK); -+ if (!err) -+ { -+ struct sock *server; -+ -+ err = sock_clone (peer, &server); -+ if (!err) -+ { -+ err = sock_connect (sock, server); -+ if (!err) -+ connq_connect_complete (peer->listen_queue, server); -+ else -+ sock_free (server); -+ } - -- /* We can safely set CONNECT_QUEUE to NULL, as no one else can -+ mutex_lock (&sock->lock); -+ if (err) -+ connq_connect_cancel (peer->listen_queue); -+ } -+ -+ /* We must set CONNECT_QUEUE to NULL, as no one else can - set it until we've done so. */ -- mutex_lock (&sock->lock); - sock->connect_queue = NULL; - } -+ - mutex_unlock (&sock->lock); - } - else -@@ -157,42 +176,25 @@ S_socket_accept (struct sock_user *user, - err = ensure_connq (sock); - if (!err) - { -- struct connq_request *req; - struct sock *peer_sock; - -- err = -- connq_listen (sock->listen_queue, sock->flags & SOCK_NONBLOCK, -- &req, &peer_sock); -+ err = connq_listen (sock->listen_queue, sock->flags & SOCK_NONBLOCK, -+ &peer_sock); - if (!err) - { -- struct sock *conn_sock; -- -- err = sock_clone (sock, &conn_sock); -+ struct addr *peer_addr; -+ *port_type = MACH_MSG_TYPE_MAKE_SEND; -+ err = sock_create_port (peer_sock, port); -+ if (!err) -+ err = sock_get_addr (peer_sock, &peer_addr); - if (!err) - { -- err = sock_connect (conn_sock, peer_sock); -- if (!err) -- { -- struct addr *peer_addr; -- *port_type = MACH_MSG_TYPE_MAKE_SEND; -- err = sock_create_port (conn_sock, port); -- if (!err) -- err = sock_get_addr (peer_sock, &peer_addr); -- if (!err) -- { -- *peer_addr_port = ports_get_right (peer_addr); -- *peer_addr_port_type = MACH_MSG_TYPE_MAKE_SEND; -- ports_port_deref (peer_addr); -- } -- else -- /* TEAR DOWN THE CONNECTION XXX */; -- } -- if (err) -- sock_free (conn_sock); -+ *peer_addr_port = ports_get_right (peer_addr); -+ *peer_addr_port_type = MACH_MSG_TYPE_MAKE_SEND; -+ ports_port_deref (peer_addr); - } -- -- /* Communicate any error (or success) to the connecting thread. */ -- connq_request_complete (req, err); -+ else -+ /* TEAR DOWN THE CONNECTION XXX */; - } - } - diff --git a/debian/patches/runsystem_setup_pflocal.patch b/debian/patches/runsystem_setup_pflocal.patch deleted file mode 100644 index 3f8a96ed..00000000 --- a/debian/patches/runsystem_setup_pflocal.patch +++ /dev/null @@ -1,22 +0,0 @@ -Automatically setup local sockets if not already done so. Needed early for shell -pipelines. ---- - daemons/runsystem.sh | 6 ++++++ - 1 file changed, 6 insertions(+) - -merged upstream ---- a/daemons/runsystem.sh -+++ b/daemons/runsystem.sh -@@ -53,6 +53,12 @@ function singleuser () - } - - -+# See whether pflocal is setup already, and do so if not (install case) -+ -+if ! test -e /servers/socket/1 && which settrans >/dev/null ; then -+ settrans -c /servers/socket/1 /hurd/pflocal -+fi -+ - # We expect to be started by console-run, which gives us no arguments and - # puts FALLBACK_CONSOLE=file-name in the environment if our console is - # other than a normal /dev/console. diff --git a/debian/patches/series b/debian/patches/series index 9e653113..299b9452 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,12 +3,9 @@ ext2fs_large_stores.patch ext2fs_large_stores_pthread.patch hurd_console_startup.patch init_try_runsystem.gnu.patch -#install-msgids.diff makedev.diff pfinet_dhcp.patch -#pflocal.patch rc.patch -#runsystem_setup_pflocal.patch startup-usr-support.patch tmp_exec_startup.patch uptime_w_path_fix.patch @@ -16,13 +13,7 @@ stat_round.patch libports_stability.patch proxy-defpager.diff external.patch -#makedev_keep_options.patch -#makedev_parted_store.patch console_ignore_bdf_err.patch -#ext2fs_nowait.patch -#libpager_deadlock.patch -#libdiskfs_self-reauth.patch -#libdiskfs_sync.patch posix-sigcodes.patch random-default-fast.patch libexec.patch |