ca3b5569fc
former nino@ that has been a part of this port for some time. Updates to the internal API finally broke it, but a huge thanks to Nils for his work there (thanks Nils!). Now we use the Free/NetBSD support as a base and patch from there :).
60 lines
1.6 KiB
Plaintext
60 lines
1.6 KiB
Plaintext
$OpenBSD: patch-src_daemon_io_c,v 1.1 2004/08/01 06:06:35 marcm Exp $
|
|
--- src/daemon/io.c.orig Sun Oct 19 09:54:32 2003
|
|
+++ src/daemon/io.c Sat Jul 31 13:01:36 2004
|
|
@@ -21,6 +21,7 @@
|
|
Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
+#include <errno.h>
|
|
#include "daemon.h"
|
|
|
|
void
|
|
@@ -35,9 +36,13 @@ do_output (int s, glibtop_response *resp
|
|
resp->offset = offset;
|
|
resp->data_size = data_size;
|
|
|
|
+retry1:
|
|
if (s == 0) {
|
|
- if (write (1, (const void *) resp, sizeof (glibtop_response)) < 0)
|
|
+ if (write (1, (const void *) resp, sizeof (glibtop_response)) < 0) {
|
|
+ if (errno == EINTR)
|
|
+ goto retry1;
|
|
glibtop_warn_io ("write");
|
|
+ }
|
|
} else {
|
|
if (send (s, (const void *) resp, sizeof (glibtop_response), 0) < 0)
|
|
glibtop_warn_io ("send");
|
|
@@ -47,10 +52,13 @@ do_output (int s, glibtop_response *resp
|
|
#ifdef REAL_DEBUG
|
|
fprintf (stderr, "Writing %d bytes of data.\n", resp->data_size);
|
|
#endif
|
|
-
|
|
+retry2:
|
|
if (s == 0) {
|
|
- if (write (1, data, resp->data_size) < 0)
|
|
+ if (write (1, data, resp->data_size) < 0) {
|
|
+ if (errno == EINTR)
|
|
+ goto retry2;
|
|
glibtop_warn_io ("write");
|
|
+ }
|
|
} else {
|
|
if (send (s, data, resp->data_size, 0) , 0)
|
|
glibtop_warn_io ("send");
|
|
@@ -66,6 +74,7 @@ do_read (int s, void *ptr, size_t total_
|
|
size_t already_read = 0, remaining = total_size;
|
|
|
|
while (already_read < total_size) {
|
|
+retry:
|
|
if (s)
|
|
nread = recv (s, ptr, remaining, 0);
|
|
else
|
|
@@ -77,6 +86,8 @@ do_read (int s, void *ptr, size_t total_
|
|
}
|
|
|
|
if (nread <= 0) {
|
|
+ if (errno == EINTR)
|
|
+ goto retry;
|
|
glibtop_warn_io ("recv");
|
|
return 0;
|
|
}
|