On Wed, Sep 23, 2015 at 5:25 AM, Dave Chinner <david@xxxxxxxxxxxxx> wrote:
On Tue, Sep 15, 2015 at 11:59:20AM +0200, Jan Tulak wrote:
> OS X does not have the timer used in xfs_repair.
> Add a simple implementation providing the required
> capabilities.
....
That's pretty nasty. How about this:> #endif /* __XFS_DARWIN_H__ */
> diff --git a/repair/progress.c b/repair/progress.c
> index 27cbaef..0fee7dc 100644
> --- a/repair/progress.c
> +++ b/repair/progress.c
> @@ -184,10 +184,22 @@ progress_rpt_thread (void *p)
> */
>
> timespec.it_value.tv_sec = msgp->interval;
> - timespec.it_value.tv_nsec = 0;
> timespec.it_interval.tv_sec = msgp->interval;
> + /*
> + * On some platforms (like OS X), timers and time things are slightly
> + * different: itimerspec is replaced with itimerval and timeval struct
> + * has no tv_nsec, but just tv_usec member.
> + * For compatibility, itimerspec is a macro defined to the existing
> + * itimerval on these platforms, and in such case, use usec instead
> + * of nsec.
> + */
> +#ifndef itimerspec
> + timespec.it_value.tv_nsec = 0;
> timespec.it_interval.tv_nsec = 0;
> -
> +#else
> + timespec.it_value.tv_usec = 0;
> + timespec.it_interval.tv_usec = 0;
> +#endif
memset(×pec, 0, sizeof(timespec));
timespec.it_value.tv_sec = msgp->interval;
timespec.it_interval.tv_sec = msgp->interval;
This is much better and elegant solution. :-)
Cheers,
Jan
_______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs