(root)/
strace-6.5/
tests-mx32/
fcntl.c
       1  /*
       2   * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@strace.io>
       3   * Copyright (c) 2015-2022 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_fcntl
      13  
      14  # define TEST_SYSCALL_NR __NR_fcntl
      15  # define TEST_SYSCALL_STR "fcntl"
      16  # include "fcntl-common.c"
      17  
      18  /* We can't have nice things because clang */
      19  # if (defined(F_SETLK64) && (!defined(F_GETOWN_EX) || F_GETOWN_EX != F_SETLK64)) || \
      20       (defined(F_SETLKW64) && (!defined(__mips64) || F_GETLK != F_SETLKW64)) || \
      21       (defined(F_GETLK64) && (!defined(F_SETOWN_EX) || F_SETOWN_EX != F_GETLK64))
      22  static void
      23  test_flock64_undecoded(const int cmd, const char *name)
      24  {
      25  	struct flock64 fl = {
      26  		.l_type = F_RDLCK,
      27  		.l_start = 0xdefaced1facefeedULL,
      28  		.l_len = 0xdefaced2cafef00dULL
      29  	};
      30  	invoke_test_syscall(0, cmd, &fl);
      31  	pidns_print_leader();
      32  	printf("%s(0, %s, %p) = %s\n",
      33  	       TEST_SYSCALL_STR, name, &fl, errstr);
      34  }
      35  # endif
      36  
      37  # define TEST_FLOCK64_UNDECODED(cmd) test_flock64_undecoded(cmd, #cmd)
      38  
      39  static void
      40  test_flock64_lk64(void)
      41  {
      42  /*
      43   * F_[GS]ETOWN_EX had conflicting values with F_[GS]ETLK64
      44   * in kernel revisions v2.6.32-rc1~96..v2.6.32-rc7~23.
      45   */
      46  # if defined(F_SETLK64) && (!defined(F_GETOWN_EX) || F_GETOWN_EX != F_SETLK64)
      47  	TEST_FLOCK64_UNDECODED(F_SETLK64);
      48  # endif
      49  /* F_GETLK and F_SETLKW64 have conflicting values on mips64 */
      50  # if defined(F_SETLKW64) && (!defined(__mips64) || F_GETLK != F_SETLKW64)
      51  	TEST_FLOCK64_UNDECODED(F_SETLKW64);
      52  # endif
      53  # if defined(F_GETLK64) && (!defined(F_SETOWN_EX) || F_SETOWN_EX != F_GETLK64)
      54  	TEST_FLOCK64_UNDECODED(F_GETLK64);
      55  # endif
      56  }
      57  
      58  #else
      59  
      60  SKIP_MAIN_UNDEFINED("__NR_fcntl")
      61  
      62  #endif