without checking via configugre and pre-processer (HAVE_SETTIMEOFDAY) whether this does exist in the given platform.
On 2011-04-24 at 18:51 +0200 samba-bugs@samba.org sent off: > https://bugzilla.samba.org/show_bug.cgi?id=8105 > > Summary: source3/utils/net_time.c uses settimeofday... > Product: Samba 3.6 > Version: 3.6.0pre2 > Platform: IA64 > OS/Version: Other > Status: NEW > Severity: normal > Priority: P5 > Component: Build environment > AssignedTo: bj@sernet.de > ReportedBy: schmitz@hp.com > QAContact: samba-qa@samba.org > > > without checking via configugre and pre-processer (HAVE_SETTIMEOFDAY) whether > this does exist in the given platform. just out of interest - which systems do you have which do not have settimeofday() ?
HP NonStop doesn't have settimeofday()
> HP NonStop doesn't have settimeofday() but gettimeofday() exists ? How about clock_settime() ?
gettimeofday() does exist, clock_settime() does not.
> --- Comment #4 from Joachim Schmitz <schmitz@hp.com> 2011-04-26 08:39:14 UTC --- > gettimeofday() does exist, clock_settime() does not. interesting ... can you find out which function is being used to set the system clock on that OS ?
I'm affraid only a prorietary one, nothing that would be portable in any form or shape. We have a SETSYSTEMCLOCK(), see http://bizsupport2.austin.hp.com/bc/docs/support/SupportManual/c02734252/c02734252.pdf For now my 'fix' is this: diff -u ./source3/utils/net_time.c.orig ./source3/utils/net_time.c --- ./source3/utils/net_time.c.orig 2011-04-12 09:03:35.000000000 -0500 +++ ./source3/utils/net_time.c 2011-04-24 10:10:28.000000000 -0500 @@ -115,7 +115,12 @@ if (tv.tv_sec == 0) return -1; +#ifdef HAVE_SETTIMEOFDAY /* ToDo: Needs a proper check in configure! */ result = settimeofday(&tv,NULL); +#else + result = -1; + errno = ENOSYS; +#endif if (result) d_fprintf(stderr, _("setting system clock failed. Error was (%s)\n"), Without the corresponding check in configure...
> I'm affraid only a prorietary one, nothing that would be portable in any form > or shape. We have a SETSYSTEMCLOCK(), see > http://bizsupport2.austin.hp.com/bc/docs/support/SupportManual/c02734252/c02734252.pdf could you add a libreplace wrapper which implements settimeofday() using setsystemclock()? You may have a look at the clock_gettime() replacement hooks in lib/replace/ to see where you need to start.
(In reply to comment #7) > > I'm affraid only a prorietary one, nothing that would be portable in any form > > or shape. We have a SETSYSTEMCLOCK(), see > > http://bizsupport2.austin.hp.com/bc/docs/support/SupportManual/c02734252/c02734252.pdf > could you add a libreplace wrapper which implements settimeofday() using > setsystemclock()? You may have a look at the clock_gettime() replacement hooks > in lib/replace/ to see where you need to start. I've now created the following (as I said earlier: most probably nobody outsite HP NonStop would be able to use it): #include <sys/time.h> #include <stdio.h> #include <errno.h> #include <cextdecs.h(SETSYSTEMCLOCK,COMPUTETIMESTAMP)> #include <tal.h> int settimeofday(const struct timeval* tv, const struct timezone *tz) { long long julian_gmt; short date_n_time[8] = { 1970, 1, 1, 0, 0, 0, 0, 0}; /* the 'Epoch' */ if (tz != NULL || tv == NULL) { errno = EINVAL; /* invalid argument */ return -1; } /* usecs since the 'Epoch' */ julian_gmt = (tv->tv_sec * 1000000LL) + tv->tv_usec; /* correction to match Guardian timestamps */ julian_gmt += COMPUTETIMESTAMP(date_n_time); if (_status_lt(SETSYSTEMCLOCK(julian_gmt, 7))) { /* set absolute GMT */ errno = EPERM; /* insufficient privilege */ return -1; } return 0; } As far as I'm concerned this problem is fixed, for me at least. However: there may well be other plattforms that don't have a settimeofday() ... bye, Jojo
There hasn#t happaned anything on this ffor more than a year, and as it works for me, I'll close this issue