summaryrefslogtreecommitdiffstats
path: root/source/lib/system.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-06-11 05:57:58 +0000
committerAndrew Tridgell <tridge@samba.org>2000-06-11 05:57:58 +0000
commitb28cc4163bc2faaa80c5782fc02c8f03c410cdeb (patch)
tree58a5eda9a58f43d9f6bad4f7037ee852f69bf00e /source/lib/system.c
parent1871d4a3f64401f9a6f749ce26d1715e3bcdeac3 (diff)
downloadsamba-b28cc4163bc2faaa80c5782fc02c8f03c410cdeb.tar.gz
samba-b28cc4163bc2faaa80c5782fc02c8f03c410cdeb.tar.xz
samba-b28cc4163bc2faaa80c5782fc02c8f03c410cdeb.zip
Linux kernel oplocks now seem to work, but need a _lot_ of testing
I had to modify sys_select() to not loop on EINTR. I added a wrapper called sys_select_intr() which gives the old behaviour.
Diffstat (limited to 'source/lib/system.c')
-rw-r--r--source/lib/system.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/source/lib/system.c b/source/lib/system.c
index 2a99ae779e4..46b01b747a2 100644
--- a/source/lib/system.c
+++ b/source/lib/system.c
@@ -112,9 +112,7 @@ int sys_select(int maxfd, fd_set *fds,struct timeval *tval)
timeout = (tval != NULL) ? (tval->tv_sec * 1000) + (tval->tv_usec/1000) :
-1;
errno = 0;
- do {
- pollrtn = poll( &pfd[0], maxpoll, timeout);
- } while (pollrtn<0 && errno == EINTR);
+ pollrtn = poll( &pfd[0], maxpoll, timeout);
FD_ZERO(fds);
@@ -128,11 +126,9 @@ int sys_select(int maxfd, fd_set *fds,struct timeval *tval)
struct timeval t2;
int selrtn;
- do {
- if (tval) memcpy((void *)&t2,(void *)tval,sizeof(t2));
- errno = 0;
- selrtn = select(maxfd,SELECT_CAST fds,NULL,NULL,tval?&t2:NULL);
- } while (selrtn<0 && errno == EINTR);
+ if (tval) memcpy((void *)&t2,(void *)tval,sizeof(t2));
+ errno = 0;
+ selrtn = select(maxfd,SELECT_CAST fds,NULL,NULL,tval?&t2:NULL);
return(selrtn);
}
@@ -140,6 +136,20 @@ int sys_select(int maxfd, fd_set *fds,struct timeval *tval)
#endif /* NO_SELECT */
/*******************************************************************
+similar to sys_select() but catch EINTR and continue
+this is what sys_select() used to do in Samba
+********************************************************************/
+int sys_select_intr(int maxfd, fd_set *fds,struct timeval *tval)
+{
+ int ret;
+ do {
+ ret = sys_select(maxfd, fds, tval);
+ } while (ret == -1 && errno == EINTR);
+ return ret;
+}
+
+
+/*******************************************************************
A wrapper for usleep in case we don't have one.
********************************************************************/