From 3efa7754cd14c20116c7b7813ac70ee3ac9f194b Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 14 Mar 2026 16:04:56 +0000 Subject: util/nvmutil: configurable eintr/eagain Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'util/nvmutil') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 4fd82664..9fc9adec 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -16,6 +16,8 @@ */ /* + * I/O config (build-time) + * * Regarding: * Retries on zero-return. * @@ -33,14 +35,27 @@ #ifndef MAX_ZERO_RW_RETRY #define MAX_ZERO_RW_RETRY 10 #endif - /* * 0: portable pread/pwrite * 1: real pread/pwrite (thread-safe) + * Pass this at build-time */ #ifndef HAVE_REAL_PREAD_PWRITE #define HAVE_REAL_PREAD_PWRITE 0 #endif +/* + * Configure whether to wait on + * EINTR on files, or EAGAIN on + * cmd cat (stdout). + * + * Pass these at build time. + */ +#ifndef LOOP_EAGAIN +#define LOOP_EAGAIN 1 +#endif +#ifndef LOOP_EINTR +#define LOOP_EINTR 1 +#endif /* * Major TODO: split this into multiple files. @@ -473,9 +488,7 @@ static const char *argv0; #define ARGC_4 4 #define NO_LOOP_EAGAIN 0 -#define LOOP_EAGAIN 1 #define NO_LOOP_EINTR 0 -#define LOOP_EINTR 1 enum { IO_READ, @@ -636,8 +649,8 @@ typedef char bool_skip_checksum_write[(SKIP_CHECKSUM_WRITE==0)?1:-1]; typedef char bool_checksum_write[(CHECKSUM_WRITE==1)?1:-1]; typedef char bool_no_invert[(NO_INVERT==0)?1:-1]; typedef char bool_part_invert[(PART_INVERT==1)?1:-1]; -typedef char bool_loop_eintr[(LOOP_EINTR==1)?1:-1]; -typedef char bool_loop_eagain[(LOOP_EAGAIN==1)?1:-1]; +typedef char bool_loop_eintr[(LOOP_EINTR==1||LOOP_EINTR==0)?1:-1]; +typedef char bool_loop_eagain[(LOOP_EAGAIN==1||LOOP_EAGAIN==0)?1:-1]; typedef char bool_no_loop_eintr[(NO_LOOP_EINTR==0)?1:-1]; typedef char bool_no_loop_eagain[(NO_LOOP_EAGAIN==0)?1:-1]; -- cgit v1.2.1