]> granicus.if.org Git - strace/blob - nsfs.c
Remove XLAT_END
[strace] / nsfs.c
1 /*
2  * Support for decoding of NS_* ioctl commands.
3  *
4  * Copyright (c) 2017 Nikolay Marchuk <marchuk.nikolay.a@gmail.com>
5  * Copyright (c) 2017-2018 The strace developers.
6  * All rights reserved.
7  *
8  * SPDX-License-Identifier: LGPL-2.1-or-later
9  */
10
11 #include "defs.h"
12 #include "nsfs.h"
13
14 int
15 nsfs_ioctl(struct tcb *tcp, unsigned int code, kernel_ulong_t arg)
16 {
17         unsigned int uid;
18         switch (code) {
19         case NS_GET_USERNS:
20         case NS_GET_PARENT:
21                 return RVAL_IOCTL_DECODED | RVAL_FD;
22         case NS_GET_NSTYPE:
23                 if (entering(tcp))
24                         return 0;
25                 if (!syserror(tcp))
26                         tcp->auxstr = xlookup(setns_types, tcp->u_rval);
27                 return RVAL_IOCTL_DECODED | RVAL_STR;
28         case NS_GET_OWNER_UID:
29                 if (entering(tcp))
30                         return 0;
31                 tprints(", ");
32                 if (!umove_or_printaddr(tcp, arg, &uid)) {
33                         printuid("[", uid);
34                         tprints("]");
35                 }
36                 return RVAL_IOCTL_DECODED;
37         default:
38                 return RVAL_DECODED;
39         }
40 }