* xlat/aio_iocb_flags.in: New file.
* defs.h (pollflags, rwf_flags): New declarations.
* configure.ac (AC_CHECK_MEMBERS): Check for aio_flags and aio_rw_flags
fields of struct iocb.
* aio.c [HAVE_STRUCT_IOCB_AIO_FLAGS]: Include "xlat/aio_iocb_flags.h".
(AIO_RW_FLAGS_FIELD): New macro definition, defined based on the
presence of HAVE_STRUCT_IOCB_AIO_RW_FLAGS macro.
(iocb_sub): Add SUB_POLL.
(tprint_lio_opcode): Change IOCB_CMD_POLL subtype to SUB_POLL.
(print_common_flags): Conditionalize on HAVE_STRUCT_IOCB_AIO_FLAGS
instead of IOCB_FLAG_RESFD. Print aio_flags using aio_iocb_flags xlat.
(print_iocb_header): Always print aio_data. Print aio_rw_flags if it
is non-zero. Print aio_reqprio based on the presence of
IOCB_FLAG_IOPRIO flag in aio_flags (use print_ioprio if it set and print
as a signed integer otherwise).
(print_iocb): Decode SUB_POLL subtype.
* tests/aio.c: Update expected output.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
#include "xlat/aio_cmds.h"
+#ifdef HAVE_STRUCT_IOCB_AIO_FLAGS
+# include "xlat/aio_iocb_flags.h"
+#endif
+
+#ifdef HAVE_STRUCT_IOCB_AIO_RW_FLAGS
+# define AIO_RW_FLAGS_FIELD aio_rw_flags
+#else
+# define AIO_RW_FLAGS_FIELD aio_reserved1
+#endif
+
SYS_FUNC(io_setup)
{
if (entering(tcp))
}
enum iocb_sub {
- SUB_NONE, SUB_COMMON, SUB_VECTOR
+ SUB_NONE, SUB_COMMON, SUB_VECTOR, SUB_POLL
};
static enum iocb_sub
[IOCB_CMD_FSYNC] = SUB_NONE,
[IOCB_CMD_FDSYNC] = SUB_NONE,
[IOCB_CMD_PREADX] = SUB_NONE,
- [IOCB_CMD_POLL] = SUB_NONE,
+ [IOCB_CMD_POLL] = SUB_POLL,
[IOCB_CMD_NOOP] = SUB_NONE,
[IOCB_CMD_PREADV] = SUB_VECTOR,
[IOCB_CMD_PWRITEV] = SUB_VECTOR,
static void
print_common_flags(struct tcb *tcp, const struct iocb *cb)
{
-/* IOCB_FLAG_RESFD is available since v2.6.22-rc1~47 */
-#ifdef IOCB_FLAG_RESFD
+/* aio_flags and aio_resfd fields are available since v2.6.22-rc1~47 */
+#ifdef HAVE_STRUCT_IOCB_AIO_FLAGS
+ if (cb->aio_flags)
+ PRINT_FIELD_FLAGS(", ", *cb, aio_flags, aio_iocb_flags,
+ "IOCB_FLAG_???");
+
if (cb->aio_flags & IOCB_FLAG_RESFD)
PRINT_FIELD_FD(", ", *cb, aio_resfd, tcp);
-
- if (cb->aio_flags & ~IOCB_FLAG_RESFD)
- PRINT_FIELD_X(", ", *cb, aio_flags);
+ else if (cb->aio_resfd)
+ PRINT_FIELD_X(", ", *cb, aio_resfd);
#endif
}
{
enum iocb_sub sub;
- if (cb->aio_data){
- PRINT_FIELD_X("", *cb, aio_data);
- tprints(", ");
- }
+ PRINT_FIELD_X("", *cb, aio_data);
- if (cb->aio_key) {
- PRINT_FIELD_U("", *cb, aio_key);
- tprints(", ");
+ if (cb->aio_key)
+ PRINT_FIELD_U(", ", *cb, aio_key);
+
+ if (cb->AIO_RW_FLAGS_FIELD) {
+ tprints(", aio_rw_flags=");
+ printflags(rwf_flags, cb->AIO_RW_FLAGS_FIELD, "RWF_???");
}
- tprints("aio_lio_opcode=");
+ tprints(", aio_lio_opcode=");
sub = tprint_lio_opcode(cb->aio_lio_opcode);
- if (cb->aio_reqprio)
+
+ if (cb->aio_flags & IOCB_FLAG_IOPRIO) {
+ tprints(", aio_reqprio=");
+ print_ioprio(zero_extend_signed_to_ull(cb->aio_reqprio));
+ } else if (cb->aio_reqprio) {
PRINT_FIELD_D(", ", *cb, aio_reqprio);
+ }
PRINT_FIELD_FD(", ", *cb, aio_fildes, tcp);
PRINT_FIELD_D(", ", *cb, aio_offset);
print_common_flags(tcp, cb);
break;
+ case SUB_POLL:
+ PRINT_FIELD_FLAGS(", ", *cb, aio_buf, pollflags, "POLL???");
+ print_common_flags(tcp, cb);
+ break;
case SUB_NONE:
break;
}
AC_CHECK_TYPES([struct __aio_sigset],,, [#include <linux/aio_abi.h>])
+AC_CHECK_MEMBERS(m4_normalize([
+ struct iocb.aio_flags,
+ struct iocb.aio_rw_flags
+ ]),,, [#include <linux/aio_abi.h>])
+
CPPFLAGS="$saved_CPPFLAGS"
AC_CHECK_HEADERS([linux/btrfs.h], [
extern const struct xlat nl_route_types[];
extern const struct xlat open_access_modes[];
extern const struct xlat open_mode_flags[];
+extern const struct xlat pollflags[];
extern const struct xlat ptrace_cmds[];
extern const struct xlat resource_flags[];
extern const struct xlat routing_scopes[];
extern const struct xlat routing_table_ids[];
extern const struct xlat routing_types[];
+extern const struct xlat rwf_flags[];
extern const struct xlat seccomp_filter_flags[];
extern const struct xlat seccomp_ret_action[];
extern const struct xlat setns_types[];
/* In order to make record valid */
.aio_nbytes = (size_t) 0x1020304050607080ULL,
.aio_offset = 0xdeadda7abadc0dedULL,
-# ifdef IOCB_FLAG_RESFD
+# ifdef HAVE_STRUCT_IOCB_AIO_FLAGS
.aio_flags = 0xfacef157,
.aio_resfd = 0xded1ca7e,
# endif
printf("io_submit(%#lx, %ld, ["
"{aio_data=%#" PRI__x64 ", aio_key=%u"
", aio_lio_opcode=%hu /* IOCB_CMD_??? */, aio_fildes=%d}"
- ", {aio_key=%u, aio_lio_opcode=IOCB_CMD_PWRITE, aio_reqprio=%hd"
- ", aio_fildes=%d, aio_buf=NULL"
+ ", {aio_data=0, aio_key=%u, aio_lio_opcode=IOCB_CMD_PWRITE"
+ ", aio_reqprio=IOPRIO_PRIO_VALUE(0x5 /* IOPRIO_CLASS_??? */"
+ ", 7919), aio_fildes=%d, aio_buf=NULL"
", aio_nbytes=%" PRI__u64 ", aio_offset=%" PRI__d64
-# ifdef IOCB_FLAG_RESFD
- ", aio_resfd=%d, aio_flags=%#x"
+# ifdef HAVE_STRUCT_IOCB_AIO_FLAGS
+ ", aio_flags=IOCB_FLAG_RESFD|IOCB_FLAG_IOPRIO|%#x, aio_resfd=%d"
# endif
- "}, {aio_key=%u, aio_lio_opcode=IOCB_CMD_PWRITE"
+ "}, {aio_data=0, aio_key=%u, aio_lio_opcode=IOCB_CMD_PWRITE"
", aio_reqprio=%hd, aio_fildes=%d, aio_buf=%#" PRI__x64
", aio_nbytes=%" PRI__u64 ", aio_offset=%" PRI__d64
- "}, {aio_key=%u, aio_lio_opcode=IOCB_CMD_PWRITE"
+ "}, {aio_data=0, aio_key=%u, aio_lio_opcode=IOCB_CMD_PWRITE"
", aio_reqprio=%hd, aio_fildes=%d"
", aio_buf=\"\\0\\1\\2\\3%.28s\"..."
", aio_nbytes=%" PRI__u64 ", aio_offset=%" PRI__d64
- "}, {aio_key=%u, aio_lio_opcode=IOCB_CMD_PWRITEV"
+ "}, {aio_data=0, aio_key=%u, aio_lio_opcode=IOCB_CMD_PWRITEV"
", aio_reqprio=%hd, aio_fildes=%d, aio_buf=%#" PRI__x64
", aio_nbytes=%" PRI__u64 ", aio_offset=%" PRI__d64
"}, NULL, %#lx, ... /* %p */]) = ",
*ctx, 1057L,
cbv2[0].aio_data, cbv2[0].aio_key,
cbv2[0].aio_lio_opcode, cbv2[0].aio_fildes,
- cbv2[1].aio_key, cbv2[1].aio_reqprio, cbv2[1].aio_fildes,
+ cbv2[1].aio_key, cbv2[1].aio_fildes,
cbv2[1].aio_nbytes, cbv2[1].aio_offset,
-# ifdef IOCB_FLAG_RESFD
- cbv2[1].aio_resfd, cbv2[1].aio_flags,
+# ifdef HAVE_STRUCT_IOCB_AIO_FLAGS
+ cbv2[1].aio_flags & ~3, cbv2[1].aio_resfd,
# endif
cbv2[2].aio_key, cbv2[2].aio_reqprio, cbv2[2].aio_fildes,
cbv2[2].aio_buf, cbv2[2].aio_nbytes, cbv2[2].aio_offset,
--- /dev/null
+IOCB_FLAG_RESFD 1
+IOCB_FLAG_IOPRIO 2