public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* Re: [LTP] [PATCH] Add autoconf tests for taskstats members not present on older kernels
       [not found] <200907071050.n67AooL6008612@e5.ny.us.ibm.com>
@ 2009-07-07 15:32 ` Subrata Modak
  0 siblings, 0 replies; 4+ messages in thread
From: Subrata Modak @ 2009-07-07 15:32 UTC (permalink / raw)
  To: Jiri Palecek; +Cc: ltp-list

On Tue, 2009-07-07 at 11:25 +0200, Jiri Palecek wrote: 
> Hello,
> 
> this patch adds autoconf checks for some build failures reported by Cyril Hrubis. Please note I have not tested this on an old kernel.
> 
> Also, it corrects the names of the preprocessor macros defined by autoconf
> 
> The remaining issue (the cgroupstats.h file) should be solved using the autoconf test that was committed recently.
> 
> Regards
>     Jiri Palecek
> 
> Signed-off-by: Jiri Palecek <jpalecek@web.de>

Thanks.

Regards--
Subrata

> ---
>  include/config.h.default                        |   12 ++++++++++--
>  m4/ltp-taskstats.m4                             |    2 +-
>  testcases/kernel/controllers/cgroup/getdelays.c |    9 +++++++--
>  3 files changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/include/config.h.default b/include/config.h.default
> index b9a6731..aa76a34 100644
> --- a/include/config.h.default
> +++ b/include/config.h.default
> @@ -10,9 +10,17 @@
>  /* signalfd() is in glibc-2.7+ */
>  #define HAVE_SYS_SIGNALFD_H 1
>  #define HAVE_SIGNALFD 1
> -#define HAVE_SIGNALFD_SIGINFO_SSI_SIGNO 1
> +#define HAVE_STRUCT_SIGNALFD_SIGINFO_SSI_SIGNO 1
> 
>  /* ifaddrs.h is in glibc-2.3+ */
>  #define HAVE_IFADDRS_H 1
> 
> -#define HAVE_TASKSTATS_FREEPAGES_COUNT 1
> +/* 2.6.27 */
> +#define HAVE_STRUCT_TASKSTATS_FREEPAGES_COUNT 1
> +
> +/* 2.6.23 */
> +#define HAVE_STRUCT_TASKSTATS_NVCSW 1
> +
> +/* 2.6.20 */
> +#define HAVE_STRUCT_TASKSTATS_READ_BYTES 1
> +
> diff --git a/m4/ltp-taskstats.m4 b/m4/ltp-taskstats.m4
> index 54da783..63e10a2 100644
> --- a/m4/ltp-taskstats.m4
> +++ b/m4/ltp-taskstats.m4
> @@ -30,7 +30,7 @@ dnl
> 
>  AC_DEFUN([_LTP_CHECK_TASKSTATS_FREEPAGES],
>  [dnl
> -AC_CHECK_MEMBERS([struct taskstats.freepages_count],[],[],[dnl
> +AC_CHECK_MEMBERS([struct taskstats.freepages_count, struct taskstats.nvcsw, struct taskstats.read_bytes],[],[],[dnl
>  #include <linux/types.h>
>  #include <linux/taskstats.h>
>  ])
> diff --git a/testcases/kernel/controllers/cgroup/getdelays.c b/testcases/kernel/controllers/cgroup/getdelays.c
> index 9fe2831..0813a96 100644
> --- a/testcases/kernel/controllers/cgroup/getdelays.c
> +++ b/testcases/kernel/controllers/cgroup/getdelays.c
> @@ -27,6 +27,7 @@
>  #include <linux/taskstats.h>
>  #include <linux/cgroupstats.h>
> 
> +#include "config.h"
>  /*
>   * Generic macros for dealing with netlink sockets. Might be duplicated
>   * elsewhere. It is recommended that commercial grade applications use
> @@ -199,7 +200,7 @@ void print_delayacct(struct taskstats *t)
>  	       "SWAP  %15s%15s\n"
>  	       "      %15llu%15llu\n"
>  	       "RECLAIM  %12s%15s\n"
> -#ifdef HAVE_TASKSTATS_FREEPAGES_COUNT
> +#ifdef HAVE_STRUCT_TASKSTATS_FREEPAGES_COUNT
>  	       "      %15llu%15llu\n"
>  #endif
>  	       , "count", "real total", "virtual total", "delay total",
> @@ -214,7 +215,7 @@ void print_delayacct(struct taskstats *t)
>  	       (unsigned long long)t->swapin_count,
>  	       (unsigned long long)t->swapin_delay_total,
>  	       "count", "delay total"
> -#ifdef HAVE_TASKSTATS_FREEPAGES_COUNT
> +#ifdef HAVE_STRUCT_TASKSTATS_FREEPAGES_COUNT
>  	       , (unsigned long long)t->freepages_count,
>  	       (unsigned long long)t->freepages_delay_total
>  #endif
> @@ -223,10 +224,12 @@ void print_delayacct(struct taskstats *t)
> 
>  void task_context_switch_counts(struct taskstats *t)
>  {
> +#ifdef HAVE_STRUCT_TASKSTATS_NVCSW
>  	printf("\n\nTask   %15s%15s\n"
>  	       "       %15llu%15llu\n",
>  	       "voluntary", "nonvoluntary",
>  	       (unsigned long long)t->nvcsw, (unsigned long long)t->nivcsw);
> +#endif
>  }
> 
>  void print_cgroupstats(struct cgroupstats *c)
> @@ -242,11 +245,13 @@ void print_cgroupstats(struct cgroupstats *c)
> 
>  void print_ioacct(struct taskstats *t)
>  {
> +#ifdef HAVE_STRUCT_TASKSTATS_READ_BYTES
>  	printf("%s: read=%llu, write=%llu, cancelled_write=%llu\n",
>  		t->ac_comm,
>  		(unsigned long long)t->read_bytes,
>  		(unsigned long long)t->write_bytes,
>  		(unsigned long long)t->cancelled_write_bytes);
> +#endif
>  }
> 
>  int main(int argc, char *argv[])
> -- 
> 1.6.3.3
> 
> 
> 
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge  
> This is your chance to win up to $100,000 in prizes! For a limited time, 
> vendors submitting new applications to BlackBerry App World(TM) will have 
> the opportunity to enter the BlackBerry Developer Challenge. See full prize 
> details at: http://p.sf.net/sfu/blackberry
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have 
the opportunity to enter the BlackBerry Developer Challenge. See full prize 
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH] Add autoconf tests for taskstats members not present on older kernels
@ 2009-08-28 15:24 Cyril Hrubis
       [not found] ` <200908281144.24993.vapier@gentoo.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2009-08-28 15:24 UTC (permalink / raw)
  To: Jiri Palecek; +Cc: ltp-list

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]

Hi!
> this patch adds autoconf checks for some build failures reported by Cyril Hrubis. Please note I have not tested this on an old kernel.
> 
> Also, it corrects the names of the preprocessor macros defined by autoconf
> 
> The remaining issue (the cgroupstats.h file) should be solved using the autoconf test that was committed recently.

The autoconf part is okay, but getdelays.c needs some more #ifdef
HAVE_LINUX_CGROUPSTAT_H to build correctly on all I have here.

Patch attached, however it may need minor cleanups.

Signed-off-by: Cyril Hrubis chrubis@suse.cz

-- 
Cyril Hrubis
chrubis@suse.cz

[-- Attachment #2: getdalays_no_cgroupstats_h.patch --]
[-- Type: text/x-patch, Size: 2031 bytes --]

Index: ltp-full-20090731/testcases/kernel/controllers/cgroup/getdelays.c
===================================================================
--- ltp-full-20090731.orig/testcases/kernel/controllers/cgroup/getdelays.c
+++ ltp-full-20090731/testcases/kernel/controllers/cgroup/getdelays.c
@@ -23,11 +23,15 @@
 #include <sys/socket.h>
 #include <signal.h>
 
+#include "config.h"
+
 #include <linux/genetlink.h>
 #include <linux/taskstats.h>
+
+#ifdef HAVE_LINUX_CGROUPSTATS_H
 #include <linux/cgroupstats.h>
+#endif
 
-#include "config.h"
 /*
  * Generic macros for dealing with netlink sockets. Might be duplicated
  * elsewhere. It is recommended that commercial grade applications use
@@ -232,6 +236,8 @@ void task_context_switch_counts(struct t
 #endif
 }
 
+#ifdef HAVE_LINUX_CGROUPSTATS_H
+
 void print_cgroupstats(struct cgroupstats *c)
 {
 	printf("sleeping %llu, blocked %llu, running %llu, stopped %llu, "
@@ -242,6 +248,7 @@ void print_cgroupstats(struct cgroupstat
 		(unsigned long long)c->nr_uninterruptible);
 }
 
+#endif
 
 void print_ioacct(struct taskstats *t)
 {
@@ -390,6 +397,7 @@ int main(int argc, char *argv[])
 	}
 
 	if (containerset) {
+		#ifdef HAVE_LINUX_CGROUPSTAT_H
 		cfd = open(containerpath, O_RDONLY);
 		if (cfd < 0) {
 			perror("error opening container file");
@@ -401,6 +409,10 @@ int main(int argc, char *argv[])
 			perror("error sending cgroupstats command");
 			exit(1);
 		}
+		#else
+			printf("Header linux/cgroupstat.h was missing during compilation,"
+			       "you may have old or incomplete kernel-headers.\n");
+		#endif
 	}
 	if (!maskset && !tid && !containerset) {
 		usage();
@@ -484,10 +496,11 @@ int main(int argc, char *argv[])
 					na = (struct nlattr *) ((char *) na + len2);
 				}
 				break;
-
+			#ifdef HAVE_LINUX_CGROUPSTATS_H
 			case CGROUPSTATS_TYPE_CGROUP_STATS:
 				print_cgroupstats(NLA_DATA(na));
 				break;
+			#endif
 			default:
 				fprintf(stderr, "Unknown nla_type %d\n",
 					na->nla_type);
@@ -513,3 +526,4 @@ done:
 		close(cfd);
 	return 0;
 }
+

[-- Attachment #3: Type: text/plain, Size: 355 bytes --]

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH] Add autoconf tests for taskstats members not present?on older kernels
       [not found] ` <200908281144.24993.vapier@gentoo.org>
@ 2009-08-28 16:02   ` Cyril Hrubis
  0 siblings, 0 replies; 4+ messages in thread
From: Cyril Hrubis @ 2009-08-28 16:02 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: ltp-list, Jiri Palecek

Hi!
> > > this patch adds autoconf checks for some build failures reported by Cyril
> > > Hrubis. Please note I have not tested this on an old kernel.
> > >
> > > Also, it corrects the names of the preprocessor macros defined by
> > > autoconf
> > >
> > > The remaining issue (the cgroupstats.h file) should be solved using the
> > > autoconf test that was committed recently.
> >
> > The autoconf part is okay, but getdelays.c needs some more #ifdef
> > HAVE_LINUX_CGROUPSTAT_H to build correctly on all I have here.
> >
> > Patch attached, however it may need minor cleanups.
> 
> preprocessor macros should never be intended

I allways forgot this one...

> can the test case pass at all if the linux headers are missing ?  if they 
> cant, there's no point in sprinkling #ifdef's throughout the code.  stub the 
> whole thing out.

As far as I see the cgroupstat code is activated only by -C switch, so it does
make sence spread #ifdefs around.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [PATCH] Add autoconf tests for taskstats members not present on older kernels
@ 2009-08-31 11:51 Cyril Hrubis
  0 siblings, 0 replies; 4+ messages in thread
From: Cyril Hrubis @ 2009-08-31 11:51 UTC (permalink / raw)
  To: ltp-list

[-- Attachment #1: Type: text/plain, Size: 135 bytes --]

Hi,
this is cleaned version of previously posted patch.

Signed-off-by: Cyril Hrubis chrubis@suse.cz

-- 
Cyril Hrubis
chrubis@suse.cz

[-- Attachment #2: getdalays_no_cgroupstats_h.patch --]
[-- Type: text/x-patch, Size: 2019 bytes --]

Index: ltp-full-20090731/testcases/kernel/controllers/cgroup/getdelays.c
===================================================================
--- ltp-full-20090731.orig/testcases/kernel/controllers/cgroup/getdelays.c
+++ ltp-full-20090731/testcases/kernel/controllers/cgroup/getdelays.c
@@ -23,11 +23,15 @@
 #include <sys/socket.h>
 #include <signal.h>
 
+#include "config.h"
+
 #include <linux/genetlink.h>
 #include <linux/taskstats.h>
+
+#ifdef HAVE_LINUX_CGROUPSTATS_H
 #include <linux/cgroupstats.h>
+#endif
 
-#include "config.h"
 /*
  * Generic macros for dealing with netlink sockets. Might be duplicated
  * elsewhere. It is recommended that commercial grade applications use
@@ -232,6 +236,8 @@ void task_context_switch_counts(struct t
 #endif
 }
 
+#ifdef HAVE_LINUX_CGROUPSTATS_H
+
 void print_cgroupstats(struct cgroupstats *c)
 {
 	printf("sleeping %llu, blocked %llu, running %llu, stopped %llu, "
@@ -242,6 +248,7 @@ void print_cgroupstats(struct cgroupstat
 		(unsigned long long)c->nr_uninterruptible);
 }
 
+#endif
 
 void print_ioacct(struct taskstats *t)
 {
@@ -390,6 +397,7 @@ int main(int argc, char *argv[])
 	}
 
 	if (containerset) {
+#ifdef HAVE_LINUX_CGROUPSTAT_H
 		cfd = open(containerpath, O_RDONLY);
 		if (cfd < 0) {
 			perror("error opening container file");
@@ -401,6 +409,10 @@ int main(int argc, char *argv[])
 			perror("error sending cgroupstats command");
 			exit(1);
 		}
+#else
+			printf("Header linux/cgroupstat.h was missing during compilation,"
+			       "you may have old or incomplete kernel-headers.\n");
+#endif
 	}
 	if (!maskset && !tid && !containerset) {
 		usage();
@@ -484,10 +496,11 @@ int main(int argc, char *argv[])
 					na = (struct nlattr *) ((char *) na + len2);
 				}
 				break;
-
+#ifdef HAVE_LINUX_CGROUPSTATS_H
 			case CGROUPSTATS_TYPE_CGROUP_STATS:
 				print_cgroupstats(NLA_DATA(na));
 				break;
+#endif
 			default:
 				fprintf(stderr, "Unknown nla_type %d\n",
 					na->nla_type);
@@ -513,3 +526,4 @@ done:
 		close(cfd);
 	return 0;
 }
+

[-- Attachment #3: Type: text/plain, Size: 355 bytes --]

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-08-31 11:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200907071050.n67AooL6008612@e5.ny.us.ibm.com>
2009-07-07 15:32 ` [LTP] [PATCH] Add autoconf tests for taskstats members not present on older kernels Subrata Modak
2009-08-28 15:24 Cyril Hrubis
     [not found] ` <200908281144.24993.vapier@gentoo.org>
2009-08-28 16:02   ` [LTP] [PATCH] Add autoconf tests for taskstats members not present?on " Cyril Hrubis
  -- strict thread matches above, loose matches on Subject: below --
2009-08-31 11:51 [LTP] [PATCH] Add autoconf tests for taskstats members not present on " Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox