2
votes
3answers
128 views

What can I improve in my coding style?

I wrote an example program about UNIX semaphores, where a process and its child lock/unlock the same semaphore. I would appreciate your feedback about what I could improve in my C style. Generally I ...
2
votes
1answer
76 views

lightweight packet sniffer review

This is a simple packet sniffer that turns on LEDs when there's network activity. It works by picking up filters in a configuration file and listen for activity in those filters. When there's a ...
1
vote
3answers
159 views

Possible improvements for this small C program?

I'm learning C and today I wrote a program that displays info about my hardware on ubuntu. #include <stdio.h> #include <stdlib.h> int main() { char ch, file_name[25] = ...
2
votes
2answers
93 views

Need some advice and feedback on my C code calling Bash functions

My intent is to use Bash functions defined in functions.sh in a C program. I am doing this so that I don't have to rewrite the Bash functionality again in C. I want to use one common library for ...
1
vote
1answer
45 views

Are these set-uid scripts/binaries secure?

I have a system that needs to be able to reboot a different piece of hardware partway through a script that programs it. It used to wait for me to come and reboot the hardware halfway through, but ...
1
vote
1answer
2k views

Producer-consumer in C using pthread_barrier

We're preparing for an exam at the moment, and our lecturer has given us a sample problem to work on. I have it completed, but would like to know a) If it is actually doing what it's supposed to, and ...
3
votes
4answers
143 views

Improving file reading

I am programing in C language and have created the below functions to read files. There are two functions that I can use to read files. I wanted to know how I can further improve these two in terms of ...
1
vote
1answer
70 views

Trimming whitespace from the beginning and ending of a file

In the code below, I want to remove the "white space character" from 2 places only, from the end of 1st line and from the end of last line. How can I optimize it ? Platform : Linux , gcc compiler ...
2
votes
0answers
530 views

mutex and condition variable implementation using futex

I have implemented mutex and contition variables using futex syscall. I believe that my implementation is correct, but would like it to be verified by some one else. If some of you could verify its ...