On 11/26/2013 08:06 PM, [email protected] wrote:
> Hi!
>> Some distributions (RHEL5, for instance) don't have defined utimensat()
>> system call. So I introduced an autoconf check for this, otherwise
>> safe_file_ops.c can
>> not be compiled on these distributions.
>>
>> Actually, I'm not satisfied with
>> utimes(pathname, NULL)
>> because it throws away the time-changing logic from safe_touch().
>>
>> How do you think it is safe to explicitly define UTIME_* constants in LTP
>> sources (safe_file_ops.h):
>>
>> #ifndef UTIME_NOW
>> #define UTIME_NOW ((1l << 30) - 1l)
>> #endif
>>
>> #ifndef UTIME_OMIT
>> #define UTIME_OMIT ((1l << 30) - 2l)
>> #endif
> Any progress on this? Do you need a help?
Actually, I need.
I use clock_gettime() to get the current time and use it when UTIME_NOW
is passed. Like this:
#if HAVE_UTIMENSAT
ret = utimensat(AT_FDCWD, pathname, times, 0);
#else
if (times == NULL) {
ret = utimes(pathname, NULL);
} else {
/* stat and etc */
ret = clock_gettime(CLOCK_REALTIME, &tp);
if (ret == -1)
tst_brkm(TBROK | TERRNO, cleanup_fn,
"Failed to clock_realtime() at %s:%d",
file, lineno);
/* handle UTIME_NOW and etc */
}
#endif
The compilation of safe_file_ops.c performs ok. libltp.a is formed. But
compilations of other pieces of code using safe_touch fails with:
make[1]: Entering directory `/home/stas/ltp/lib/tests'
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W
-D_FORTIFY_SOURCE=2 -I../../include -I../../include -L../../lib
tst_process_state.c -lltp -o tst_process_state
../../lib/libltp.a(safe_file_ops.o): In function `safe_touch':
/home/stas/ltp/lib/safe_file_ops.c:213: undefined reference to
`clock_gettime'
collect2: ld returned 1 exit status
I know, that clock_gettime() requires '-lrt'.
But I'm not sure about the right place inside LTP sources to put it in....
Thanks.
>
> The latest git build on older distros is broken and should be fixed
> ASAP...
>
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list