ts wrote:
> 
> >>>>> "G" == Guy N Hurst <gnhurst / hurstlinks.com> writes:
> 
> G> 1) Is this something that should be working regardless of the
> G> fact that I am not using glibc2?
> 
>  Can you write a small C program which emulate time_s_times (i.e. just a
>  call to times(2) to see what is the error returned) or use the debugger
>  and add a breakpoint in time_s_times.
> 

Ok, I tried at least three approaches...

1) small C program

#include <stdio.h>
#include <sys/times.h>
  
int main(void)
{
        int i = 0;   
        int e;
        struct tms buf;
        
        for (i=0; i < 99999999; i++);
        
        e = times(&buf);
        
        printf("User Time: %ld\n", buf.tms_utime);   
        printf("Sys  Time: %ld\n", buf.tms_stime);
        printf("Return Value: %d\n", e);
        
        return 0;
}

# gcc t.c
# a.out
User Time: 113
Sys  Time: 0
Return Value: -1

(Notice it returns -1 but still worked. Yet, line 966 in Ruby's time.c has:
      if (times(&buf) == -1) rb_sys_fail(0);
Does this mean the return code for times() is not a success indicator?)


2) Alternatively, using gdb:

tst.rb
======
t=Time.times


(gdb) run tst.rb
Starting program: /usr/local/bin/ruby 
Breakpoint 1, time_s_times (obj=1074769936) at time.c:966
966     time.c: No such file or directory.
(gdb) info locals
buf = {tms_utime = 1074760836, tms_stime = 2, tms_cutime = -1073742718, tms_cstime = 1470}
(gdb) step
rb_sys_fail (mesg=0x0) at error.c:657
657     error.c: No such file or directory.
(gdb) info locals
mesg = 0x0
err = 0x0
buf = 0x0
n = 1074769936
ee = 0
(gdb) 
...
(gdb) step
set_syserr (i=1074571973, name=0xbffff4e4 "E1074571973") at error.c:484
484     in error.c
(gdb) step
rb_define_class_under (outer=1074804636, name=0xbffff4e4 "E1074571973", super=1074804716) at class.c:128
128     class.c: No such file or directory.
(gdb) step
rb_intern (name=0xbffff4e4 "E1074571973") at parse.y:4852
4852    parse.y: No such file or directory.
(gdb) step
st_lookup (table=0x80d1440, key=0xbffff4e4 "E1074571973", value=0xbffff464) at st.c:253
253     st.c: No such file or directory.
(gdb) step
...

Program exited with code 01.


3) strace ruby tst.rb

...
times({tms_utime=1, tms_stime=1, tms_cutime=0, tms_cstime=0}) = -1078418711
...
_exit(1)                                = ?


Does this help explain things any better?


Guy N. Hurst


P.S. Thanks to those who assisted in this so far...
-- 
HurstLinks Web Development    http://www.hurstlinks.com/
Norfolk, VA  23510            (757)623-9688 FAX 623-0433
PHP/MySQL - Ruby/Perl - HTML/Javascript