(root)/
strace-6.5/
tests-mx32/
oldselect-efault.c
       1  /*
       2   * Copyright (c) 2015-2018 Dmitry V. Levin <ldv@strace.io>
       3   * Copyright (c) 2018-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  #if defined __NR_select && defined __NR__newselect \
      13   && __NR_select != __NR__newselect \
      14   && !defined __sparc__
      15  
      16  # include <stdint.h>
      17  # include <stdio.h>
      18  # include <string.h>
      19  # include <unistd.h>
      20  # include <sys/select.h>
      21  
      22  static const char *errstr;
      23  
      24  static long
      25  xselect(const kernel_ulong_t args)
      26  {
      27  	static const kernel_ulong_t dummy = F8ILL_KULONG_MASK | 0xfacefeed;
      28  	long rc = syscall(__NR_select, args, dummy, dummy, dummy, dummy, dummy);
      29  	errstr = sprintrc(rc);
      30  	return rc;
      31  }
      32  
      33  int
      34  main(void)
      35  {
      36  	unsigned long *const args = tail_alloc(sizeof(*args) * 4);
      37  	memset(args, 0, sizeof(*args) * 4);
      38  
      39  	xselect(0);
      40  # ifndef PATH_TRACING_FD
      41  	printf("select(NULL) = %s\n", errstr);
      42  # endif
      43  
      44  	xselect((uintptr_t) args);
      45  # ifndef PATH_TRACING_FD
      46  	printf("select(%p) = %s\n", args, errstr);
      47  # endif
      48  
      49  	puts("+++ exited with 0 +++");
      50  	return 0;
      51  }
      52  
      53  #else
      54  
      55  SKIP_MAIN_UNDEFINED("__NR_select && __NR__newselect"
      56  		    " && __NR_select != __NR__newselect"
      57  		    " && !defined __sparc__")
      58  
      59  #endif