svn commit: samba r4580 - in trunk/source: . lib
jra at samba.org
jra at samba.org
Thu Jan 6 23:45:53 GMT 2005
Author: jra
Date: 2005-01-06 23:45:44 +0000 (Thu, 06 Jan 2005)
New Revision: 4580
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4580
Log:
>From Derrell.Lipman at UnwiredUniverse.com. Use nanosleep instead of select
when we have it in smb_msleep.
Jeremy.
Modified:
trunk/source/configure.in
trunk/source/lib/util.c
Changeset:
Modified: trunk/source/configure.in
===================================================================
--- trunk/source/configure.in 2005-01-06 23:27:28 UTC (rev 4579)
+++ trunk/source/configure.in 2005-01-06 23:45:44 UTC (rev 4580)
@@ -985,6 +985,7 @@
AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink)
AC_CHECK_FUNCS(syslog vsyslog timegm)
AC_CHECK_FUNCS(setlocale nl_langinfo)
+AC_CHECK_FUNCS(nanosleep)
# setbuffer, shmget, shm_open are needed for smbtorture
AC_CHECK_FUNCS(setbuffer shmget shm_open backtrace_symbols)
AC_CHECK_HEADERS(libexc.h)
Modified: trunk/source/lib/util.c
===================================================================
--- trunk/source/lib/util.c 2005-01-06 23:27:28 UTC (rev 4579)
+++ trunk/source/lib/util.c 2005-01-06 23:45:44 UTC (rev 4580)
@@ -779,12 +779,24 @@
void smb_msleep(unsigned int t)
{
+#if defined(HAVE_NANOSLEEP)
+ struct timespec tval;
+ int ret;
+
+ tval.tv_sec = t/1000;
+ tval.tv_nsec = 1000000*(t%1000);
+
+ do {
+ errno = 0;
+ ret = nanosleep(&tval, &tval);
+ } while (ret < 0 && errno == EINTR && (tval.tv_sec > 0 || tval.tv_nsec > 0));
+#else
unsigned int tdiff=0;
struct timeval tval,t1,t2;
fd_set fds;
GetTimeOfDay(&t1);
- GetTimeOfDay(&t2);
+ t2 = t1;
while (tdiff < t) {
tval.tv_sec = (t-tdiff)/1000;
@@ -808,6 +820,7 @@
tdiff = TvalDiff(&t1,&t2);
}
+#endif
}
/****************************************************************************
More information about the samba-cvs
mailing list