~ruther/guix-local

ref: next-master guix-local/gnu/packages/patches/hurd-streamio-select.patch -rw-r--r-- 2.3 KiB
b989e013 — Andy Tai gnu: koboldcpp: Update to 1.106.2. 30 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Upstream status: https://lists.gnu.org/archive/html/bug-hurd/2025-12/msg00043.html

From ffe82c73f89d12393c62d5ba35b06552af40e029 Mon Sep 17 00:00:00 2001
From: Yelninei <yelninei@tutamail.com>
Date: Sun, 28 Dec 2025 10:59:56 +0000
Subject: [PATCH 1/2] streamio (io_select_common): Don't return in case of
 O_NONBLOCK.

select should block even when opened with O_NONBLOCK.
---
 trans/streamio.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/trans/streamio.c b/trans/streamio.c
index d21dc937..2a48d793 100644
--- a/trans/streamio.c
+++ b/trans/streamio.c
@@ -589,12 +589,6 @@ io_select_common (struct trivfs_protid *cred,
 	  return 0;
 	}
 
-      if (cred->po->openmodes & O_NONBLOCK)
-	{
-	  pthread_mutex_unlock (&global_lock);
-	  return EWOULDBLOCK;
-	}
-
       ports_interrupt_self_on_port_death (cred, reply);
       err = pthread_hurd_cond_timedwait_np (&select_alert, &global_lock, tsp);
       if (err)
-- 
2.52.0

From 090062ef555ffc29bcb7afcaad5bb46dad5973e9 Mon Sep 17 00:00:00 2001
From: Yelninei <yelninei@tutamail.com>
Date: Sun, 28 Dec 2025 11:03:57 +0000
Subject: [PATCH 2/2] streamio (io_select_common): Request data if none is
 available.

If no data is available immediately start new read/write requests.
---
 trans/streamio.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/trans/streamio.c b/trans/streamio.c
index 2a48d793..f7cd442f 100644
--- a/trans/streamio.c
+++ b/trans/streamio.c
@@ -190,6 +190,8 @@ error_t dev_write (const void *buf, size_t len, size_t *amount, int nowait);
    will wait for any activity to cease.  */
 error_t dev_sync (int wait);
 
+static error_t start_input (int nowait);
+static error_t start_output (int nowait);
 
 
 static struct argp_option options[] =
@@ -589,6 +591,27 @@ io_select_common (struct trivfs_protid *cred,
 	  return 0;
 	}
 
+      if (*type & SELECT_READ)
+	{
+	  err = start_input(1);
+	  if (err)
+	    {
+	      *type = 0;
+	      pthread_mutex_unlock (&global_lock);
+	      return err;
+	    }
+	}
+      if (*type & SELECT_WRITE)
+	{
+	  err = start_output(1);
+	  if (err)
+	    {
+	      *type = 0;
+	      pthread_mutex_unlock (&global_lock);
+	      return err;
+	    }
+	}
+
       ports_interrupt_self_on_port_death (cred, reply);
       err = pthread_hurd_cond_timedwait_np (&select_alert, &global_lock, tsp);
       if (err)
-- 
2.52.0