Where is 'struct timespec' resp. 'time_t' defined?

Actually I only wanted to test the routine ‘sched_rr_get_interval()’,
but then I got stucked in the thicket of the include-files and
directories.

I am using QNX 6.0, i.e. QNX RTP from January, 18th 2001, as development
system and as target.

I took the following way:

  • The online-help decribes the call as ‘int sched_rr_get_interval( pid_t
    pid, struct timespec * interval )’ which corresponds with the
    declaration in ‘/usr/include/sched.h’.
  • Rob Krten in 'Getting started with Neutrino 2, p. 190 and the
    online-help, chapter ‘Clocks, Timers, and Getting on Kick Every So
    Often’ state
    struct timespec {
    long tv_sec,
    tv_nsec;
    };
  • However, compiling the program ‘S_013.c’

    struct timespec interval;

    sched_rr_get_interval( 0, &interval );
    printf("%ld, %ld\n", interval.tv_sec, interval.tv_nsec);

    with ‘qcc -g - w9 -o S_013 S_013.c’ results in the warning ‘long int
    format, time_t arg (arg 2)’. Obviously the format string is faulty.
  • When I searched for ‘timespec’ with grep, I found in
    ‘/usr/include/sys/target_nto.h’ the definition of a macro
    #define __TIMESPEC
    struct time {
    time_t tv_sec,
    long tv_nsec;
    }
  • Furthermore the online-help, chapter ‘Migration from Neutrino 1.x to
    2.0’ says: “We’ve changed all kernel interfaces that take a time.
    Instead of … struct timespec … we’ve changed the definition of
    time to a pure 64-bit nsec…”, but ‘sched_rr_get_interval()’ isn’t on
    the list of the routines affected.

At this point I gave up to find the definition of ‘struct timespec’ and
‘time_t’. Does anybody have an idea where I can look for?


Generally I wonder how the definition of any symbol (type, variable,
routine) in a program can be found in a quick and simple way. I remember
Borland Pascal 7.01 for DOS. The IDE of which allowed via ‘Search |
Symboldefinitions…’ to let display all places in a program where a
symbol was used, its definition and in case of objects the
inheritance hierarchy and then to jump directly to the required
place at once. Pressing the help button, when the cursor was positioned
on a library function, let a window with explanations pop up. This
character-based IDE wasn’t beautiful but highly efficient and
time-saving. Does anybody know if similiar possibilities for QNX 6.0
exist?


All advice will be appreciated. Thanks.

\

Thomas Nittel

mailto:Thomas.Nittel@t-online.de

“Thomas Nittel” <Thomas.Nittel@t-online.de> wrote in message
news:3AA41CA5.7BAEF1BE@t-online.de

Actually I only wanted to test the routine ‘sched_rr_get_interval()’,
but then I got stucked in the thicket of the include-files and
directories.

I am using QNX 6.0, i.e. QNX RTP from January, 18th 2001, as development
system and as target.

I took the following way:

  • The online-help decribes the call as ‘int sched_rr_get_interval( pid_t
    pid, struct timespec * interval )’ which corresponds with the
    declaration in ‘/usr/include/sched.h’.
  • Rob Krten in 'Getting started with Neutrino 2, p. 190 and the
    online-help, chapter ‘Clocks, Timers, and Getting on Kick Every So
    Often’ state
    struct timespec {
    long tv_sec,
    tv_nsec;
    };
  • However, compiling the program ‘S_013.c’

    struct timespec interval;

    sched_rr_get_interval( 0, &interval );
    printf("%ld, %ld\n", interval.tv_sec, interval.tv_nsec);

    with ‘qcc -g - w9 -o S_013 S_013.c’ results in the warning ‘long int
    format, time_t arg (arg 2)’. Obviously the format string is faulty.
  • When I searched for ‘timespec’ with grep, I found in
    ‘/usr/include/sys/target_nto.h’ the definition of a macro
    #define __TIMESPEC
    struct time {
    time_t tv_sec,
    long tv_nsec;
    }
  • Furthermore the online-help, chapter ‘Migration from Neutrino 1.x to
    2.0’ says: “We’ve changed all kernel interfaces that take a time.
    Instead of … struct timespec … we’ve changed the definition of
    time to a pure 64-bit nsec…”, but ‘sched_rr_get_interval()’ isn’t on
    the list of the routines affected.

At this point I gave up to find the definition of ‘struct timespec’ and
‘time_t’. Does anybody have an idea where I can look for?


Generally I wonder how the definition of any symbol (type, variable,
routine) in a program can be found in a quick and simple way. I remember
Borland Pascal 7.01 for DOS. The IDE of which allowed via ‘Search |
Symboldefinitions…’ to let display all places in a program where a
symbol was used, its definition and in case of objects the
inheritance hierarchy and then to jump directly to the required
place at once. Pressing the help button, when the cursor was positioned
on a library function, let a window with explanations pop up. This
character-based IDE wasn’t beautiful but highly efficient and
time-saving. Does anybody know if similiar possibilities for QNX 6.0
exist?

Quick and dirty.

grep SYMBOL /usr/include/*
grep SYMBOL /usr/include//

You can use emacs and ctags or check out
Source Navigator.

All advice will be appreciated. Thanks.

\

Thomas Nittel

mailto:> Thomas.Nittel@t-online.de