On Fri, Feb 8, 2013 at 5:53 PM, Ian Lance Taylor <[email protected]> wrote:
> On Fri, Feb 8, 2013 at 8:48 AM, Uros Bizjak <[email protected]> wrote:
>>
>> utimensat returns zero on CentOS. Following is gdb session:
>
> Thanks--can you do the same session but with "step" instead of "next"?
I think I got the problem.
breakpoint at utimensat
(gdb) list
271 int
272 utimensat(int dirfd __attribute__ ((unused)),
273 const char *pathname __attribute__ ((unused)),
274 const struct timespec times[2] __attribute__ ((unused)),
275 int flags __attribute__ ((unused)))
276 {
277 errno = ENOSYS;
278 return -1;
279 }
Breakpoint 2, utimensat (dirfd=dirfd@entry=-100,
pathname=pathname@entry=0xc20064e000 "/tmp/_Go_TestChtimes925784001",
times=times@entry=0xc20064e0e0,
flags=flags@entry=0) at ../../../gcc-svn/trunk/libgo/runtime/go-nosys.c:276
276 {
(gdb) fin
Run till exit from #0 utimensat (dirfd=dirfd@entry=-100,
pathname=pathname@entry=0xc20064e000 "/tmp/_Go_TestChtimes925784001",
times=times@entry=0xc20064e0e0, flags=flags@entry=0) at
../../../gcc-svn/trunk/libgo/runtime/go-nosys.c:276
syscall.utimensat (dirfd=-100, flags=0, times=0xc20064e0e0, path=...)
at libcalls.go:2371
2371 if _r < 0 {
Value returned is $5 = -1
However, _r at call site is unsigned.
(gdb) p _r
$6 = 4294967295
(gdb) list
2366 }
2367 Entersyscall()
2368 _r := c_utimensat(int(dirfd), _p2, times, int(flags))
2369 var errno Errno
2370 setErrno := false
2371 if _r < 0 {
2372 errno = GetErrno()
2373 setErrno = true
2374 }
2375 Exitsyscall()
(gdb) n
2375 Exitsyscall()
(gdb) n
syscall.UtimesNano (path=..., ts.param=...) at
../../../gcc-svn/trunk/libgo/go/syscall/libcall_linux_utimesnano.go:18
18 if err != ENOSYS {
(gdb) li
13 func UtimesNano(path string, ts []Timespec) (err error) {
14 if len(ts) != 2 {
15 return EINVAL
16 }
17 err = utimensat(_AT_FDCWD, path,
(*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
18 if err != ENOSYS {
19 return err
20 }
21 // If the utimensat syscall isn't available (utimensat
was added to Linux
22 // in 2.6.22, Released, 8 July 2007) then fall back to utimes
(gdb) p err
$8 = {__methods = 0x0, __object = 0x0}
Uros.