summaryrefslogtreecommitdiff
path: root/handle_devices.c
diff options
context:
space:
mode:
authorClay Smith <claysmith158@gmail.com>2023-03-25 00:17:05 -0500
committerClay Smith <claysmith158@gmail.com>2023-03-25 00:17:05 -0500
commiteb8a6b1b4c9cf66afc395f8de49f6c189217e8e3 (patch)
tree9a4536c9d26c2a3174bece46042403c9b6ca16b9 /handle_devices.c
parent20d268bc08683c0250e49a82433fb79a3239529f (diff)
Clearer error message when unable to read devices.HEADmain
Diffstat (limited to 'handle_devices.c')
-rw-r--r--handle_devices.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/handle_devices.c b/handle_devices.c
index 439ad27..7c854d0 100644
--- a/handle_devices.c
+++ b/handle_devices.c
@@ -37,7 +37,8 @@ void print_one_event(unsigned long long event_num)
int fptr = open(path_to_event, O_RDWR);
int initial_read = read(fptr, &event, event_size);
if (initial_read == -1) {
- fprintf(stderr, "PROBLEM READING FILE!\n");
+ fprintf(stderr, "PROBLEM READING FILE!\n \
+ Either your input number does not correlate to a device file or you do not have permission set up properly to read input files. (Most common)");
exit(-1);
}
char buffer[BUFSIZE+1] = {0};
@@ -76,7 +77,8 @@ void print_multiple_events(int num_events, unsigned long long event_nums[])
//make sure there was no error
int initial_read = read(event_fptrs[0], &event[0], event_size);
if (initial_read == -1) {
- fprintf(stderr, "PROBLEM READING FILE!\n");
+ fprintf(stderr, "PROBLEM READING FILE!\n \
+ Either your input number does not correlate to a device file or you do not have permission set up properly to read input files. (Most common)");
exit(-1);
}
//shared memory for all processes to get usec
@@ -101,7 +103,8 @@ void print_multiple_events(int num_events, unsigned long long event_nums[])
char buffer[BUFSIZE+1];
int initial_read = read(event_fptrs[0], &event[0], event_size);
if (initial_read == -1) {
- fprintf(stderr, "PROBLEM READING FILE!\n");
+ fprintf(stderr, "PROBLEM READING FILE!\n \
+ Either your input number does not correlate to a device file or you do not have permission set up properly to read input files. (Most common)");
exit(-1);
}
int string_size = 0;
@@ -126,7 +129,8 @@ void print_multiple_events(int num_events, unsigned long long event_nums[])
char buffer[BUFSIZE+1];
int initial_read = read(event_fptrs[i+1], &event[i+1], event_size);
if (initial_read == -1) {
- fprintf(stderr, "PROBLEM READING FILE!\n");
+ fprintf(stderr, "PROBLEM READING FILE!\n \
+ Either your input number does not correlate to a device file or you do not have permission set up properly to read input files. (Most common)");
exit(-1);
}
int string_size = 0;