summaryrefslogtreecommitdiffstats
path: root/source/lib/system.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-04-19 02:07:37 +0000
committerJeremy Allison <jra@samba.org>2002-04-19 02:07:37 +0000
commita1555288253d5d39db0a920ddeb7da9fc2ba0928 (patch)
tree64f09b53507aa124ba55ac8b2bf4127bbe12a857 /source/lib/system.c
parent531cfc89d51b69aa7d8e96ec6b387467a82899b3 (diff)
downloadsamba-a1555288253d5d39db0a920ddeb7da9fc2ba0928.tar.gz
samba-a1555288253d5d39db0a920ddeb7da9fc2ba0928.tar.xz
samba-a1555288253d5d39db0a920ddeb7da9fc2ba0928.zip
First cut at fixing the EINTR problem...... Still a little more to be done.
Jeremy.
Diffstat (limited to 'source/lib/system.c')
-rw-r--r--source/lib/system.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/source/lib/system.c b/source/lib/system.c
index 3bb11f11b81..244f4e8a6f9 100644
--- a/source/lib/system.c
+++ b/source/lib/system.c
@@ -74,6 +74,51 @@ int sys_usleep(long usecs)
}
/*******************************************************************
+A read wrapper that will deal with EINTR.
+********************************************************************/
+
+ssize_t sys_read(int fd, void *buf, size_t count)
+{
+ ssize_t ret;
+
+ do {
+ errno = 0;
+ ret = read(fd, buf, count);
+ } while (ret == -1 && errno == EINTR);
+ return ret;
+}
+
+/*******************************************************************
+A write wrapper that will deal with EINTR.
+********************************************************************/
+
+ssize_t sys_write(int fd, const void *buf, size_t count)
+{
+ ssize_t ret;
+
+ do {
+ errno = 0;
+ ret = write(fd, buf, count);
+ } while (ret == -1 && errno == EINTR);
+ return ret;
+}
+
+/*******************************************************************
+A send wrapper that will deal with EINTR.
+********************************************************************/
+
+int sys_send(int s, const void *msg, size_t len, int flags)
+{
+ ssize_t ret;
+
+ do {
+ errno = 0;
+ ret = send(s, msg, len, flags);
+ } while (ret == -1 && errno == EINTR);
+ return ret;
+}
+
+/*******************************************************************
A stat() wrapper that will deal with 64 bit filesizes.
********************************************************************/