* what does struct timeval look like on alpha ?
@ 1999-06-15 13:34 Uncle George
1999-06-15 21:50 ` Georg Steffers
0 siblings, 1 reply; 16+ messages in thread
From: Uncle George @ 1999-06-15 13:34 UTC (permalink / raw)
To: axp-list
with gettimeofday() it appears that struct timeval is of int's.
With getrusage(), timeval needs to be of long's.
SO WHAT's the definition of timeval on the alpha with RH 6.0 & GLIBC
2.1.x
signed
Confused in New Jersey.
following Sample pgm that seg-faults if timeval is defined with int's
typedef long jlong;
jlong gethrvtime_us();
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
main()
{
long l;
l = gethrvtime_us();
}
jlong gethrvtime_us()
{
#if 1
struct rusage usage;
getrusage( RUSAGE_SELF, &usage);
usage.ru_utime.tv_sec += usage.ru_stime.tv_sec;
usage.ru_utime.tv_usec += usage.ru_stime.tv_usec;
if ( usage.ru_utime.tv_usec >= 1000000 ) {
usage.ru_utime.tv_sec++;
usage.ru_utime.tv_usec -= 1000000;
};
#if 0
jio_fprintf(stderr,"gethrvtime:%ds%dus\n",
usage.ru_utime.tv_sec,
usage.ru_utime.tv_usec);
#endif
/* return value in microseconds */
return((usage.ru_utime.tv_sec*1000L*1000L +
usage.ru_utime.tv_usec));
#endif
}
~
~
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: what does struct timeval look like on alpha ?
1999-06-15 13:34 what does struct timeval look like on alpha ? Uncle George
@ 1999-06-15 21:50 ` Georg Steffers
1999-06-16 0:27 ` Wes Bauske
1999-06-16 7:55 ` Uncle George
0 siblings, 2 replies; 16+ messages in thread
From: Georg Steffers @ 1999-06-15 21:50 UTC (permalink / raw)
To: axp-list
Ok, i try to do my best to serve this list so an answer to this too.
I hope i am right, if not please tell it to me.....
First, the parts of struct timeval are int, what means long because int is
only an alias on this on alpha-machines. (int may be an alias to an other
data-type on other machines) long and int are both 4 byte.
I tried this with a simple sizeof(int) and sizeof(long) call.
What exacly do you mean if you say <if timeval is defined with ints>
Did you change the libc include-files?? On my system the values ARE defined
as int in /usr/include/timebits.h and your code compiles and run on it very
well....even if i change your l-valiable to int.
Georg
>
> with gettimeofday() it appears that struct timeval is of int's.
>
> With getrusage(), timeval needs to be of long's.
>
> SO WHAT's the definition of timeval on the alpha with RH 6.0 & GLIBC
> 2.1.x
>
> signed
> Confused in New Jersey.
>
>
> following Sample pgm that seg-faults if timeval is defined with int's
>
> typedef long jlong;
> jlong gethrvtime_us();
>
> #include <sys/time.h>
> #include <sys/resource.h>
> #include <unistd.h>
>
>
> main()
> {
> long l;
> l = gethrvtime_us();
> }
>
> jlong gethrvtime_us()
> {
> #if 1
> struct rusage usage;
> getrusage( RUSAGE_SELF, &usage);
> usage.ru_utime.tv_sec += usage.ru_stime.tv_sec;
> usage.ru_utime.tv_usec += usage.ru_stime.tv_usec;
> if ( usage.ru_utime.tv_usec >= 1000000 ) {
> usage.ru_utime.tv_sec++;
> usage.ru_utime.tv_usec -= 1000000;
> };
> #if 0
> jio_fprintf(stderr,"gethrvtime:%ds%dus\n",
> usage.ru_utime.tv_sec,
> usage.ru_utime.tv_usec);
> #endif
> /* return value in microseconds */
> return((usage.ru_utime.tv_sec*1000L*1000L +
> usage.ru_utime.tv_usec));
> #endif
>
> }
> ~
> ~
>
> --
> To unsubscribe: send e-mail to axp-list-request@redhat.com with
> 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: what does struct timeval look like on alpha ?
1999-06-15 21:50 ` Georg Steffers
@ 1999-06-16 0:27 ` Wes Bauske
1999-06-16 7:55 ` Uncle George
1 sibling, 0 replies; 16+ messages in thread
From: Wes Bauske @ 1999-06-16 0:27 UTC (permalink / raw)
To: axp-list
Georg Steffers wrote:
>
> Ok, i try to do my best to serve this list so an answer to this too.
> I hope i am right, if not please tell it to me.....
> First, the parts of struct timeval are int, what means long because int is
> only an alias on this on alpha-machines. (int may be an alias to an other
> data-type on other machines) long and int are both 4 byte.
No, on AlphaLinux, int is 4 bytes, long is 8 bytes. On Intel,
long and int's are 4 bytes.
I did a simple program on my system and the tv_sec/tv_usec values
are longs, not int's, using a sizeof().
> I tried this with a simple sizeof(int) and sizeof(long) call.
> What exacly do you mean if you say <if timeval is defined with ints>
> Did you change the libc include-files?? On my system the values ARE defined
> as int in /usr/include/timebits.h and your code compiles and run on it very
> well....even if i change your l-valiable to int.
>
That file doesn't appear to exist on my RH6.0 systems.
I have a subdirecory called /usr/include/bits that has a
file time.h in it and it defines tv_sec/tv_usec as
__time_t values.
Are you sure you're running RH6.0??
Wes
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: what does struct timeval look like on alpha ?
1999-06-15 21:50 ` Georg Steffers
1999-06-16 0:27 ` Wes Bauske
@ 1999-06-16 7:55 ` Uncle George
1999-06-19 20:16 ` Richard Henderson
1 sibling, 1 reply; 16+ messages in thread
From: Uncle George @ 1999-06-16 7:55 UTC (permalink / raw)
To: axp-list
1) gettimeofday(), which uses timeval, returns 2 ints from the call to the
glibc routines. This is done irrespective of whatever the definition of struct
timeval is. If u define timeval as long, u get bogus looking values. But as
int, the numbers look more reasonable.
2) By the same token, getrusage() uses the rusage struct, which uses struct
timeval. If timeval was defined as 2 ints, like gettimeofday(), then
glibc/kernel trashes stack when getrusage() is called.. If timeval is defined
as 2 longs, then I dont get a trashed stack.
So will the real struct timeval please stand up ? :-)
gat
Again this is for RH6.0 & alpha
Georg Steffers wrote:
> Ok, i try to do my best to serve this list so an answer to this too.
> I hope i am right, if not please tell it to me.....
> First, the parts of struct timeval are int, what means long because int is
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: what does struct timeval look like on alpha ?
1999-06-16 7:55 ` Uncle George
@ 1999-06-19 20:16 ` Richard Henderson
1999-06-20 22:07 ` Meryem Kazanfer
0 siblings, 1 reply; 16+ messages in thread
From: Richard Henderson @ 1999-06-19 20:16 UTC (permalink / raw)
To: axp-list
On Wed, Jun 16, 1999 at 03:55:46AM -0400, Uncle George wrote:
> 1) gettimeofday(), which uses timeval, returns 2 ints from the call to the
> glibc routines.
No it doesn't.
> This is done irrespective of whatever the definition of struct
> timeval is. If u define timeval as long, u get bogus looking values. But as
> int, the numbers look more reasonable.
I don't know what you're doing, but it's screwy.
#include <sys/time.h>
#include <stdio.h>
main()
{
struct timeval tv;
gettimeofday (&tv, 0);
printf ("%ld.%ld\n", tv.tv_sec, tv.tv_usec);
return 0;
}
Produces a sane looking "929823352.596453" with a 16-byte timeval.
r~
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: what does struct timeval look like on alpha ?
1999-06-20 22:07 ` Meryem Kazanfer
@ 1999-06-20 0:40 ` Wes Bauske
1999-06-20 3:58 ` Richard Henderson
1 sibling, 0 replies; 16+ messages in thread
From: Wes Bauske @ 1999-06-20 0:40 UTC (permalink / raw)
To: axp-list
Meryem Kazanfer wrote:
>
> it does in RH 6.0 with glibc2.1. In redhat 5.x, with glibc2.0.7 it doesn't. This
> also was reported by someone else. Timeval was defined with 2 longs for
> gettimeofday(), but apparently the glib/kern returned 2 ints. I suspect glib, as I
> use the same kern for 5.x & 6.0. If i'm not mistaken, u ssaid this was a posix
> change.
>
> I will review again my 6.0 installation, since u appear to suggest that timeval
> has 2 longs, but i suspect that gettimeofday() will return ints :-/
> gat
>
I ran Richard's little test and it returns good values on
my XP1000. I'm using a downloaded copy of RH6.0. It was a
re-install, not an update. Maybe you updated and something
went wrong??
929842329.407910
size of sec/usec is 8/8
Wes
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: what does struct timeval look like on alpha ?
1999-06-20 22:07 ` Meryem Kazanfer
1999-06-20 0:40 ` Wes Bauske
@ 1999-06-20 3:58 ` Richard Henderson
1999-06-20 22:01 ` Uncle George
1 sibling, 1 reply; 16+ messages in thread
From: Richard Henderson @ 1999-06-20 3:58 UTC (permalink / raw)
To: axp-list
On Sun, Jun 20, 1999 at 06:07:18PM -0400, Meryem Kazanfer wrote:
> it does in RH 6.0 with glibc2.1.
Yes.
> In redhat 5.x, with glibc2.0.7 it doesn't.
Yes.
> If i'm not mistaken, u ssaid this was a posix change.
Yes -- timeval.tv_sec must be of type time_t.
Are you not using <sys/time.h> to get the definition of struct timeval?
Why are you so hung up on ints and longs?
r~
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: what does struct timeval look like on alpha ?
1999-06-20 3:58 ` Richard Henderson
@ 1999-06-20 22:01 ` Uncle George
1999-06-20 22:28 ` Richard Henderson
0 siblings, 1 reply; 16+ messages in thread
From: Uncle George @ 1999-06-20 22:01 UTC (permalink / raw)
To: axp-list, Richard Henderson
Since time_t == __time_t == Long int, there had to be another
explanation. & using a small sample 'c' pgm to test gettimeofday() with
int/long/timeval structs, long appears to be the correct answer
- BUT -
It appears that in my java port on RH 6.0 gettimeofday() gets binded to
__gettimeofday__tv32
I suppose I want __gettimeofday_tv64. Any way to convince the dynamic
linker that i'm not intel ? :-/
gat
single instruction stepping:
Breakpoint 3, sysTimeMillis ()
at ../../../../src/genunix/java/runtime/system_md.c:66
66 gettimeofday(&t, 0);
1: x/i $pc 0x20000197d8c <sysTimeMillis+12>: clr a1
(gdb) si
57 {
1: x/i $pc 0x20000197d90 <sysTimeMillis+16>: stq s0,8(sp)
(gdb)
66 gettimeofday(&t, 0);
1: x/i $pc 0x20000197d94 <sysTimeMillis+20>: addq sp,0x10,a0
(gdb)
73 fprintf(stderr,"sysTimeMillis:s=%ld", t.tv_sec);
1: x/i $pc 0x20000197d98 <sysTimeMillis+24>: ldq s0,-27832(gp)
(gdb)
57 {
1: x/i $pc 0x20000197d9c <sysTimeMillis+28>: stq ra,0(sp)
(gdb)
66 gettimeofday(&t, 0);
1: x/i $pc 0x20000197da0 <sysTimeMillis+32>: ldq t12,-28648(gp)
(gdb)
0x20000197da4 66 gettimeofday(&t, 0);
1: x/i $pc 0x20000197da4 <sysTimeMillis+36>:
jsr ra,(t12),0x2000019c000 <intrInitMD+352>
(gdb)
__gettimeofday_tv32 () at __gettimeofday_tv32:2
__gettimeofday_tv32:2: No such file or directory.
1: x/i $pc 0x200005c53c0 <__gettimeofday_tv32>: lda
v0,116(zero)
(gdb
Richard Henderson wrote:
> On Sun, Jun 20, 1999 at 06:07:18PM -0400, Meryem Kazanfer wrote:
> > it does in RH 6.0 with glibc2.1.
>
> Yes.
>
> > In redhat 5.x, with glibc2.0.7 it doesn't.
>
> Yes.
>
> > If i'm not mistaken, u ssaid this was a posix change.
>
> Yes -- timeval.tv_sec must be of type time_t.
>
> Are you not using <sys/time.h> to get the definition of struct timeval?
> Why are you so hung up on ints and longs?
>
> r~
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: what does struct timeval look like on alpha ?
1999-06-19 20:16 ` Richard Henderson
@ 1999-06-20 22:07 ` Meryem Kazanfer
1999-06-20 0:40 ` Wes Bauske
1999-06-20 3:58 ` Richard Henderson
0 siblings, 2 replies; 16+ messages in thread
From: Meryem Kazanfer @ 1999-06-20 22:07 UTC (permalink / raw)
To: axp-list
it does in RH 6.0 with glibc2.1. In redhat 5.x, with glibc2.0.7 it doesn't. This
also was reported by someone else. Timeval was defined with 2 longs for
gettimeofday(), but apparently the glib/kern returned 2 ints. I suspect glib, as I
use the same kern for 5.x & 6.0. If i'm not mistaken, u ssaid this was a posix
change.
I will review again my 6.0 installation, since u appear to suggest that timeval
has 2 longs, but i suspect that gettimeofday() will return ints :-/
gat
Richard Henderson wrote:
> On Wed, Jun 16, 1999 at 03:55:46AM -0400, Uncle George wrote:
> > 1) gettimeofday(), which uses timeval, returns 2 ints from the call to the
> > glibc routines.
>
> No it doesn't.
>
> > This is done irrespective of whatever the definition of struct
> > timeval is. If u define timeval as long, u get bogus looking values. But as
> > int, the numbers look more reasonable.
>
> I don't know what you're doing, but it's screwy.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: what does struct timeval look like on alpha ?
1999-06-20 22:01 ` Uncle George
@ 1999-06-20 22:28 ` Richard Henderson
1999-06-20 23:27 ` Uncle George
0 siblings, 1 reply; 16+ messages in thread
From: Richard Henderson @ 1999-06-20 22:28 UTC (permalink / raw)
To: Uncle George; +Cc: axp-list
On Sun, Jun 20, 1999 at 06:01:22PM -0400, Uncle George wrote:
> It appears that in my java port on RH 6.0 gettimeofday() gets binded to
> __gettimeofday__tv32. I suppose I want __gettimeofday_tv64. Any way to
> convince the dynamic linker that i'm not intel ? :-/
You _must_ link that shared library with -lc.
r~
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: what does struct timeval look like on alpha ?
1999-06-20 22:28 ` Richard Henderson
@ 1999-06-20 23:27 ` Uncle George
1999-06-22 4:34 ` Richard Henderson
0 siblings, 1 reply; 16+ messages in thread
From: Uncle George @ 1999-06-20 23:27 UTC (permalink / raw)
To: Richard Henderson; +Cc: axp-list
according to gdb /lib/libc.so.6.1 is linked to my JVM. My simple 'c' pgm
(which works) also shows /lib/libc.so.6.1.
libc.so.6.1 => libc-2.1.1.so(gdb) info share
From To Syms Read Shared Object Library
0x000002000011c000 0x00000200002bcd40 Yes
/usr/JAVA/d/javasrc_117/build/bin/../lib/alpha_21164a/green_threads/libjava.so
0x00000200002be000 0x00000200003f3cc4 Yes /lib/libm.so.6.1
0x00000200003f4000 0x00000200004f6e78 Yes /lib/libdl.so.2.1
0x00000200004f8000 0x0000020000720e94 Yes /lib/libc.so.6.1
0x0000020000000000 0x000002000011b938 Yes /lib/ld-linux.so.2
(gdb)
signed,
fustrated in NewJersey.
can I impose on u, or anyone else can explain the binding process. a nm of
libc doesn't show a plain gettimeofday entry.
Richard Henderson wrote:
> On Sun, Jun 20, 1999 at 06:01:22PM -0400, Uncle George wrote:
> > It appears that in my java port on RH 6.0 gettimeofday() gets binded to
> > __gettimeofday__tv32. I suppose I want __gettimeofday_tv64. Any way to
> > convince the dynamic linker that i'm not intel ? :-/
>
> You _must_ link that shared library with -lc.
>
> r~
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: what does struct timeval look like on alpha ?
1999-06-20 23:27 ` Uncle George
@ 1999-06-22 4:34 ` Richard Henderson
1999-06-22 10:05 ` Uncle George
0 siblings, 1 reply; 16+ messages in thread
From: Richard Henderson @ 1999-06-22 4:34 UTC (permalink / raw)
To: Uncle George; +Cc: axp-list
On Sun, Jun 20, 1999 at 07:27:00PM -0400, Uncle George wrote:
> according to gdb /lib/libc.so.6.1 is linked to my JVM. My simple 'c' pgm
> (which works) also shows /lib/libc.so.6.1.
That doesn't count.
The symbol version are bound at link time. So the creation of libjava.so
must explicitly include an `-lc'. To see that you have done that,
objdump -p <library> | grep NEEDED
would report an entry for libc.
r~
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: what does struct timeval look like on alpha ?
1999-06-22 4:34 ` Richard Henderson
@ 1999-06-22 10:05 ` Uncle George
1999-06-27 4:54 ` Richard Henderson
0 siblings, 1 reply; 16+ messages in thread
From: Uncle George @ 1999-06-22 10:05 UTC (permalink / raw)
To: axp-list
What did count was that binding was one to one ( same symbol ). Now u got
"symbol version" binding !? is that what I am hearing?
gat
BTW But it does count. I never explicitly asked for __gettimeofday__tv32.
runtime binding gave me this instead . Why should the linker do the 'right
thing', and not the dynamic linker.
I'll go & c what the objdump das to say about it
Richard Henderson wrote:
> On Sun, Jun 20, 1999 at 07:27:00PM -0400, Uncle George wrote:
> > according to gdb /lib/libc.so.6.1 is linked to my JVM. My simple 'c' pgm
> > (which works) also shows /lib/libc.so.6.1.
>
> That doesn't count.
>
> The symbol version are bound at link time. So the creation of libjava.so
> must explicitly include an `-lc'. To see that you have done that,
>
> objdump -p <library> | grep NEEDED
>
> would report an entry for libc.
>
> r~
>
> --
> To unsubscribe: send e-mail to axp-list-request@redhat.com with
> 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: what does struct timeval look like on alpha ?
1999-06-22 10:05 ` Uncle George
@ 1999-06-27 4:54 ` Richard Henderson
1999-06-27 8:11 ` Uncle George
0 siblings, 1 reply; 16+ messages in thread
From: Richard Henderson @ 1999-06-27 4:54 UTC (permalink / raw)
To: axp-list
On Tue, Jun 22, 1999 at 06:05:09AM -0400, Uncle George wrote:
> Now u got "symbol version" binding !? is that what I am hearing?
Yes. That's what will save us from a libc.so.7.
> Why should the linker do the 'right thing', and not the dynamic linker.
Are you ready for an exposition on symbol versioning?
Anyway, you *should* have been linking to libc before, as well as
every other library you use -- pthreads being a likely candidate.
Whether or not things just happened to have been working is immaterial.
Not doing so creates an incorrect dependancy graph between the shared
libraries, and they might not get initialized in the right order.
r~
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: what does struct timeval look like on alpha ?
1999-06-27 4:54 ` Richard Henderson
@ 1999-06-27 8:11 ` Uncle George
1999-06-27 20:18 ` Richard Henderson
0 siblings, 1 reply; 16+ messages in thread
From: Uncle George @ 1999-06-27 8:11 UTC (permalink / raw)
To: axp-list
My mind says yea, my heart says no exposition is really needed to get my
act together. Is there a forum, or do u (folks) do this ad-hoc.
the -lc was missing, but under RH 5.x, things were correctly/dynamically
linked. In 6.0 I the getimeofday was binded to the wrong routine. Although
the wrong routine was "close enough" to what I wanted in functionality, but
it was returning a ( unexpected ) struct of ints, and hence my fetish of
ints/longs ( being on an alpha , sizeof() gets to be important )
Richard Henderson wrote:
> On Tue, Jun 22, 1999 at 06:05:09AM -0400, Uncle George wrote:
> > Now u got "symbol version" binding !? is that what I am hearing?
>
> Yes. That's what will save us from a libc.so.7.
>
> > Why should the linker do the 'right thing', and not the dynamic linker.
>
> Are you ready for an exposition on symbol versioning?
>
> Anyway, you *should* have been linking to libc before, as well as
> every other library you use -- pthreads being a likely candidate.
> Whether or not things just happened to have been working is immaterial.
> Not doing so creates an incorrect dependancy graph between the shared
> libraries, and they might not get initialized in the right order.
Yes, but this would be my hell. There is some expectation that if one called
gettimeofday(), u get a linkage to gettimeofday() AND not to
__gettimeofday_tv32, or __gettimeofday_tv64, or qxxttsss. I like a one to
one relationship, but an onto relationship seems to be leading to severe
confusion.
I'm not gonna go into the "initialization" part, as that would just add to
the confusion.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: what does struct timeval look like on alpha ?
1999-06-27 8:11 ` Uncle George
@ 1999-06-27 20:18 ` Richard Henderson
0 siblings, 0 replies; 16+ messages in thread
From: Richard Henderson @ 1999-06-27 20:18 UTC (permalink / raw)
To: axp-list
On Sun, Jun 27, 1999 at 04:11:16AM -0400, Uncle George wrote:
> Is there a forum, or do u (folks) do this ad-hoc.
There are several mailing lists -- libc-alpha is probably the
most appropriate. See http://sourceware.cygnus.com/glibc/.
r~
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~1999-06-27 21:15 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-06-15 13:34 what does struct timeval look like on alpha ? Uncle George
1999-06-15 21:50 ` Georg Steffers
1999-06-16 0:27 ` Wes Bauske
1999-06-16 7:55 ` Uncle George
1999-06-19 20:16 ` Richard Henderson
1999-06-20 22:07 ` Meryem Kazanfer
1999-06-20 0:40 ` Wes Bauske
1999-06-20 3:58 ` Richard Henderson
1999-06-20 22:01 ` Uncle George
1999-06-20 22:28 ` Richard Henderson
1999-06-20 23:27 ` Uncle George
1999-06-22 4:34 ` Richard Henderson
1999-06-22 10:05 ` Uncle George
1999-06-27 4:54 ` Richard Henderson
1999-06-27 8:11 ` Uncle George
1999-06-27 20:18 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox