diff mbox

[25/27] xfs_scrub: progress indicator

Message ID 4e784dc2-f24e-bd9d-f0c4-c0997a7ad793@sandeen.net (mailing list archive)
State Superseded
Headers show

Commit Message

Eric Sandeen Jan. 11, 2018, 11:27 p.m. UTC
On 1/5/18 7:54 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>


> +#define NSEC_PER_SEC	(1000000000)
> +static void *
> +progress_report_thread(void *arg)
> +{
> +	struct timespec		abstime;
> +	int			ret;
> +
> +	pthread_mutex_lock(&pt.lock);
> +	while (1) {
> +		/* Every half second. */
> +		ret = clock_gettime(CLOCK_REALTIME, &abstime);


My manpage says "link with -rt" and to include <time.h>, this got me
going:


--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Darrick J. Wong Jan. 12, 2018, 12:32 a.m. UTC | #1
On Thu, Jan 11, 2018 at 05:27:54PM -0600, Eric Sandeen wrote:
> On 1/5/18 7:54 PM, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> 
> > +#define NSEC_PER_SEC	(1000000000)
> > +static void *
> > +progress_report_thread(void *arg)
> > +{
> > +	struct timespec		abstime;
> > +	int			ret;
> > +
> > +	pthread_mutex_lock(&pt.lock);
> > +	while (1) {
> > +		/* Every half second. */
> > +		ret = clock_gettime(CLOCK_REALTIME, &abstime);
> 
> 
> My manpage says "link with -rt" and to include <time.h>, this got me
> going:
> 
> diff --git a/scrub/Makefile b/scrub/Makefile
> index 3e6f690..0094d9d 100644
> --- a/scrub/Makefile
> +++ b/scrub/Makefile
> @@ -67,7 +67,7 @@ xfs_scrub.c
>  
>  LLDLIBS += $(LIBHANDLE) $(LIBFROG) $(LIBPTHREAD) $(LIBUNISTRING)
>  LTDEPENDENCIES += $(LIBHANDLE) $(LIBFROG) $(LIBUNISTRING)
> -LLDFLAGS = -static
> +LLDFLAGS = -static -lrt

I added $(LIBRT) to the end of LLDLIBS/LTDEPENDENCIES since we already
defined it elsewhere in the autoconf goo for benefit of the other
programs.

>  
>  ifeq ($(HAVE_MALLINFO),yes)
>  LCFLAGS += -DHAVE_MALLINFO
> diff --git a/scrub/progress.c b/scrub/progress.c
> index 30b2152..61b9c60 100644
> --- a/scrub/progress.c
> +++ b/scrub/progress.c
> @@ -22,6 +22,7 @@
>  #include <dirent.h>
>  #include <pthread.h>
>  #include <sys/statvfs.h>
> +#include <time.h>

Fixed.

--D

>  #include "../repair/threads.h"
>  #include "path.h"
>  #include "disk.h"
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scrub/Makefile b/scrub/Makefile
index 3e6f690..0094d9d 100644
--- a/scrub/Makefile
+++ b/scrub/Makefile
@@ -67,7 +67,7 @@  xfs_scrub.c
 
 LLDLIBS += $(LIBHANDLE) $(LIBFROG) $(LIBPTHREAD) $(LIBUNISTRING)
 LTDEPENDENCIES += $(LIBHANDLE) $(LIBFROG) $(LIBUNISTRING)
-LLDFLAGS = -static
+LLDFLAGS = -static -lrt
 
 ifeq ($(HAVE_MALLINFO),yes)
 LCFLAGS += -DHAVE_MALLINFO
diff --git a/scrub/progress.c b/scrub/progress.c
index 30b2152..61b9c60 100644
--- a/scrub/progress.c
+++ b/scrub/progress.c
@@ -22,6 +22,7 @@ 
 #include <dirent.h>
 #include <pthread.h>
 #include <sys/statvfs.h>
+#include <time.h>
 #include "../repair/threads.h"
 #include "path.h"
 #include "disk.h"