(root)/
strace-6.5/
tests-m32/
splice.c
       1  /*
       2   * Check decoding of splice syscall.
       3   *
       4   * Copyright (c) 2016 Dmitry V. Levin <ldv@strace.io>
       5   * Copyright (c) 2016-2021 The strace developers.
       6   * All rights reserved.
       7   *
       8   * SPDX-License-Identifier: GPL-2.0-or-later
       9   */
      10  
      11  #include "tests.h"
      12  #include "scno.h"
      13  
      14  #include <stdio.h>
      15  #include <unistd.h>
      16  
      17  int
      18  main(void)
      19  {
      20  	const long int fd_in = (long int) 0xdeadbeefffffffffULL;
      21  	const long int fd_out = (long int) 0xdeadbeeffffffffeULL;
      22  	TAIL_ALLOC_OBJECT_CONST_PTR(long long int, off_in);
      23  	TAIL_ALLOC_OBJECT_CONST_PTR(long long int, off_out);
      24  	*off_in = 0xdeadbef1facefed1ULL;
      25  	*off_out = 0xdeadbef2facefed2ULL;
      26  	const size_t len = (size_t) 0xdeadbef3facefed3ULL;
      27  	const unsigned int flags = 15;
      28  
      29  	long rc = syscall(__NR_splice,
      30  			  fd_in, off_in, fd_out, off_out, len, flags);
      31  	printf("splice(%d, [%lld], %d, [%lld], %zu, %s) = %ld %s (%m)\n",
      32  	       (int) fd_in, *off_in, (int) fd_out, *off_out, len,
      33  	       "SPLICE_F_MOVE|SPLICE_F_NONBLOCK|SPLICE_F_MORE|SPLICE_F_GIFT",
      34  	       rc, errno2name());
      35  
      36  	puts("+++ exited with 0 +++");
      37  	return 0;
      38  }