(root)/
strace-6.5/
tests-mx32/
ftruncate.c
       1  /*
       2   * Copyright (c) 2015-2018 Dmitry V. Levin <ldv@strace.io>
       3   * Copyright (c) 2015-2021 The strace developers.
       4   * All rights reserved.
       5   *
       6   * SPDX-License-Identifier: GPL-2.0-or-later
       7   */
       8  
       9  #include "tests.h"
      10  #include "scno.h"
      11  
      12  #ifdef __NR_ftruncate
      13  
      14  # include <stdio.h>
      15  # include <unistd.h>
      16  
      17  int
      18  main(void)
      19  {
      20  	const kernel_ulong_t len = (kernel_ulong_t) 0xdefaced0badc0deULL;
      21  	long rc;
      22  
      23  	if (sizeof(len) > sizeof(long))
      24  		rc = ftruncate(-1, len);
      25  	else
      26  		rc = syscall(__NR_ftruncate, -1L, len);
      27  
      28  	printf("ftruncate(-1, %llu) = %ld %s (%m)\n",
      29  	       (unsigned long long) len, rc, errno2name());
      30  
      31  	puts("+++ exited with 0 +++");
      32  	return 0;
      33  }
      34  
      35  #else
      36  
      37  SKIP_MAIN_UNDEFINED("__NR_ftruncate")
      38  
      39  #endif