]> granicus.if.org Git - strace/blob - hdio.c
clone: fix print_tls_arg on x86
[strace] / hdio.c
1 /*
2  * Copyright (c) 2009, 2010 Jeff Mahoney <jeffm@suse.com>
3  * Copyright (c) 2011-2016 Dmitry V. Levin <ldv@altlinux.org>
4  * Copyright (c) 2016-2018 The strace developers.
5  * All rights reserved.
6  *
7  * SPDX-License-Identifier: LGPL-2.1-or-later
8  */
9
10 #include "defs.h"
11
12 #include DEF_MPERS_TYPE(struct_hd_geometry)
13
14 #include <linux/hdreg.h>
15
16 typedef struct hd_geometry struct_hd_geometry;
17
18 #include MPERS_DEFS
19
20 MPERS_PRINTER_DECL(int, hdio_ioctl, struct tcb *const tcp,
21                    const unsigned int code, const kernel_ulong_t arg)
22 {
23         switch (code) {
24         case HDIO_GETGEO:
25                 if (entering(tcp))
26                         return 0;
27                 else {
28                         struct_hd_geometry geo;
29
30                         tprints(", ");
31                         if (!umove_or_printaddr(tcp, arg, &geo))
32                                 tprintf("{heads=%u, sectors=%u, "
33                                         "cylinders=%hu, start=%lu}",
34                                         (unsigned) geo.heads,
35                                         (unsigned) geo.sectors,
36                                         geo.cylinders,
37                                         (unsigned long) geo.start);
38                 }
39                 break;
40         default:
41                 return RVAL_DECODED;
42         }
43
44         return RVAL_IOCTL_DECODED;
45 }