diff --git a/main.c b/main.c index 4f82738430beb2712fa03bb4d9383d9aee90c37a..e393aca407e6cdc7761f736c8cee75ec8a20aaf9 100644 --- a/main.c +++ b/main.c @@ -24,7 +24,7 @@ void read_cpu_temp() { //write pipe const char *pOne = "/tmp/pipeOne"; - int vOne = open(pOne, O_WRONLY);//todo: | O_NONBLOCK + int vOne = open(pOne, O_WRONLY O_NONBLOCK);//todo: | O_NONBLOCK if (vOne == -1){ perror("Failed to open pipe one in read_cpu_temp"); return; @@ -44,7 +44,7 @@ void read_cpu_frequency() { char *freq_path = "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq"; file = fopen(freq_path, "r"); - if (file == NULL) {b + if (file == NULL) { printf("Error opening file\n"); return; } @@ -67,7 +67,7 @@ int main(void) { read_cpu_frequency(); //read pipes - int vOne = open(pOne, O_RDONLY);//todo: | O_NONBLOCK + int vOne = open(pOne, O_RDONLY | O_NONBLOCK);//todo: | O_NONBLOCK if (vOne == -1) { perror("Failed to open pipe one in main"); return 1; @@ -75,7 +75,7 @@ int main(void) { char mOne[1024] = {}; //for now only sending char with the pipe read(vOne, mOne, sizeof(mOne)); printf("value one received: %s\n", mOne); - close(vOne); //testing commit + close(vOne); return 0; } \ No newline at end of file