Skip to contentSkip to conversation

Broken Fedora build

LTP Petr Vorel 5 participants 8 messages Oct 21, 2020 – Oct 22, 2020

lore
Share & tools
lore
#1 lore raw
Quoted 4 lines · Petr Vorel

Fedora build is broken due missing <sys/timeb.h> [1].
Quick fix would probably be to use Fedora 33 instead of Rawhide. [2] But we should port hugetlb.c and trace_sched.c (if used) to gettimeofday or clock_gettime. [3]

+1
I prefer to go replace ftime() by gettimeofday() or clock_gettime() way to solve this from root.

Signature · 2 lines
Regards,
Li Wang
#2 lore raw

Hi Li,Petr

Quoted 10 lines
Quoted 4 lines · Petr Vorel

Fedora build is broken due missing<sys/timeb.h> [1].
Quick fix would probably be to use Fedora 33 instead of Rawhide. [2] But we should port hugetlb.c and trace_sched.c (if used) to gettimeofday or clock_gettime. [3]

+1
I prefer to go replace ftime() by gettimeofday() or clock_gettime() way to solve this from root.

+1

I have seen the hugetlb.c and trace_sched.c code, they all use the time to generate a random value for ftok or sched_priority. So using gettimeofday() also looks ok.

I will send a patch to use gettimeofday.

Best Regards
Yang Xu

Quoted 1 line
#3 lore raw
Quoted 9 lines · Yang Xu

Hi Li,Petr

Quoted 8 lines
Quoted 5 lines · Petr Vorel

Fedora build is broken due missing<sys/timeb.h> [1]. Quick fix would probably be to use Fedora 33 instead of Rawhide. [2] But we should port hugetlb.c and trace_sched.c (if used) to gettimeofday or
clock_gettime. [3]

Quoted 8 lines
Quoted 3 lines

+1
I prefer to go replace ftime() by gettimeofday() or clock_gettime() way to solve this from root.

+1

I have seen the hugetlb.c and trace_sched.c code, they all use the time to generate a random value for ftok or sched_priority. So using gettimeofday() also looks ok.

Hi,

It is fine for me to replace ftime(), but I wonder if we can remove fime() and srand()/srandom() directly? :-)
It seems unnecessary to set the seed for random number.

Best Regards,
Xiao Yang

Quoted 10 lines

I will send a patch to use gettimeofday.

Best Regards
Yang Xu

Quoted 1 line
#4 lore raw
Quoted 4 lines · Xiao Yang
Quoted 4 lines
Quoted 2 lines

I prefer to go replace ftime() by gettimeofday() or clock_gettime() way to solve this from root.

+1

Quoted 8 lines
Quoted 3 lines

I have seen the hugetlb.c and trace_sched.c code, they all use the time to generate a random value for ftok or sched_priority. So using gettimeofday() also looks ok.

Hi,

It is fine for me to replace ftime(), but I wonder if we can remove fime() and srand()/srandom() directly? :-)
It seems unnecessary to set the seed for random number.

That's true, but random() will generate the same number each time. I slightly tend to keep setting the seed by srandom() to get a different randomized number for test variety.

Signature · 2 lines
Regards,
Li Wang
#7 lore raw
In reply to Li Wang

----- Original Message -----

Quoted 10 lines
Quoted 4 lines · Petr Vorel

Fedora build is broken due missing <sys/timeb.h> [1].
Quick fix would probably be to use Fedora 33 instead of Rawhide. [2] But we should port hugetlb.c and trace_sched.c (if used) to gettimeofday or clock_gettime. [3]

+1
I prefer to go replace ftime() by gettimeofday() or clock_gettime() way to solve this from root.

Agreed, ftime is marked as obsolete.

#5 lore raw
In reply to Li Wang

Hi Li

Quoted 9 lines
Quoted 7 lines · Xiao Yang
Quoted 7 lines
Quoted 2 lines

I prefer to go replace ftime() by gettimeofday() or clock_gettime() way to solve this from root.

+1

I have seen the hugetlb.c and trace_sched.c code, they all use the time to generate a random value for ftok or sched_priority. So using gettimeofday() also looks ok.

Quoted 7 lines
Quoted 5 lines

Hi,

It is fine for me to replace ftime(), but I wonder if we can remove fime() and srand()/srandom() directly? :-)
It seems unnecessary to set the seed for random number.

That's true, but random() will generate the same number each time.

Agree. If we don't call srandom, repeatly call random binary will give same random num. ie
root@localhost ~]# ./random
random num 1804289383
random num 846930886
random num 1681692777
random num 1714636915
random num 1957747793
random num 424238335
random num 719885386
random num 1649760492
random num 596516649
random num 1189641421
[root@localhost ~]# ./random
random num 1804289383
random num 846930886
random num 1681692777
random num 1714636915
random num 1957747793
random num 424238335
random num 719885386
random num 1649760492
random num 596516649
random num 1189641421
[root@localhost ~]# cat random.c
#include <stdlib.h>
#include <stdio.h>

void main(void)

{
         int num,i;
         for (i=0;i<10;i++) {
                 num =random();
                 printf("random num %d\n", num);
         }
}

[root@localhost ~]#

So keep this maybe better.

Best Regards
Yang Xu

Quoted 3 lines

I slightly tend to keep setting the seed by srandom() to get a different randomized number for test variety.

#6 lore raw
Quoted 53 lines · Yang Xu

Hi Li

Quoted 9 lines
Quoted 7 lines · Xiao Yang
Quoted 7 lines
Quoted 2 lines

I prefer to go replace ftime() by gettimeofday() or clock_gettime() way to solve this from root.

+1

I have seen the hugetlb.c and trace_sched.c code, they all use the time to generate a random value for ftok or sched_priority. So using gettimeofday() also looks ok.

Quoted 7 lines
Quoted 5 lines

Hi,

It is fine for me to replace ftime(), but I wonder if we can remove fime() and srand()/srandom() directly? :-)
It seems unnecessary to set the seed for random number.

That's true, but random() will generate the same number each time.

Agree. If we don't call srandom, repeatly call random binary will give same random num. ie
root@localhost ~]# ./random
random num 1804289383
random num 846930886
random num 1681692777
random num 1714636915
random num 1957747793
random num 424238335
random num 719885386
random num 1649760492
random num 596516649
random num 1189641421
[root@localhost ~]# ./random
random num 1804289383
random num 846930886
random num 1681692777
random num 1714636915
random num 1957747793
random num 424238335
random num 719885386
random num 1649760492
random num 596516649
random num 1189641421
[root@localhost ~]# cat random.c
#include <stdlib.h>
#include <stdio.h>

void main(void)

{
        int num,i;
        for (i=0;i<10;i++) {
                num =random();
                printf("random num %d\n", num);
        }
}
Quoted 3 lines

[root@localhost ~]#

So keep this maybe better.

Hi Li, Yang

Thanks for your replies. It's reasonable for me to keep it. :-)

Best Regards,
Xiao Yang

Quoted 9 lines

Best Regards
Yang Xu

Quoted 3 lines

I slightly tend to keep setting the seed by srandom() to get a different randomized number for test variety.

.