2 * Copyright (c) 2018 The strace developers.
5 * SPDX-License-Identifier: LGPL-2.1-or-later
9 #include "print_fields.h"
11 #include <linux/types.h>
12 #include <linux/random.h>
14 #define XLAT_MACROS_ONLY
15 #include "xlat/random_ioctl_cmds.h"
16 #undef XLAT_MACROS_ONLY
19 * RNDGETPOOL was removed in 2.6.9, so non-ancient kernels always
20 * return -EINVAL for that.
24 random_ioctl(struct tcb *const tcp, const unsigned int code,
25 const kernel_ulong_t arg)
27 struct rand_pool_info info;
34 ATTRIBUTE_FALLTHROUGH;
37 printnum_int(tcp, arg, "%d");
42 if (!umove_or_printaddr(tcp, arg, &info)) {
43 PRINT_FIELD_D("{", info, entropy_count);
44 PRINT_FIELD_D(", ", info, buf_size);
46 buf = arg + offsetof(struct rand_pool_info, buf);
47 printstrn(tcp, buf, info.buf_size);
52 /* ioctls with no parameters */
60 return RVAL_IOCTL_DECODED;