Questions tagged [posix]

POSIX is an acronym for Portable Operating System Interface, a set of standards defining programming APIs and utility behavior for Unix-like operating systems.

Filter by
Sorted by
Tagged with
0
votes
1answer
41 views

Handle builtin commands

I've written a small C function to handle the builtin commands of a custom shell that I'm writing in C. Is it better to use a switch instead? ...
2
votes
1answer
41 views

C function to find the less program

I've written a C function to find the program less that the operating system should provide. If lessis not provided, some other ...
11
votes
1answer
193 views

Recreation of cat in C

I have a school project to create a program that works the same as the Linux cat. The code works, but I just need find out where I can Improve it or handle errors. ...
1
vote
1answer
2k views

Multithreaded MJPG network stream server

I'm a bit of a neophyte when it comes to C++, and so I'd like some feedback regarding a recent project. The code sits on a Raspberry Pi and streams camera data over TCP on a specified port. The ...
5
votes
2answers
1k views

Colorful output on terminal

I went from manually outputting escape codes in each string to creating a utility struct/class full of static functions and variables that needed to be initialized in source files (static private ...
6
votes
1answer
238 views

Subset of UNIX standard tar implementation

I recently implemented a subset of the ustar archiving utility as my first year programming one project. I would like to get it reviewed and if anyone has anything to point out. dir.c ...
6
votes
2answers
164 views

Implementation of the ls command with several options - follow-up 2

I've made more improvements from previous iterations and my own, including: Added the -n flag (print owner and group IDs instead of names) Eliminated some ...
11
votes
2answers
956 views

Implementation of the ls command with several options - follow-up

I've made vast improvements to my previous ls implementation, including: Added new flags: -g (omit owner listing) ...
18
votes
3answers
9k views

Implementation of the ls command with several options

As part of a past assignment, I've expanded on this implementation of ls to have more options available, including non-standard ones. It currently supports these (...
2
votes
0answers
68 views

N Processing connect to a single process: Socket Programming

The idea of my program is to use pthreads, semaphores, posix shared memory, and sockets to create an environment where N processes (that we will refer to as the children) can connect to a single ...
3
votes
2answers
136 views

Self-written Mutex for 2+ Threads

I have written the following code, and so far in all my tests it seems as if I have written a working Mutex for my 4 Threads, but I would like to get someone else's opinion on the validity of my ...
10
votes
1answer
119 views

POSIX shell compatible and POSIX conforming dirname implementation

The discussion in the comments of this answer made me wonder how hard it would be to write a built-in only version of dirname. This is what I ended up with but I'm ...
5
votes
2answers
3k views

Fast line-by-line file reader

This is designed for a high performance complex log analyzer. Very simple idea: read a file line-by-line as fast as possible. I would appreciate any hints what should/could be improved in this code. ...
2
votes
1answer
66 views

Implementing dirpath(3p) and fdirpath(3p) functions

I'm implementing a dirpath and fdirpath functions, which allow to retrieve path from the directory handle (or its descriptor). ...
5
votes
1answer
69 views

Simple file locking wrapper command in C

A simple command that wraps another command, locking a file first. It is similar to flock, just simpler. ...
2
votes
2answers
282 views

ttyname() implemented in Go

I'm rewriting GNU's coreutils in Go in order to learn Go better. I've implemented ttyname(3), and I'm looking for a general critique. I can't think of anything in particular I think I did poorly on. (...
6
votes
3answers
2k views

Check disk space against a threshold

The below script is one I made to check the disk space on mounted partitions under Debian Wheezy. I tried adding a -d switch to force printing out the used data, ...
6
votes
2answers
141 views

Optimize bash script that concatenates output

I am trying to optimize my script that loops through a folder and extracts only the part of a file name before a date and the header of the file and outputs it into a different file using a delimiter. ...
3
votes
3answers
987 views

Producer-consumer code

The idea I have in my head is this: I am not sure if I need the index variable in consumer and producer. Moreover, I want to know if it is OK like this (it seems ...
16
votes
2answers
673 views

Interprocess Communication in a Farmer-Worker setup

The following code is my first C program I have made for an university assignment about Interprocess Communication. This involved creating a parent process, the farmer, and then creating a certain ...