Dave Thomas wrote:
> 
> "Guy N. Hurst" <gnhurst / hurstlinks.com> writes:
> 
> > (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?)
> 
> According to times(2), the return value, which should be of type
> clock_t, is the time the system's been up in clock ticks.
> 

I asked my sysadmin about this..

<Jordan> I just checked the ruby source and it does check the return value of the times() call
<Jordan> but I don't think it should, the man page says times() returns the uptime of the system, 
so I don't think it should be used as an error indicator
<Jordan> the fact that it assumes -1 from times is an error when it isn't 
explains why it prints unkown error from errno, since a real error condition didn't occur, 
errno is at its default of 0, unknown error

(Note: I recall here the gdb output at that point)
(gdb) info locals
mesg = 0x0
err = 0x0
buf = 0x0
n = 1074769936
ee = 0

His analysis makes sense to me...
Of course, this still leaves the question of how to know whether
it failed or succeeded.


Guy N. Hurst

-- 
HurstLinks Web Development    http://www.hurstlinks.com/
Norfolk, VA  23510            (757)623-9688 FAX 623-0433
PHP/MySQL - Ruby/Perl - HTML/Javascript