summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-14 16:04:56 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-14 16:04:56 +0000
commit3efa7754cd14c20116c7b7813ac70ee3ac9f194b (patch)
tree192392b0d5b1933de56d1915d14421a7ecb2e22a
parentc33e60531aed35d2c0e439154a9c85375b0be990 (diff)
util/nvmutil: configurable eintr/eagain
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--util/nvmutil/nvmutil.c23
1 files changed, 18 insertions, 5 deletions
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];