[SCM] Samba Shared Repository - branch master updated
Björn Jacke
bjacke at samba.org
Tue Sep 7 12:28:08 MDT 2010
The branch, master has been updated
via f69085e s3: use monotonic clock for aio timeout
via 8833adb s3/nmbd: tidy up debug message: ttl isn't a hex value
via a63822f s3/libads: use monotonic clock for DNS timeouts
via b428952 lib/util: add time_mono() for monotonic time a la time()
from e64e398 s4-dreplsrv: Run NC replication synchronously if requested
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit f69085e5ff525d534f66c6163aacb8c320a484bc
Author: Björn Jacke <bj at sernet.de>
Date: Tue Sep 7 03:29:19 2010 +0200
s3: use monotonic clock for aio timeout
commit 8833adb04ffeb21848b56bb6606ca2982ccca1e4
Author: Björn Jacke <bj at sernet.de>
Date: Tue Sep 7 03:05:35 2010 +0200
s3/nmbd: tidy up debug message: ttl isn't a hex value
commit a63822f5d22e14315099050166c64826f69b46c9
Author: Björn Jacke <bj at sernet.de>
Date: Tue Sep 7 01:54:01 2010 +0200
s3/libads: use monotonic clock for DNS timeouts
commit b428952eefd250d6d4ce77ad89325e9803940d11
Author: Björn Jacke <bj at sernet.de>
Date: Mon Sep 6 20:27:24 2010 +0200
lib/util: add time_mono() for monotonic time a la time()
-----------------------------------------------------------------------
Summary of changes:
lib/util/time.c | 21 +++++++++++++++++++++
lib/util/time.h | 5 +++++
source3/libads/dns.c | 10 +++++-----
source3/nmbd/nmbd_winsserver.c | 2 +-
source3/smbd/aio.c | 4 ++--
5 files changed, 34 insertions(+), 8 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/util/time.c b/lib/util/time.c
index 5ecf93c..ed3b4f8 100644
--- a/lib/util/time.c
+++ b/lib/util/time.c
@@ -65,6 +65,27 @@ _PUBLIC_ void clock_gettime_mono(struct timespec *tp)
}
}
+/**
+a wrapper to preferably get the monotonic time in seconds
+as this is only second resolution we can use the cached
+(and much faster) COARS clock variant
+**/
+_PUBLIC_ time_t time_mono(time_t *t)
+{
+ struct timespec tp;
+ int rc = -1;
+#ifdef CLOCK_MONOTONIC_COARSE
+ rc = clock_gettime(CLOCK_MONOTONIC_COARSE,&tp);
+#endif
+ if (rc != 0) {
+ clock_gettime_mono(&tp);
+ }
+ if (t != NULL) {
+ *t = tp.tv_sec;
+ }
+ return tp.tv_sec;
+}
+
#define TIME_FIXUP_CONSTANT 11644473600LL
diff --git a/lib/util/time.h b/lib/util/time.h
index 720a262..345382b 100644
--- a/lib/util/time.h
+++ b/lib/util/time.h
@@ -56,6 +56,11 @@ a wrapper to preferably get the monotonic time
_PUBLIC_ void clock_gettime_mono(struct timespec *tp);
/**
+a wrapper to preferably get the monotonic time in s
+**/
+_PUBLIC_ time_t time_mono(time_t *t);
+
+/**
interpret an 8 byte "filetime" structure to a time_t
It's originally in "100ns units since jan 1st 1601"
**/
diff --git a/source3/libads/dns.c b/source3/libads/dns.c
index 8d23ce1..e7d8a40 100644
--- a/source3/libads/dns.c
+++ b/source3/libads/dns.c
@@ -297,7 +297,7 @@ static NTSTATUS dns_send_req( TALLOC_CTX *ctx, const char *name, int q_type,
int resp_len = NS_PACKETSZ;
static time_t last_dns_check = 0;
static NTSTATUS last_dns_status = NT_STATUS_OK;
- time_t now = time(NULL);
+ time_t now = time_mono(NULL);
/* Try to prevent bursts of DNS lookups if the server is down */
@@ -332,7 +332,7 @@ static NTSTATUS dns_send_req( TALLOC_CTX *ctx, const char *name, int q_type,
DEBUG(0,("ads_dns_lookup_srv: "
"talloc() failed!\n"));
last_dns_status = NT_STATUS_NO_MEMORY;
- last_dns_check = time(NULL);
+ last_dns_check = time_mono(NULL);
return last_dns_status;
}
}
@@ -351,7 +351,7 @@ static NTSTATUS dns_send_req( TALLOC_CTX *ctx, const char *name, int q_type,
if (errno == ECONNREFUSED) {
last_dns_status = NT_STATUS_CONNECTION_REFUSED;
}
- last_dns_check = time(NULL);
+ last_dns_check = time_mono(NULL);
return last_dns_status;
}
@@ -365,7 +365,7 @@ static NTSTATUS dns_send_req( TALLOC_CTX *ctx, const char *name, int q_type,
name));
TALLOC_FREE( buffer );
last_dns_status = NT_STATUS_BUFFER_TOO_SMALL;
- last_dns_check = time(NULL);
+ last_dns_check = time_mono(NULL);
return last_dns_status;
}
@@ -378,7 +378,7 @@ static NTSTATUS dns_send_req( TALLOC_CTX *ctx, const char *name, int q_type,
*buf = buffer;
*resp_length = resp_len;
- last_dns_check = time(NULL);
+ last_dns_check = time_mono(NULL);
last_dns_status = NT_STATUS_OK;
return last_dns_status;
}
diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c
index 4232afc..5f3a9c3 100644
--- a/source3/nmbd/nmbd_winsserver.c
+++ b/source3/nmbd/nmbd_winsserver.c
@@ -425,7 +425,7 @@ static void update_wins_flag(struct name_record *namerec, int flags)
/* and add the given bits */
namerec->data.wins_flags|=flags;
- DEBUG(8,("update_wins_flag: nbflags: 0x%x, ttl: 0x%d, flags: 0x%x, winsflags: 0x%x\n",
+ DEBUG(8,("update_wins_flag: nbflags: 0x%x, ttl: %d, flags: 0x%x, winsflags: 0x%x\n",
namerec->data.nb_flags, (int)namerec->data.death_time, flags, namerec->data.wins_flags));
}
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index 677fbb6..7a23d37 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -900,7 +900,7 @@ int wait_for_aio_completion(files_struct *fsp)
struct aio_extra *aio_ex;
const SMB_STRUCT_AIOCB **aiocb_list;
int aio_completion_count = 0;
- time_t start_time = time(NULL);
+ time_t start_time = time_mono(NULL);
int seconds_left;
for (seconds_left = SMB_TIME_FOR_AIO_COMPLETE_WAIT;
@@ -975,7 +975,7 @@ int wait_for_aio_completion(files_struct *fsp)
SAFE_FREE(aiocb_list);
seconds_left = SMB_TIME_FOR_AIO_COMPLETE_WAIT
- - (time(NULL) - start_time);
+ - (time_mono(NULL) - start_time);
}
/* We timed out - we don't know why. Return ret if already an error,
--
Samba Shared Repository
More information about the samba-cvs
mailing list