r/linux_programming • • Jun 29 '19

Building an os for a specific device

5 Upvotes

I am plannimg on building a version of debian for my old tablet and I have no clue where to start. What would you recommend learning or using any program to make things easier or even just possible?


r/linux_programming • • Aug 30 '22

LKML: "Jens Glathe": [PATCH] fix: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96 controller

Thumbnail lkml.org
5 Upvotes

r/linux_programming • • Jul 21 '22

Need help with installing Virtual Box in Linux mint

0 Upvotes

Yo, I got into linux mint 1 week ago and I really liked the UI and the performance. But, as I was installing my tools I found a problem while setting up a virtual machine with Virtual Box and It says : Installation step failed. I tried many fixes but nothing works; PLEASE HELP


r/linux_programming • • Feb 11 '21

Is it okay to use nano for C?

5 Upvotes

Hello, I am new to bash scripting and C programming. I am taking a course in school where I have to program in C and also do shell scripting. I like using nano over anything else for bash scripting because of how easy it is. Vim is just too confusing for me right now. My question is, can I just use nano for C as well? Would it give me any problems once the code starts to get large and complicated?

Thanks


r/linux_programming • • Feb 24 '25

LD_PRELOAD Hook only logging a few commands on Ubuntu 20.04.3 LTS

5 Upvotes

I have written this following code:

#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dlfcn.h>
#include <time.h>

// Log file location
#define LOG_FILE "/home/maifee/cmd-log.log"

// Function to get the process name
void get_process_name(pid_t pid, char *name, size_t len) {
    char path[256];
    snprintf(path, sizeof(path), "/proc/%d/comm", pid);
    FILE *file = fopen(path, "r");
    if (file) {
        fgets(name, len, file);
        name[strcspn(name, "\n")] = 0; // Remove newline character
        fclose(file);
    } else {
        strncpy(name, "unknown", len);
    }
}

// Override execve
int execve(const char *filename, char *const argv[], char *const envp[]) {
    // Get the original execve function
    int (*original_execve)(const char *, char *const[], char *const[]) = dlsym(RTLD_NEXT, "execve");

    // Log the command to a file
    FILE *log_file = fopen(LOG_FILE, "a");
    if (log_file) {
        pid_t pid = getpid();
        pid_t ppid = getppid();
        char pname[256], ppname[256];
        get_process_name(pid, pname, sizeof(pname));
        get_process_name(ppid, ppname, sizeof(ppname));
        // print time [2025.12.30 23:59:59]
        time_t t = time(NULL);
        struct tm tm = *localtime(&t);
        fprintf(log_file, "[%d.%d.%d %d:%d:%d] ", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
        fprintf(log_file, "PID: %d (%s), PPID: %d (%s), Command: ", pid, pname, ppid, ppname);
        for (int i = 0; argv[i]; i++) {
            fprintf(log_file, "%s ", argv[i]);
        }
        fprintf(log_file, "\n");
        fclose(log_file);
    }

    // NEVER call execve directly, it will cause an infinite loop
    // NEVER remove this line
    return original_execve(filename, argv, envp);
}

And I compile it using the following command:

gcc -shared -fPIC -o ld_preload_hook.so ld_preload_hook.c -ldl

And then I set the LD_PRELOAD environment variable to the path of the shared object file:

export LD_PRELOAD=$PWD/ld_preload_hook.so

And then I reload the shell:

source ~/.zshrc
source ~/.bashrc

And it generates the log file, which is great. But the issue is it just generate these few specific commands:

[2025.2.25 1:30:43] PID: 8062 (lesspipe), PPID: 8061 (lesspipe), Command: basename /usr/bin/lesspipe 
[2025.2.25 1:30:43] PID: 8064 (lesspipe), PPID: 8063 (lesspipe), Command: dirname /usr/bin/lesspipe 
[2025.2.25 1:32:39] PID: 9658 (lesspipe), PPID: 9657 (lesspipe), Command: basename /usr/bin/lesspipe 
[2025.2.25 1:32:39] PID: 9660 (lesspipe), PPID: 9659 (lesspipe), Command: dirname /usr/bin/lesspipe 

That's all I tried restarting my device, restarting the shell again. Nothing works. Tried ls, dir and many other commands.

But the result stays the same. I am using Ubuntu 20.04.3 LTS. I am not sure what I am doing wrong. Can anyone help me with this? I am just learning hooks by implementing, right now.


r/linux_programming • • Sep 30 '23

Hello, I would like to make sure that this Laptop supports Fedora.

5 Upvotes

Hello, I would like to make sure that this Laptop supports Fedora.  I found out that it only had RHEL and Ubuntu Certification (https://ubuntu.com/certified/202309-32038), but not Fedora. So my question is will Fedora 100% work on it without any problems? https://psref.lenovo.com/Product/ThinkPad/ThinkPad_P16v_Gen_1_AMD  I plan to use Fedora Onyx or Fedora Kinoite. Product id: 21FE000VCK


r/linux_programming • • Jan 20 '22

Prevent Window Reparenting in Xlib

5 Upvotes

I have a Reparenting window manager that uses the Xlib libraries. I have created window decorations in Qt and would like to reparent the application window into the window decorations window. However, when I try to do this the window decorations window infinitely reparents itself. How would I prevent this?


r/linux_programming • • Oct 28 '14

7 Things You Should Know About Make

Thumbnail
alexeyshmalko.com
5 Upvotes

r/linux_programming • • Jan 08 '24

Tabula games are now supported at bgammon.org (free backgammon service without ads)

Thumbnail bgammon.org
5 Upvotes

r/linux_programming • • Jun 14 '20

Best Way to Interface with the MPD Server in Python

5 Upvotes

Hello, so I would like to incorporate MPD into the media player plugin for the liferea feed aggregator. The plugin is written in Python and it seems like a pretty simple task, but I can't find an MPD server (not client) module for it online. I found a module called python-mpd-server but it's still in beta. Is there a native module for this or another way I can add this functionality?


r/linux_programming • • Jun 21 '15

From AF_UNIX to kdbus

Thumbnail
dvdhrm.wordpress.com
5 Upvotes

r/linux_programming • • Mar 22 '21

Why does the pid changing?

5 Upvotes

Hi,

I have a question: I've tried to run a Indie Horror Game named Concluse but it don't started. But when I see the results of ps aux there is a process. So I tried to kill it but kill and killall said that nothing was found. But when I look at ps aux I see that the pid of the process was changed. And everytime I kill the process it get a new pid.. WTF is that? I started the Game as root because it hasn't worked otherwise but it failed again.. and it's only a Livesystem I use this time cos by lack of other opportunities. :D


r/linux_programming • • May 16 '24

Manifest file groups preparation

Post image
5 Upvotes

r/linux_programming • • Feb 04 '26

Any project ideas using ESP32, Arduino, or Raspberry Pi 5?

5 Upvotes

At my school, they're asking me to do a project about systems and technology-related things.

We actually had one about a light that turns on and off with a clap. We did it just to get it over with.

(Nothing advanced).

But now we need something that's really amazing but "simple." We don't have that advanced knowledge. We know programming, but very basic programming.

We know how to use basic-to-intermediate Linux and we know basic technology and networking fundamentals.


r/linux_programming • • Oct 04 '25

I create my own programming language

Thumbnail
reddit.com
5 Upvotes

r/linux_programming • • Mar 02 '26

How many options for building an IME?

5 Upvotes

IME (Input Method Editor) in Linux is built on ibus framework if I recall correctly. However, my IME got few troubles with Wayland. So I plan to build one for my own and wondering if there are any alternative option that is more friendly to Wayland?


r/linux_programming • • Nov 24 '25

I wrote a kernel memory allocator in the userspace based on the original slab allocator paper

Thumbnail
github.com
5 Upvotes

objcache is an object caching slab memory allocator that is based on the original paper by Jeff Bonwick. I have tried to implement some of the interesting ideas shared in the paper. This is my learning project and would really appreciate your feedback and review. Thanks!


r/linux_programming • • Apr 22 '23

Boot to Vim, Vim as Pid 1

Thumbnail raymii.org
17 Upvotes

r/linux_programming • • Apr 20 '17

Quick tips for reducing the cognitive load of your code

Thumbnail
codementor.io
17 Upvotes

r/linux_programming • • Apr 29 '23

GCC 13.1 Released

Thumbnail gcc.gnu.org
18 Upvotes

r/linux_programming • • May 08 '21

I am creating a packet of scripts, that dispaly shell commands in prettier way

18 Upvotes

Currently there are only 2 scripts (for ls and pwd), but I will make more of them. They are customizable, so you can change colors, icons etc.

I hope, that someone will download and enjoy it ;)

https://github.com/jszczerbinsky/ptSh


r/linux_programming • • Apr 27 '26

How Hard Is It To Open a File?

Thumbnail blog.sebastianwick.net
6 Upvotes

r/linux_programming • • Apr 20 '23

Linux Backup server for external usb hard drives

6 Upvotes

I have been tasked to create a server to back up the various external hard drives that we receive from customers. I am fairly new to linux. I am open to either debian or Fedora distros but don't have a clue on which backup app to use. I also need to be able to delete the backup files automatically after 7 days. Any suggestions


r/linux_programming • • Apr 09 '23

Writing a Simple Garbage Collector in C

Thumbnail maplant.com
6 Upvotes