Questions tagged [linux]

Use this tag for code that specifically targets the Linux operating system (consider [unix] for more portable code that should run on other Unix-like systems).

Filter by
Sorted by
Tagged with
4 votes
1 answer
198 views

A simple mmap(2) wrapper

I've written a wrapper for the mmap syscall. It's quite limited in functionality at the moment (there are lots of flags to support) but it's sufficient for mapping ...
haz's user avatar
  • 243
-1 votes
1 answer
32 views

how to boost my script in fault tolerance ,performance and readability [closed]

...
xwj's user avatar
  • 9
5 votes
3 answers
769 views

Implementation of recursive `ls` utility

Recently I wrote my own implementation of a utility for recursive output of the directories' contents, kind of similar to the ls Linux utility with the ...
andylvua's user avatar
  • 215
2 votes
1 answer
42 views

Debian and Docker compose upgrade script, 2nd version

As a continuation of this question, I would like a second review from you. Here is the updated sh script: ...
Tobias Grothe's user avatar
3 votes
1 answer
252 views

Single threaded epoll based coroutine library for C++, Linux

I've implemented a small single-header library over the C++20 coroutines. This library only works on a single thread and it is limited to Linux because it is also based on epoll. The library does not ...
Pangi's user avatar
  • 145
5 votes
2 answers
357 views

Parsing gateway ip from `/proc/net/route` in a docker container

In try to replicate the outcome of the following command sequence using php: netstat -rn | grep "^0.0.0.0 " | cut -d " " -f10 I did this using ...
Dimitrios Desyllas's user avatar
0 votes
0 answers
38 views

Ansible role for installing and configuring SSH service

This is the Ansible role that installs and configures SSH service. What do you think about it? Is there something to improve? Thanks defaults/main.yml ...
lester's user avatar
  • 311
4 votes
2 answers
253 views

LKM: Extract cpu model name from /proc/cpuinfo

I wrote a small LKM that opens the /proc/cpuinfo file, reads it line by line, and attempts to the cpu model name. If the function fails to extract the cpu model ...
766F6964's user avatar
  • 901
2 votes
1 answer
211 views

Shell script to download multiple files from different URL's using for loop to download and verify files on each invocation

The expected behavior of the script is to download a file from a URL if the file is not present in the current directory and compare the md5 checksum of the file against the md5 checksum from the ...
Chris Stone's user avatar
1 vote
0 answers
29 views

For loop to download files once and verify them on each invocation [duplicate]

The complete script works as expected. I am able to download and verify the files. If the file is all ready present verification is retested and downloads if necessary. I'm in the process of teaching ...
Chris Stone's user avatar
2 votes
2 answers
121 views

Linux Script Set Permission Function

I wrote a simple script to set permissions for a file or folder for some embedded Linux devices as part of a larger setup script. This method would be called on less than 20 files and folders. It ...
netcat's user avatar
  • 193
3 votes
0 answers
115 views

Processing large blocklists with GNU Parallel

This is an ongoing project that has undergone a major update to speed up list processing. Here is the homepage for anyone interested! It processes lists defined in ...
T145's user avatar
  • 3,087
2 votes
1 answer
33 views

Improving Shell Installation Script

I'm currently working on a project and currently have this code. I already improved it by having some pointers, but I want to make it more professional looking and right. What should I implement next? ...
user avatar
2 votes
1 answer
122 views

Bash script that installs Arch Linux

I wrote a bash script that installs Arch Linux. I wanted to simplify the installation of the Arch Linux system by automating things like setting locale, hostname, networking, etc. This is my second ...
lester's user avatar
  • 311
2 votes
0 answers
56 views

a C/Python X server interface extension package

The project is named winlin; it's a portmanteau of the words window and Linux. I'm working on a CPython extension to interact with the X server and manipulate windows. I don't have a ton of ...
gnarlyninja's user avatar
4 votes
1 answer
111 views

Creating ZFS-based rootfs for installing Linux in Bash

I've written a bash script that creates a root filesystem on ZFS for installing Debian or Arch. The purpose of this script is to make it easier installing e.g. Arch without the need to make a ZFS pool ...
lester's user avatar
  • 311
5 votes
2 answers
617 views

RAII POSIX process created by fork

By analogy with std::thread, I've written an RAII POSIX process: ...
jezza's user avatar
  • 205
2 votes
2 answers
46 views

Archive, compress, remove old archive file then remove source file if below set size

I'm working on a script that will archive, compress, clear old archive files, then remove the source file if it is below a set size. The output when I tested it worked, but I just wanted a second ...
Brad Barnes's user avatar
4 votes
3 answers
284 views

A shell script to get the current battery status

Is this code well written? I'm not doing much, just rendering my battery status for my status bar but the code seems pretty long. I am new to Bash and Linux, so I thought this code could be improved ...
Diwas10's user avatar
  • 111
2 votes
1 answer
148 views

Multiply two huge base-10 numbers in assembly

This post is a second part of my original post, Add two huge base-10 numbers, which deals with adding two huge base-10 numbers. However, in this case, I'm multiplying two non-negative whole numbers. ...
avighnac's user avatar
  • 309
3 votes
1 answer
43 views

DmenuWacom: a front hand for wacom tablets

DmenuWacom During my raids, I came across and solved several problems, obviously in my style, very similar to the suckless.org approach and which still works quite well. In fact, I started writing a ...
NFVblog's user avatar
  • 61
5 votes
1 answer
134 views

declarative package manager for Arch Linux

pacdef is my declarative package manager for Arch Linux. I have written it since I often found myself discovering a new tool at one of my PCs, using it there for a ...
sarema's user avatar
  • 449
4 votes
1 answer
127 views

Add two huge base-10 numbers

This is some assembly code I've written to add two base-10 numbers. The input and output are represented as null-terminated ASCII strings, with digits in big-endian order. I have also provided ...
avighnac's user avatar
  • 309
11 votes
3 answers
2k views

Remove leading zeroes from the beginning of a string

I want to remove leading zeroes (for a big integer library I'm currently making) in numbers represented as char arrays. I chose assembly for speed, but in order to simplify making the algorithm and ...
avighnac's user avatar
  • 309
3 votes
1 answer
239 views

Find proceses listening on the network outside of default package manager v2

So this is a follow up questions to Find proceses listening on the network outside of default package manager I managed to make it a little faster thanks to using ...
N3buchadnezzar's user avatar
4 votes
2 answers
355 views

Find proceses listening on the network outside of default package manager

I have been tinkering with a script that should list things that are listening on the network, but are not part of the base packaging manager. Currently I have only done support for fedora and debian ...
N3buchadnezzar's user avatar
5 votes
1 answer
570 views

Bash script simple countdown timer with dotted output

My goal is to have a timer function that operates from the bash linux command line. I am looking for review and feedback. Printing the expected number of characters (dots, dashes, or bars) is nice-...
Steve T's user avatar
  • 183
2 votes
1 answer
97 views

Iterate over a process' maps file

The following logic provides iteration over /proc/<PID>/maps for a Linux process. What I'm primarily (though not solely) interested in for this review is ...
Daniel Walker's user avatar
4 votes
1 answer
325 views

Linux netlink kernel socket arp cache getter (similar to ip ne)

...
legale's user avatar
  • 141
2 votes
1 answer
142 views

Priority Job/Task Queue for Linux (sockets and multithreading)

Preface Please review my implementation of a job queue for linux/unix systems. This is my first time coding in C, although I have quite some experience in C++. I know this is a moderate amount of loc, ...
infinitezero's user avatar
4 votes
1 answer
76 views

Mount point API for Linux systems

I have a use case where I need to check, whether / is mounted read-only. Here's the module where I implemented this check: ...
Richard Neumann's user avatar
1 vote
1 answer
129 views

Simple networking framework in C++

Question: What do you think about this design and the implementation? This is a simple networking framework for IPv4, IPv6 TCP client and TCP server for Linux and MS-Windows in C++14. It uses a single-...
Andre Adrian's user avatar
3 votes
1 answer
116 views

Simple networking framework in C

Question: What do you think about this design and the implementation? This is a simple networking framework for IPv4, IPv6 TCP client and TCP server for Linux and MS-Windows in C. It uses a single-...
Andre Adrian's user avatar
2 votes
2 answers
3k views

touch command in C

I wrote a program in C that simulates the touch command from linux. I would like to ask you to criticize my implementation, to find bugs in particular ...
Mark's user avatar
  • 449
3 votes
1 answer
100 views

System V signal API using the standard POSIX API

I wrote a program that implements a POSIX signal API. It implements the functions sigset(), sighold(), ...
Lorand's user avatar
  • 31
2 votes
2 answers
166 views

nice utility in C

I implemented the nice linux command. How can I improve the program? In terms of optimization, error handling, bugs and possible undefined behaviors ...
Mark's user avatar
  • 449
4 votes
1 answer
75 views

improved "tee" utility

We have modified the tee program with your suggestions from the previous pull request. Did I implement well? I would like to optimize the program even more, what ...
Mike's user avatar
  • 299
1 vote
1 answer
77 views

daemon in a producer-consumer

The daemon program is associated with a message queue with a predefined key, to be blocked later when waiting for messages. The two programs implement a producer-...
Mike's user avatar
  • 299
2 votes
1 answer
93 views

Changing the attributes of a file

I wrote a program that changes the attributes of a file. How can I make the program more efficient? Please find program problems. How can I improve the program? ...
Dave's user avatar
  • 51
3 votes
2 answers
576 views

Implementation of the "tee" utility program

How can I optimize the program? To make it more optimal? The program should be more optimal in terms of source code, compiled executable size, memory usage, speed, bugs etc. Please criticize the ...
Mike's user avatar
  • 299
2 votes
2 answers
136 views

another attempt to implement the tee command

I implemented the tee command from linux. The program implements the -a option Reads standard input until end-of-file, write a ...
Mike's user avatar
  • 299
3 votes
1 answer
64 views

display processes children

The following program uses a parent program to determine the PIDs of multiple child processes. A function is called to return them to a dynamic vector (with the children's pids, but also the elements ...
Mike's user avatar
  • 299
3 votes
3 answers
148 views

tee: copy standard input to both stdout and a file

I implemented the tee command from linux. The program also handles the -a option for adding text to the end of a file if it ...
Mike's user avatar
  • 299
3 votes
2 answers
115 views

change file attributes on a Linux file system with chattr

I am reading the book The Linux Programming Interface and I have reached the exercise in which the implementation of the chattr command in C is required. I would ...
Dave's user avatar
  • 51
2 votes
1 answer
223 views

implementation of the `mkdir` command with `-p` parameter in C

I wrote a program that implements the mkdir command with the -p parameter to create the parent directly if it does not exist. My ...
Mark's user avatar
  • 449
1 vote
1 answer
20 views

seq with range:

Is there a simpler way to get this result? Also what is the syntax in fish for adding numbers to an array index before executing the lookup? ...
jaksco's user avatar
  • 113
0 votes
0 answers
258 views

Modifying a Linux touch driver to poll I2C data instead of using interrupts

I managed to modify the st1232.c touch driver to poll I2C data from the touch controller, instead of using interrupts. This way I don't need an extra interrupt wire. On the other side I am now using ...
arminb's user avatar
  • 101
2 votes
1 answer
286 views

Base64 encoder in Assembly x86-64 Linux language

We were asked to create a Base64 encoder for Assembly x86-64 on Linux. Was wondering how my code below could be improved, be it notation or anything else. We only had Assembly for 3 months so I'm not ...
user avatar
5 votes
0 answers
155 views

Single-threaded coroutine in C (Linux x86-64)

Background Story I crafted a simple single-threaded coroutine in C, running on Linux x86-64. Short Technical Explanation 1) Task There are two types of tasks in this implementation. Main task. This ...
Ammar Faizi's user avatar
2 votes
2 answers
104 views

Retrieve Logs from Multiple Containers on Remote Server

Recently I had the requirement to allow multiple containers of the same application to be run on a single development server. This requirement drastically changed how we retrieve logs over SSH from ...
Brendan Lesniak's user avatar

1
2 3 4 5
12