(root)/
strace-6.5/
tests-mx32/
mlock.c
       1  /*
       2   * Check decoding of mlock and munlock syscalls.
       3   *
       4   * Copyright (c) 2016-2021 The strace developers.
       5   * All rights reserved.
       6   *
       7   * SPDX-License-Identifier: GPL-2.0-or-later
       8   */
       9  
      10  #include "tests.h"
      11  #include "scno.h"
      12  
      13  #ifdef __NR_mlock
      14  
      15  # include <stdio.h>
      16  # include <unistd.h>
      17  
      18  int
      19  main(void)
      20  {
      21  	const int size = 1024;
      22  	const char *addr = tail_alloc(size);
      23  
      24  	long rc = syscall(__NR_mlock, addr, size);
      25  	printf("mlock(%p, %d) = %s\n", addr, size, sprintrc(rc));
      26  
      27  	rc = syscall(__NR_munlock, addr, size);
      28  	printf("munlock(%p, %d) = %s\n", addr, size, sprintrc(rc));
      29  
      30  	puts("+++ exited with 0 +++");
      31  	return 0;
      32  }
      33  
      34  #else
      35  
      36  SKIP_MAIN_UNDEFINED("__NR_mlock")
      37  
      38  #endif