* Copyright (c) 2009 Andreas Schwab <schwab@redhat.com>
* Copyright (c) 2012 H.J. Lu <hongjiu.lu@intel.com>
* Copyright (c) 2013 Denys Vlasenko <vda.linux@googlemail.com>
- * Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#if defined(LINUX_MIPSN32) || defined(X32)
SYS_FUNC(lseek)
{
- long long offset;
- int whence;
-
printfd(tcp, tcp->u_arg[0]);
+
+ long long offset;
# ifdef X32
/* tcp->ext_arg is not initialized for i386 personality */
if (current_personality == 1)
else
# endif
offset = tcp->ext_arg[1];
- whence = tcp->u_arg[2];
- if (whence == SEEK_SET)
- tprintf(", %llu, ", offset);
- else
- tprintf(", %lld, ", offset);
+ int whence = tcp->u_arg[2];
+
+ tprintf(", %lld, ", offset);
printxval(whence_codes, whence, "SEEK_???");
return RVAL_DECODED | RVAL_LUDECIMAL;
#else
SYS_FUNC(lseek)
{
- long offset;
- int whence;
-
printfd(tcp, tcp->u_arg[0]);
- offset = tcp->u_arg[1];
- whence = tcp->u_arg[2];
- if (whence == SEEK_SET)
- tprintf(", %lu, ", offset);
- else
- tprintf(", %ld, ", offset);
+
+ long offset =
+# if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
+# ifdef X86_64
+ current_personality == 1 ?
+ (long)(int) tcp->u_arg[1] : tcp->u_arg[1];
+# else
+ current_wordsize == 4 ?
+ (long)(int) tcp->u_arg[1] : tcp->u_arg[1];
+# endif
+# else
+ tcp->u_arg[1];
+# endif
+ int whence = tcp->u_arg[2];
+
+ tprintf(", %ld, ", offset);
printxval(whence_codes, whence, "SEEK_???");
return RVAL_DECODED | RVAL_UDECIMAL;
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
- if (tcp->u_arg[4] == SEEK_SET)
- tprintf(", %llu, ",
- ((long long) tcp->u_arg[1]) << 32 |
- (unsigned long long) (unsigned) tcp->u_arg[2]);
- else
- tprintf(", %lld, ",
- ((long long) tcp->u_arg[1]) << 32 |
- (unsigned long long) (unsigned) tcp->u_arg[2]);
+ tprintf(", %lld, ",
+ ((unsigned long long) (unsigned long) tcp->u_arg[1]) << 32
+ | (unsigned long long) (unsigned long) tcp->u_arg[2]);
} else {
printnum_int64(tcp, tcp->u_arg[3], "%" PRIu64);
tprints(", ");
int
main(void)
{
- const unsigned long high = 0xdefaced;
+ const unsigned long high = 0xfacefeed;
const unsigned long low = 0xdeadbeef;
- const unsigned long long offset = 0xdefaceddeadbeef;
+ const long long offset = 0xfacefeeddeadbeefLL;
unsigned long long result;
assert(syscall(__NR__llseek, -1, high, low, &result, SEEK_SET) == -1);
if (EBADF != errno)
perror_msg_and_skip("_llseek");
- printf("_llseek(-1, %llu, %p, SEEK_SET) = -1 EBADF (%m)\n",
+ printf("_llseek(-1, %lld, %p, SEEK_SET) = -1 EBADF (%m)\n",
offset, &result);
puts("+++ exited with 0 +++");
int
main(void)
{
- const kernel_ulong_t offset = (kernel_ulong_t) 0xdefaced0badc0deULL;
+ const kernel_ulong_t offset = (kernel_ulong_t) 0xfacefeeddeadbeefULL;
if (sizeof(offset) > sizeof(long))
assert(lseek(-1, offset, SEEK_SET) == -1);
if (EBADF != errno)
perror_msg_and_skip("lseek");
- printf("lseek(-1, %llu, SEEK_SET) = -1 EBADF (%m)\n",
- (unsigned long long) offset);
+ if (sizeof(offset) > sizeof(long))
+ printf("lseek(-1, %lld, SEEK_SET) = -1 EBADF (%m)\n",
+ (long long) offset);
+ else
+ printf("lseek(-1, %ld, SEEK_SET) = -1 EBADF (%m)\n",
+ (long) offset);
puts("+++ exited with 0 +++");
return 0;