Replace %Ld/%Lu printf format specifiers with %lld/%llu

As %Ld and %Lu printf format specifiers are not quite portable,
replace them with %lld and %llu, respectively.

* desc.c (SYS_FUNC(pselect6)): Replace %Lu with %llu.
* dirent.c (print_old_dirent, SYS_FUNC(getdents)): Likewise.
* times.c (SYS_FUNC(times)): Likewise.
* fcntl.c (print_struct_flock64): Replace %Ld with %lld.
* tests/ftruncate.c (main): Replace %Lu with %llu.
* tests/ftruncate64.c (main): Likewise.
* tests/getdents.c (print_dirent): Likewise.
* tests/llseek.c (main): Likewise.
* tests/lseek.c (main): Likewise.
* tests/truncate.c (main): Likewise.
* tests/truncate64.c (main): Likewise.
* tests/xstatx.c (main): Likewise.
* tests/pselect6.c (main): Replace %Ld with %lld.
* tests/xselect.c(main): Likewise.

Reported-by: Szabolcs Nagy <nsz@port70.net>
This commit is contained in:
Дмитрий Левин 2015-12-16 00:07:16 +00:00
parent 34683e3926
commit e67c8e44db
14 changed files with 20 additions and 20 deletions

2
desc.c
View File

@ -270,7 +270,7 @@ SYS_FUNC(pselect6)
/* NB: kernel requires data[1] == NSIG / 8 */
print_sigset_addr_len(tcp, (unsigned long) data[0],
(unsigned long) data[1]);
tprintf(", %Lu}", (unsigned long long) data[1]);
tprintf(", %llu}", (unsigned long long) data[1]);
}
}

View File

@ -47,7 +47,7 @@ print_old_dirent(struct tcb *tcp, long addr)
if (umove_or_printaddr(tcp, addr, &d))
return;
tprintf("{d_ino=%Lu, d_off=%Lu, d_reclen=%u, d_name=",
tprintf("{d_ino=%llu, d_off=%llu, d_reclen=%u, d_name=",
(unsigned long long) d.d_ino,
(unsigned long long) d.d_off, d.d_reclen);
if (d.d_reclen > D_NAME_LEN_MAX)
@ -122,7 +122,7 @@ SYS_FUNC(getdents)
if (d_name_len > D_NAME_LEN_MAX)
d_name_len = D_NAME_LEN_MAX;
tprintf("%s{d_ino=%Lu, d_off=%Lu, d_reclen=%u"
tprintf("%s{d_ino=%llu, d_off=%llu, d_reclen=%u"
", d_name=", i ? ", " : "",
(unsigned long long) d->d_ino,
(unsigned long long) d->d_off, d->d_reclen);

View File

@ -46,7 +46,7 @@ print_struct_flock64(const struct_kernel_flock64 *fl, const int getlk)
printxval(lockfcmds, fl->l_type, "F_???");
tprints(", l_whence=");
printxval(whence_codes, fl->l_whence, "SEEK_???");
tprintf(", l_start=%Ld, l_len=%Ld",
tprintf(", l_start=%lld, l_len=%lld",
(long long) fl->l_start, (long long) fl->l_len);
if (getlk)
tprintf(", l_pid=%lu", (unsigned long) fl->l_pid);

View File

@ -53,7 +53,7 @@ main(void)
if (rc != -1 || EBADF != errno)
return 77;
printf("ftruncate(-1, %Lu) = -1 EBADF (Bad file descriptor)\n",
printf("ftruncate(-1, %llu) = -1 EBADF (Bad file descriptor)\n",
(unsigned long long) len);
puts("+++ exited with 0 +++");

View File

@ -46,7 +46,7 @@ main(void)
if (rc != -1 || EBADF != errno)
return 77;
printf("ftruncate64(-1, %Lu) = -1 EBADF (Bad file descriptor)\n",
printf("ftruncate64(-1, %llu) = -1 EBADF (Bad file descriptor)\n",
(unsigned long long) len);
puts("+++ exited with 0 +++");

View File

@ -83,7 +83,7 @@ print_dirent(const kernel_dirent *d)
int d_name_len = d->d_reclen - d_name_offset - 1;
assert(d_name_len > 0);
printf("{d_ino=%Lu, d_off=%Lu, d_reclen=%u, d_name=",
printf("{d_ino=%llu, d_off=%llu, d_reclen=%u, d_name=",
(unsigned long long) d->d_ino,
(unsigned long long) d->d_off, d->d_reclen);

View File

@ -49,7 +49,7 @@ main(void)
if (rc != -1 || EBADF != errno)
return 77;
printf("_llseek(-1, %Lu, %p, SEEK_SET) = -1 EBADF (Bad file descriptor)\n",
printf("_llseek(-1, %llu, %p, SEEK_SET) = -1 EBADF (Bad file descriptor)\n",
offset, &result);
puts("+++ exited with 0 +++");

View File

@ -53,7 +53,7 @@ main(void)
if (rc != -1 || EBADF != errno)
return 77;
printf("lseek(-1, %Lu, SEEK_SET) = -1 EBADF (Bad file descriptor)\n",
printf("lseek(-1, %llu, SEEK_SET) = -1 EBADF (Bad file descriptor)\n",
(unsigned long long) offset);
puts("+++ exited with 0 +++");

View File

@ -96,8 +96,8 @@ int main(int ac, char **av)
FD_SET(fds[1], set[1]);
if (syscall(__NR_pselect6, fds[1] + 1, NULL, set[1], NULL, &tm.ts, NULL) != 3)
return 77;
printf("pselect6(%d, NULL, [1 2 %d %d], NULL, {%Ld, %Ld}, NULL)"
" = 3 (out [1 2 %d], left {%Ld, %Ld})\n",
printf("pselect6(%d, NULL, [1 2 %d %d], NULL, {%lld, %lld}, NULL)"
" = 3 (out [1 2 %d], left {%lld, %lld})\n",
fds[1] + 1, fds[0], fds[1],
(long long) tm_in.ts.tv_sec, (long long) tm_in.ts.tv_nsec,
fds[1],

View File

@ -55,7 +55,7 @@ main(void)
if (rc != -1 || ENOENT != errno)
return 77;
printf("truncate(\"%s\", %Lu) = -1 ENOENT (No such file or directory)\n",
printf("truncate(\"%s\", %llu) = -1 ENOENT (No such file or directory)\n",
qname, (unsigned long long) len);
puts("+++ exited with 0 +++");

View File

@ -48,7 +48,7 @@ main(void)
if (rc != -1 || ENOENT != errno)
return 77;
printf("truncate64(\"%s\", %Lu) = -1 ENOENT (No such file or directory)\n",
printf("truncate64(\"%s\", %llu) = -1 ENOENT (No such file or directory)\n",
qname, (unsigned long long) len);
puts("+++ exited with 0 +++");

View File

@ -80,8 +80,8 @@ int main(void)
FD_SET(fds[1], set);
if (syscall(TEST_SYSCALL_NR, fds[1] + 1, NULL, set, NULL, &tm.tv) != 3)
return 77;
printf("%s(%d, NULL, [1 2 %d %d], NULL, {%Ld, %Ld})"
" = 3 (out [1 2 %d], left {%Ld, %Ld})\n",
printf("%s(%d, NULL, [1 2 %d %d], NULL, {%lld, %lld})"
" = 3 (out [1 2 %d], left {%lld, %lld})\n",
TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1],
(long long) tm_in.tv.tv_sec, (long long) tm_in.tv.tv_usec,
fds[1],

View File

@ -163,7 +163,7 @@ print_stat(const STRUCT_STAT *st)
printf("{st_dev=makedev(%u, %u)",
(unsigned int) major(st->st_dev),
(unsigned int) minor(st->st_dev));
printf(", st_ino=%Lu", (unsigned long long) st->st_ino);
printf(", st_ino=%llu", (unsigned long long) st->st_ino);
printf(", st_mode=");
print_ftype(st->st_mode);
printf("|");
@ -181,7 +181,7 @@ print_stat(const STRUCT_STAT *st)
(unsigned int) minor(st->st_rdev));
break;
default:
printf(", st_size=%Lu", (unsigned long long) st->st_size);
printf(", st_size=%llu", (unsigned long long) st->st_size);
}
printf(", st_atime=");
@ -254,7 +254,7 @@ main(void)
if ((unsigned long long) SAMPLE_SIZE !=
(unsigned long long) st[0].st_size) {
fprintf(stderr, "Size mismatch: "
"requested size(%Lu) != st_size(%Lu)\n",
"requested size(%llu) != st_size(%llu)\n",
(unsigned long long) SAMPLE_SIZE,
(unsigned long long) st[0].st_size);
fprintf(stderr, "The most likely reason for this is incorrect"

View File

@ -12,10 +12,10 @@ SYS_FUNC(times)
return 0;
if (!umove_or_printaddr(tcp, tcp->u_arg[0], &tbuf)) {
tprintf("{tms_utime=%Lu, tms_stime=%Lu, ",
tprintf("{tms_utime=%llu, tms_stime=%llu, ",
(unsigned long long) tbuf.tms_utime,
(unsigned long long) tbuf.tms_stime);
tprintf("tms_cutime=%Lu, tms_cstime=%Lu}",
tprintf("tms_cutime=%llu, tms_cstime=%llu}",
(unsigned long long) tbuf.tms_cutime,
(unsigned long long) tbuf.tms_cstime);
}