Broken Fedora build
Hi,
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]
Kind regards,
Petr
[1] https://travis-ci.org/github/linux-test-project/ltp/jobs/737698948
[2] https://www.spinics.net/lists/fedora-devel/msg279551.html
[3] https://www.spinics.net/lists/fedora-devel/msg279545.html
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 porthugetlb.candtrace_sched.c(if used) to gettimeofday orclock_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
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 porthugetlb.candtrace_sched.c(if used) to gettimeofday orclock_gettime. [3]+1
I prefer to go replaceftime()bygettimeofday()orclock_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
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.candtrace_sched.c(if used) to gettimeofday orclock_gettime. [3]
Quoted 8 lines
Quoted 3 lines
+1
I prefer to go replaceftime()bygettimeofday()orclock_gettime()way to solve this from root.+1
I have seen the
hugetlb.candtrace_sched.ccode, they all use the time to generate a random value for ftok orsched_priority. So usinggettimeofday()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 XuQuoted 1 line
Quoted 4 lines · Xiao Yang
Quoted 4 lines
Quoted 2 lines
I prefer to go replace
ftime()bygettimeofday()orclock_gettime()way to solve this from root.+1
Quoted 8 lines
Quoted 3 lines
I have seen the
hugetlb.candtrace_sched.ccode, they all use the time to generate a random value for ftok orsched_priority. So usinggettimeofday()also looks ok.Hi,
It is fine for me to replace
ftime(), but I wonder if we can removefime()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
Hi Li
Quoted 9 lines
Quoted 7 lines · Xiao Yang
Quoted 7 lines
Quoted 2 lines
I prefer to go replace
ftime()bygettimeofday()orclock_gettime()way to solve this from root.+1
I have seen the
hugetlb.candtrace_sched.ccode, they all use the time to generate a random value for ftok orsched_priority. So usinggettimeofday()also looks ok.
Quoted 7 lines
Quoted 5 lines
Hi,
It is fine for me to replace
ftime(), but I wonder if we can removefime()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.
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()bygettimeofday()orclock_gettime()way to solve this from root.+1
I have seen the
hugetlb.candtrace_sched.ccode, they all use the time to generate a random value for ftok orsched_priority. So usinggettimeofday()also looks ok.Quoted 7 lines
Quoted 5 lines
Hi,
It is fine for me to replace
ftime(), but I wonder if we can removefime()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 ~]# catrandom.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 XuQuoted 3 lines
I slightly tend to keep setting the seed by
srandom()to get a different randomized number for test variety..
----- 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 porthugetlb.candtrace_sched.c(if used) to gettimeofday orclock_gettime. [3]+1
I prefer to go replaceftime()bygettimeofday()orclock_gettime()way to solve this from root.
Agreed, ftime is marked as obsolete.