* Europagate, 1995
*
* $Log: gip.c,v $
- * Revision 1.1 1995/03/27 08:24:58 adam
+ * Revision 1.6 1995/05/02 15:26:52 adam
+ * EINTR obvserved on reads and writes.
+ *
+ * Revision 1.5 1995/05/01 16:27:28 adam
+ * Various improvements. Close-on-exec and close on failure on either
+ * read or write FIFO.
+ *
+ * Revision 1.4 1995/04/21 16:38:07 adam
+ * Added more debugging logs.
+ *
+ * Revision 1.3 1995/04/20 15:12:42 adam
+ * Minor hacks really.
+ *
+ * Revision 1.2 1995/03/27 12:52:18 adam
+ * A little more verbose in marc dump.
+ *
+ * Revision 1.1 1995/03/27 08:24:58 adam
* New module gip: Gateway IPc module.
* New module gw-db: Gateway hash-db module (user information table).
*
#include <fcntl.h>
#include <sys/file.h>
#include <sys/stat.h>
+#include <errno.h>
+
+#include <gw-log.h>
#include <gip.h>
strcpy (gip->name, name);
gip->ret = mknod (gip->name, S_IFIFO|0666, 0);
gip->errno = errno;
+ gip->rfd = gip->wfd = -1;
+ gw_log (GW_LOG_DEBUG, "gip", "Creating %s", gip->name);
return gip;
}
return gip->rfd;
}
+int gip_outfileno (GIP gip)
+{
+ return gip->wfd;
+}
+
int gip_errno (GIP gip)
{
return gip->errno;
int r, no = 0;
while (no < count)
{
- r = read (gip->rfd, buf+no, count-no);
- if (r == -1)
- {
- gip->errno = errno;
- return -1;
- }
+ while (1)
+ {
+ r = read (gip->rfd, buf+no, count-no);
+ if (r != -1)
+ break;
+ if (errno != EINTR)
+ {
+ gip->errno = errno;
+ return -1;
+ }
+ }
no += r;
}
return 0;
int r, no = 0;
while (no < count)
{
- r = write (gip->wfd, buf+no, count-no);
- if (r == -1)
- {
- gip->errno = errno;
- return -1;
+ while (1)
+ {
+ r = write (gip->wfd, buf+no, count-no);
+ if (r != -1)
+ break;
+ if (errno != EINTR)
+ {
+ gip->errno = errno;
+ return -1;
+ }
}
no += r;
}