Skip to main content

Questions tagged [c]

C is a general-purpose computer programming language used for operating systems, games and other high performance work and is clearly distinct from C++. It was developed in 1972 by Dennis Ritchie for use with the Unix operating system.

0votes
0answers
47views

Why does there appear to be a discrepancy when trying to programmatically access files associated with different tasks in Linux from kernel space?

As a way to better understand Linux kernel structures, interacting with and pulling information from these (and also getting more experience coding in C), I've been building simple kernel modules to ...
genericuser99's user avatar
0votes
0answers
39views

How many environments are stored in the stack? [duplicate]

When I used the getenv() function to get the address of USER, I got 0x7ffceae5e923 but when randomly checking the address using gdb, the $USER variable was stored at 0x7ffffffffe90e [ I started a ...
KeShAw's user avatar
2votes
1answer
16views

Why PAM modules are restricted from accessing keys on root keyring?

I'm writing a special PAM module that is supposed to authenticate user with a password stored in kernel keyring. The key is added by running the following command as root: keyctl add user some-key 123 ...
Subtle Development Space's user avatar
0votes
0answers
29views

How does printf() actually work? [duplicate]

When I execute the c file #include <stdio.h> #include <stdlib.h> int main(){ printf("before the system call. I am too excited!\n"); system("ps"); ...
KeShAw's user avatar
0votes
1answer
36views

how does Visual Studio Code resolve includes & macros for autocomplete & build?

If using only the C/++ Extension from Microsoft in Visual Studio Code, then how does preprocessing of includes & macros for autocomplete work? Many include headers (such as sys/statvfs.h), depend ...
mo FEAR's user avatar
2votes
0answers
31views

Wrong attributes bitmask in READDIR requests on NFSv4.1

I'm struggling the following problem. I have an NFS v4.1 mount, where I have a directory with a couple of thousands files. I'm trying to list their names and types. Even with a minimal example program ...
dmk's user avatar
  • 21
6votes
1answer
1kviews

Changing all strcpy to strscpy

I am learning about Linux kernel development. I have cloned into the stable branch of Linux. I watched a tutorial from Greg KH on youtube that explains you can use the checkpatch.pl script to find ...
Jeremy's user avatar
0votes
0answers
42views

Does a systemd service send org.freedesktop.DBus.Properties.PropertiesChanged signal at boot-up?

I have 2 systemd services. a.service b.service b depends on a but I don't want to explicitly mention the dependency in b.service file. Instead I am waiting on the org.freedesktop.DBus.Properties....
nishad kamdar's user avatar
0votes
1answer
59views

Use libnm or popen(nmcli) to configure network programmatically?

We have a system where we need the user to be able to permanently change the network settings from the interface (via our C code), that used to be achieved by generating a new dhcpcd.conf file and ...
John U's user avatar
0votes
0answers
23views

Hit noise when playing part of wave file with ALSA PCM interface

I am working a WAVE file playing with ALSA PCM interface in Linux, and I heard noise when I played the file quickly and partially. Here is my playing function. static int playback_function(uint8_t *...
wangt13's user avatar
0votes
1answer
9views

Cannot see "file,line,func" fields in the journal

I am trying to use sd_journal_print_with_location() function. #include <systemd/sd-journal.h> int main() { sd_journal_print_with_location(LOG_INFO, "CODE_FILE=tst_file.c", "...
White Owl's user avatar
2votes
1answer
191views

Automatic flush of stream when reading input

I read in Advanced Programming in Unix Environment this: Line buffering comes with two caveats. First, the size of the buffer that the standard I/O library uses to collect each line is fixed, so I/O ...
SekstusEmpiryk's user avatar
0votes
0answers
76views

Send UDP data from one NIC and receive on another NIC on same machine

I have multiple NIC's on my Ubuntu machine. $ ifconfig docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255 inet6 ...
rosewater's user avatar
0votes
1answer
318views

Get output into journal in a C written service

I have a small service written in C on Debian. This service automatically starts with Linux and does some file operations and other things as expected. The service prints some informational messages ...
puck's user avatar
  • 125
0votes
0answers
950views

There is no file linux/init.h

I'm trying to write my own pci-device driver on an Ubuntu system. The example I found says that I need: #include <linux/init.h> #include <linux/module.h> #include <linux/pci.h> I'm ...
DrageFabeldyr's user avatar

153050per page
close