Skip to content

Commit ecf90a4

Browse files
committed
Add errno details to journal traces
Enhanced error logging by including errno values in journal traces when file operations like open() fail. This provides more detailed diagnostics for debugging I/O issues. Signed-off-by: Deepa Karthikeyan <[email protected]>
1 parent f8713b3 commit ecf90a4

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

libpdbg/dtb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static bool get_chipid(uint32_t *chip_id)
9898
cfam_id_file = fopen(path, "r");
9999
free(path);
100100
if (!cfam_id_file) {
101-
pdbg_log(PDBG_ERROR, "Unable to open CFAM ID file\n");
101+
pdbg_log(PDBG_ERROR, "Unable to open CFAM ID file errno: %d\n",errno);
102102
return false;
103103
}
104104

@@ -512,7 +512,7 @@ static void mmap_dtb(const char *file, bool readonly, struct pdbg_mfile *mfile)
512512
else
513513
fd = open(file, O_RDWR);
514514
if (fd < 0) {
515-
pdbg_log(PDBG_ERROR, "Unable to open dtb file '%s'\n", file);
515+
pdbg_log(PDBG_ERROR, "Unable to open dtb file '%s' errno: %d\n", file, errno);
516516
return;
517517
}
518518

libpdbg/kernel.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,14 @@ static void kernel_fsi_scan_devices(void)
128128

129129
fd = open(path, O_WRONLY | O_SYNC);
130130
if (fd < 0) {
131-
PR_ERROR("Unable to open %s\n", path);
131+
PR_ERROR("Unable to open %s errno: %d\n", path, errno);
132132
free(path);
133133
return;
134134
}
135135

136136
rc = write(fd, &one, sizeof(one));
137137
if (rc < 0)
138-
PR_ERROR("Unable to write to %s\n", path);
138+
PR_ERROR("Unable to write to %s errno: %d\n", path, errno);
139139

140140
free(path);
141141
close(fd);
@@ -186,7 +186,7 @@ int kernel_fsi_probe(struct pdbg_target *target)
186186
}
187187
}
188188

189-
PR_INFO("Unable to open %s\n", path);
189+
PR_INFO("Unable to open %s, errno: %d \n", path, errno);
190190
free(path);
191191
return -1;
192192
}
@@ -264,7 +264,7 @@ static int kernel_pib_probe(struct pdbg_target *target)
264264

265265
pib->fd = open(scom_path, O_RDWR | O_SYNC);
266266
if (pib->fd < 0) {
267-
PR_INFO("Unable to open %s\n", scom_path);
267+
PR_INFO("Unable to open %s errno: %d\n", scom_path, errno);
268268
return -1;
269269
}
270270

libpdbg/sbefifo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ static int sbefifo_probe(struct pdbg_target *target)
854854

855855
rc = sbefifo_connect(sbefifo_path, proc, &sf->sf_ctx);
856856
if (rc) {
857-
PR_ERROR("Unable to open sbefifo driver %s\n", sbefifo_path);
857+
PR_ERROR("Unable to open sbefifo driver %s errno: %d\n", sbefifo_path, rc);
858858
return rc;
859859
}
860860

0 commit comments

Comments
 (0)