diff options
author | Jeremy Allison <jra@samba.org> | 2002-04-19 02:08:52 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2002-04-19 02:08:52 +0000 |
commit | 302b581ddc1f9dcee5c1bcb32da558ae2a7b24c1 (patch) | |
tree | f552ee1a194744889de11e042692cd7efe0212fa /source3/lib/system.c | |
parent | dcb572e0b26858f58ddcf5cac1c94be31cda844d (diff) | |
download | samba-302b581ddc1f9dcee5c1bcb32da558ae2a7b24c1.tar.gz samba-302b581ddc1f9dcee5c1bcb32da558ae2a7b24c1.tar.bz2 samba-302b581ddc1f9dcee5c1bcb32da558ae2a7b24c1.zip |
First cut at fix for the EINTR problem... More needs to be done I think.
Jeremy.
(This used to be commit 48475a7a697242b9fd7b1aec24389afb112569c4)
Diffstat (limited to 'source3/lib/system.c')
-rw-r--r-- | source3/lib/system.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/source3/lib/system.c b/source3/lib/system.c index 8c7eec939e..d97751eb4b 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -73,6 +73,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. ********************************************************************/ |