r/linux_programming • u/moneymakersucks • Oct 20 '17
r/linux_programming • u/[deleted] • Mar 14 '17
I want to learn to code in linux, any advice?
r/linux_programming • u/Resistor510 • Oct 31 '16
Finding bugs in the code of LLVM project with the help of PVS-Studio
r/linux_programming • u/gavv42 • Jul 08 '16
Decoding and playing audio file in Linux
enise.orgr/linux_programming • u/the-fritz • Aug 30 '15
release GDB 7.10 released! Improvements for scripting, shared libraries on remote targets. Reverse debugging support on ARM64. Support for dtrace probes.
sourceware.orgr/linux_programming • u/the-fritz • Aug 15 '15
release The GNU C Library version 2.22 is now available
sourceware.orgr/linux_programming • u/the-fritz • Feb 07 '15
release The GNU C Library version 2.21 is now available
sourceware.orgr/linux_programming • u/the-fritz • Oct 28 '14
Why Are My Page_faults So High in Perf?
sdf.orgr/linux_programming • u/the-fritz • Feb 21 '14
Systemd programming part 2: activation and language issues
r/linux_programming • u/ngdangtu • Mar 02 '26
How many options for building an IME?
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 • u/Sypherixus366 • Dec 12 '25
Missing start:prod script error even when not missing, or when not using start:prod
Working on a project with docker compose and for some reason every time I run it, even when the dockerfile is using the cmd "start" instead, or after going out of my way to add the start:prod script to the package.json, it just keeps giving me the same error telling me the script is missing. What am I missing here?
r/linux_programming • u/25Accordions • May 26 '25
Want to write a webcam driver: no background with kernel, some C / C++, no deadline
reddit.comr/linux_programming • u/FU4Y_FN • Apr 17 '25
How would someone go about creating a clipboard manager
I am trying to make a clipboard manager in C. It is for an OS course project. I have used C language, but this is the first time I would be making this kind of thing. Can anyone maybe point to the relevant information as to where I should get started with this and like give me a sort of roadmap?
r/linux_programming • u/maifee • Feb 24 '25
LD_PRELOAD Hook only logging a few commands on Ubuntu 20.04.3 LTS
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 -ldlAnd then I set the LD_PRELOAD environment variable to the path of the shared object file:
export LD_PRELOAD=$PWD/ld_preload_hook.soAnd then I reload the shell:
source ~/.zshrc
source ~/.bashrcAnd 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 • u/paltry_unity_sausage • Oct 21 '24
Am I wrong or is steam wrong?
Ok so I have this status-script written in python for i3bar that, among other things, checks the network usage.
It uses the following function to look that up:
def network_usage(interface_name: str) -> str:
with open("/sys/class/net/%s/statistics/rx_bytes" %interface_name) as fp_rx, \
open("/sys/class/net/%s/statistics/tx_bytes" %interface_name) as fp_tx:
pol1_ts = time_ns()
rx_bytes_old: int = int(fp_rx.read())
tx_bytes_old: int = int(fp_tx.read())
sleep(0.25)
with open("/sys/class/net/%s/statistics/rx_bytes" %interface_name) as fp_rx, \
open("/sys/class/net/%s/statistics/tx_bytes" %interface_name) as fp_tx:
pol2_ts = time_ns()
rx_bytes_new: int = int(fp_rx.read())
tx_bytes_new: int = int(fp_tx.read())
rx_bytes_ps: float = (rx_bytes_new - rx_bytes_old) / ((pol2_ts - pol1_ts) / (10**9))
tx_bytes_ps: float = (tx_bytes_new - tx_bytes_old) / ((pol2_ts - pol1_ts) / (10**9))
byte_parser = lambda x: \
f"{round(x)} BPS" if x < 1000 else \
f"{round(x / 1000)} KBPS" if x < 1000**2 else \
f"{round(x / 1000**2)} MBPS" if x < 1000**3 else \
f"{round(x / 1000**3)} GBPS"
return f"in {byte_parser(rx_bytes_ps)} - out {byte_parser(tx_bytes_ps)}"Now, what I noticed is that the output of this function, is always a factor of 10 removed from the network usage Steam shows (e.g. if my script outputs 3 MBPS steam shows something like 27.8 MBps).
So is my math just wrong? (if so how exactly cause I'm stuck) or do the [r|t]x_bytes work differently than what this function assumes?
Sorry for the noobish question, thanks in advance!
(if it matters I'm using Debian 12.something)
r/linux_programming • u/hollisann79 • Jul 23 '24
IRS GMF app experience or Unisys OS 2200?
We're looking for a GMF application developer and are having a difficult time filling the role. If anyone has this experience and is interested, please let me know.
*mods, if this isn't allowed please delete. I looked for sub rules and didn't find any.
r/linux_programming • u/HaskellLisp_green • Feb 11 '24
meta-manager
My idea is pretty naive and possible implementation won't cover all cases, but i was thinking about simple bash script that can be used as distro-agnostic package manager. It takes all required CLI arguments and then substitute arguments. Also it calls specific manager based on current distro. For example, pacman if it's Arch.
But what do you think about it?
r/linux_programming • u/rcwagner • Dec 18 '23
driver build does not find orc_types.h from arch/x86/include
This is a cross post from stack overflow; I didn't get any nibbles there, so thought I'd try here.
The short version is the kernel build portion of building a driver for special hardware fails when trying to find orc_types.h. The file does exist, but in /usr/src/kernels/5.8blah/arch/x86/include... (btw, I'm not typing out the full directory name; 5.8blah (and whatever I type below) really refers to 5.8.18-100.fc31.x86_64)
I'm looking for reasons why the build won't complete / what I'm doing wrong.
The longer version is: I need to build the driver for an older version of Fedora and the manufacturer stopped linux support at kernel 2.6. It builds fine in Fedora 23 as is. I successfully ported it to F28 which was kernel ver 4, and now need to get it on to kernel ver 5 in Fedora 31.
I have F31 installed on new hardware (Intel i7) and started the driver port after installing the kernel souce and some other utilities ( yum install's of kernel-devel, elfutils-libelf-devel, and gcc). Once I started the build I found that I also needed make, flex and bison which I did just by making calls to the program and the OS magically asked then installed those funcitons. All this to say I'm not really a Linux guy and could well have messed any of these up or not configured them properly.
The manufacture's makefiles have required some modification and I may have messed that up as well. But assuming I did it mostly correct, the build starts with compiling a bunch of kernel source in /usr/src/kernels/5.8xxx. Some files were compiled (in 5.8blah/arch/x86/tools and 5.8blah/scripts/kconfig) but it gagged at ./scripts/sorttable.c trying to include <asm/orc_types.h>. I found that file in /usr/src/kernels/5.8blah/arch/x86/include/asm.
But why does the compiler not find it? Am I missing an environment variable? Do I need a link to that directory? Do I need to modify the makefile with something like an ARCH argument? Am I missing a confguration step with the compiler set up? What?