Skip to contentSkip to conversation

sched_stress: Use time_t instead of long for type

PATCH In review Khem Raj 2 participants 4 messages May 6, 2024 – May 7, 2024

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 sched_stress: Use time_t instead of long for type

This ensures it works across different architectures Fixes

| sched_driver.c:744:43: error: passing argument 1 of 'ctime' from incompatible pointer type [-Wincompatible-pointer-types]
|   744 |         printf("\nend time = %s\n", ctime(&end_time));
|       |                                           ^~~~~~~~~

With gcc-14

---
 testcases/kernel/sched/sched_stress/sched_driver.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
testcases/kernel/sched/sched_stress/sched_driver.c +3 -3
index 61573d788..5b8c187fe 100644
@@ -136,7 +136,7 @@ int debug = 0;
 /*
  * Function prototypes
  */
-void startup(long);
+void startup(time_t);
 int start_testcase(char *, char *, char *, char *, char *, char *);
 int process_slots_in_use();
 int available_user_process_slots();
@@ -251,7 +251,7 @@ int main(int argc, char **argv)
  * information to the screen and .  It also initializes the	 *
  * process id list and other global variables.	 			 *
  *-----------------------------------------------------------------------*/
-void startup(long start_time)
+void startup(time_t start_time)
 {
 	char tempbuffer[50];	/* temporary buffer to hold names */
 
@@ -734,7 +734,7 @@ void kill_short_term_testcases()
 void finishup(start_time)
 long start_time;		/* starting time to calculate elapsed time */
 {
-	long end_time;		/* time when program finished */
+	time_t end_time;		/* time when program finished */
 
 	/*
 	 * Get the end time and calculate elapsed time; write all this out
Signature · 5 lines
2.45.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Khem,

Quoted 8 lines

This ensures it works across different architectures Fixes

| sched_driver.c:744:43: error: passing argument 1 of 'ctime' from incompatible pointer type [-Wincompatible-pointer-types]
|   744 |         printf("\nend time = %s\n", ctime(&end_time));
|       |                                           ^~~~~~~~~

With gcc-14

This was actually problem on musl, right?

Anyway, thanks for the fix, merged.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#2 lore raw
Quoted 5 lines · Petr Vorel

Hi Khem,

Quoted 2 lines

This ensures it works across different architectures Fixes

Quoted 8 lines
Quoted 1 line

| sched_driver.c:744:43: error: passing argument 1 of 'ctime' from

incompatible pointer type [-Wincompatible-pointer-types]

Quoted 4 lines
|   744 |         printf("\nend time = %s\n", ctime(&end_time));
|       |                                           ^~~~~~~~~

With gcc-14

This was actually problem on musl, right?

This is with 32 bit x86 using 64bit time_r this time :) we have umpteen ways to build systems with yocto

Quoted 7 lines

Anyway, thanks for the fix, merged.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw
Quoted 12 lines · Petr Vorel
Quoted 10 lines

Hi Khem,

Quoted 4 lines

This ensures it works across different architectures Fixes

| sched_driver.c:744:43: error: passing argument 1 of 'ctime' from

incompatible pointer type [-Wincompatible-pointer-types]

Quoted 2 lines
|   744 |         printf("\nend time = %s\n", ctime(&end_time));
|       |                                           ^~~~~~~~~
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

With gcc-14

This was actually problem on musl, right?

This is with 32 bit x86 using 64bit time_r this time :) we have umpteen ways to build systems with yocto

Thanks for info! I wonder if this is the only place where it's needed.

I'm not sure how much is sched_driver.c relevant nowadays. If yes, it would be worth to at least fix other warnings, remove ia64 support and #if 0.

Kind regards,
Petr

Quoted 4 lines
Quoted 4 lines

Anyway, thanks for the fix, merged.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp