(root)/
strace-6.5/
src/
access.c
       1  /*
       2   * Copyright (c) 2014-2021 The strace developers.
       3   * All rights reserved.
       4   *
       5   * SPDX-License-Identifier: LGPL-2.1-or-later
       6   */
       7  
       8  #include "defs.h"
       9  
      10  #include <fcntl.h>
      11  
      12  #include "xlat/access_modes.h"
      13  #include "xlat/faccessat_flags.h"
      14  
      15  static void
      16  decode_access(struct tcb *tcp, int offset)
      17  {
      18  	/* pathname */
      19  	printpath(tcp, tcp->u_arg[offset]);
      20  	tprint_arg_next();
      21  
      22  	/* mode */
      23  	printflags(access_modes, tcp->u_arg[offset + 1], "?_OK");
      24  }
      25  
      26  SYS_FUNC(access)
      27  {
      28  	decode_access(tcp, 0);
      29  	return RVAL_DECODED;
      30  }
      31  
      32  static void
      33  decode_faccessat(struct tcb *tcp)
      34  {
      35  	/* dirfd */
      36  	print_dirfd(tcp, tcp->u_arg[0]);
      37  	tprint_arg_next();
      38  
      39  	decode_access(tcp, 1);
      40  }
      41  
      42  
      43  SYS_FUNC(faccessat)
      44  {
      45  	decode_faccessat(tcp);
      46  	return RVAL_DECODED;
      47  }
      48  
      49  SYS_FUNC(faccessat2)
      50  {
      51  	decode_faccessat(tcp);
      52  	tprint_arg_next();
      53  
      54  	/* flags */
      55  	printflags(faccessat_flags, tcp->u_arg[3], "AT_???");
      56  	return RVAL_DECODED;
      57  }