2022 Developer Survey is open! Take survey.

Questions tagged [system-programming]

All questions regarding programming, tweaking and configuring of Unix & Linux core system as a whole or a sub-set of it.

Filter by
Sorted by
Tagged with
1 vote
2 answers
47 views

How to pass a parameter in a command without run the parameter content?

Good days. I have a little problem. I have this function in bash script function denyCheck(){ file=$(readlink -f $(which $(printf "%s\n" "$1"))) if [[ -x $file ]];then ...
user avatar
  • 13
0 votes
1 answer
45 views

A simple global keyboard shortcut handler

Yeah, I know there's actkbd which allows to assign global keyboard shortcuts which will work everywhere including the text console and a graphical session but I don't want to run an extra daemon (long ...
user avatar
0 votes
0 answers
17 views

Does setting TCP_NODELAY disable auto-corking?

Does setting TCP_NODELAY turn off the auto corking behavior? Is there a way to disable it on a per connection basis?
user avatar
  • 101
0 votes
0 answers
28 views

How can I detect if the GPU is a dedicated card or integrated with the cpu package, on linux?

I was planning on writing a cpu governor module for the freedesktop power profile daemon, which has three states: low power, balanced and performance. According both to the tests made by phoronix and ...
user avatar
  • 43
0 votes
1 answer
212 views

Is it possible to dynamically update systemd-timer's onCalendar?

sytemd-timer has a feature "onCalendar" using which we can execute a script on points of time (on calendar). Is it possible to dynamically (programmatically) update or mutate that field? For ...
user avatar
0 votes
0 answers
84 views

Kernel Module Removal Crash

I have a custom kernel module that inserts fine with either insmod or modprobe xyz. When modprobe -r is run with xyz kernel module as in modprobe -r xyz, the machine segfaults or otherwise crashes. ...
user avatar
0 votes
1 answer
104 views

blkid: blkid_probe_lookup_value() - strange partition types

I need to check filesystem type on a thumb drive in my C++ application. It must be done before mounting a new partition. I also prefer not to call system() function. I tried to use the following test ...
user avatar
0 votes
1 answer
36 views

using greeter as base for locking app [closed]

I am a hobbyist (not IT specialist) and just had idea to write some lockscreen app/script to learn and repeat regex. I could use bash or Python, but don't know where to start. Could you point me ...
user avatar
0 votes
0 answers
689 views

My thinkpad is being throttled to 400mhz per core. Is there any way I can force it to clock to normal speeds with the kernel?

there seems to be a common issue with Lenovo ThinkPad and the Intel CPUs being throttled to 400mhz per core: https://forums.lenovo.com/t5/ThinkPad-L-R-and-SL-series/L380-stuck-on-0-4-GHz-when-loading/...
user avatar
1 vote
1 answer
488 views

How pass the file's content through Named Pipe and then copy it into another one?

I wrote 2 programs that normally 1.create the named pipe(server) and 2. pass the string from the shell to the server part. I understand how to hand over a string from the terminal to the server part ...
user avatar
1 vote
1 answer
549 views

Why below code is not able to unblock SIGINT signal

I am trying my hand on Linux Signals. Where I have created a scenario mentioned below: Initially block all SIGINT signals using sigprocmask(). If sender send SIGUSR1 signal then unblock SIGINT for ...
user avatar
  • 67
1 vote
0 answers
125 views

How do you determine the minimum timer resolution for a timerfd+EPOLL timer solution?

I am using timerfd_create/timerfd_settime/EPOLL to create timers in my application. According to the EPOLL documentation if a timer is set fire at a point lower than the minimum resolution, it will ...
user avatar
  • 163
1 vote
1 answer
130 views

CPU statistics calculation algorithm

I too many search on internet to found algorithm calculated %Us , %Sy , %Id , ... on result of top command . but can not found any documentation . some documents like this or this calculate cpu ...
user avatar
  • 247
3 votes
3 answers
5k views

How can I make my Linux server sleep and wake on LAN when not in use?

I have recently purchased myself an HP rack server for use as a personal fileserver. This server currently lives under my bed as I have nowhere else to put it. For those not aware (as I was not ...
user avatar
5 votes
3 answers
1k views

Process creation time, shell script and system call overhead

I have a machine dual booted with Arch Linux and Ubuntu (16.04). I have recently started using the Kakoune text editor, and noticed that its startup time is drastically different depending on which OS ...
user avatar
  • 63
1 vote
1 answer
74 views

What does the STICKY_TIMEOUTS flag for personality(2) do?

Is there a good description of exactly what each of the flags you can pass to personality(2) does? I'm particularly interested in STICKY_TIMEOUTS, but a general detailed description of all of them ...
user avatar
  • 1,250
2 votes
0 answers
129 views

How does vlan driver pass vlan info to the h/w ethernet driver

I'm trying to implement vlans on a target programmatically. But first I wanted to set up vlans manually to help get a better understanding of vlan setup. So I setup a vlan manually on my development ...
user avatar
  • 21
-2 votes
1 answer
624 views

Use supercomputer to run a program [closed]

I wrote a c++ program using some libraries called linbox, givaro, gmp. Now because my computer is to slow I want to run my program on a supercomputer. I am not very familiar with networks and my ...
user avatar
0 votes
1 answer
50 views

Move files shell program

Hello i have got problem, on shell program(.sh), with this code I should copy the file JPG from the directory sorgente to destinazione but the code does not work, can you help me!! #!/bin/bash ...
user avatar
  • 23
1 vote
1 answer
128 views

How to programmatically query the Freedesktop application database?

I know about xdg-mime which can query the mapping from MIME filetype to associated desktop application. But this can return mappings to non-existent applications, e.g. $ xdg-mime default non-...
user avatar
1 vote
0 answers
48 views

USB devices not showing

I'm trying to write a C program that goes through all USB devices and extracts some information from them. When I run ls /sys/bus/usb/devices from the terminal, I get this output: 1-0:1.0 1-1.1 ...
user avatar
  • 61
1 vote
1 answer
2k views

How to specify a namespace when creating a tun/tap device?

On linux I can create a new tun/tap device in C using something like: int fd = open("/dev/net/tun", O_RDWR); ioctl(fd, TUNSETIFF, (void *)&ifr); This will create a new network interface in the ...
user avatar
  • 20k
8 votes
1 answer
776 views

Is there filesystem that allows me to insert some block in the middle of file in O(1)?

Assuming we have huge file F. we like to put "around" seek s a new empty (filled with zeros) block in O(1) time (i.e. without rewriting all remining part) "around" means we can round s to nearest ...
user avatar
-1 votes
2 answers
64 views

How can I save output of my script to different directory in txt or pdf format [duplicate]

`clear echo "testing calc" date echo -e "======================================" yc1=0 yc2=0 yc3=0 lol=0 tnd=0 lno=0 c1=0 c1b=0 c2=0 c2b=0 c3=0 c3b=0 bb=12 wt=100 con=768 rip=0 sw=0 echo "" echo "" ...
user avatar
2 votes
3 answers
5k views

Trouble with creating an empty file using C programming language in UNIX environment

I have recently started programming in UNIX environment. I need to write a program which creates an empty file with name and size given in the terminal using this commands gcc foo.c -o foo.o ./foo.o ...
user avatar
0 votes
1 answer
394 views

Permission check on profile file in home directory: should it be done?

Say I'm implementing a programming language which has an interactive mode, and that interactive mode reads some ~/.foo_rc file in the user's home directory. The file contains code in that language ...
user avatar
  • 6,656
2 votes
0 answers
1k views

How to get minor and major page fault for individual or group of processes?

I am trying to write a program in C to run under Linux. Basically I am trying to draw a statistic that should show like: pid, number of process, page fault(major/minor) and total number of page ...
user avatar
  • 21
1 vote
0 answers
266 views

How to catch my bluetooth service events

I have usb bluetooth device which is using btusb 0.6 module (driver). The thing is I am interested to know is: how is the systemctl start bluetooth.service event invoked? I was looking info about ...
user avatar
-1 votes
2 answers
177 views

How to find documentation about macros in the manpages?

I've been working on a Routing Protocol and looking at legacy code for different routing protocols. I constantly find different macros where I it is very hard to find it in the header files because ...
user avatar
0 votes
2 answers
7k views

Loading and execution of programs in memory [closed]

While comparing between linking loader and linkage editor I came across a point that in case of linking loader linking and relocation takes place for each execution of the program( and happens at time ...
user avatar
  • 1
2 votes
0 answers
64 views

calling library functions from different language

As we know libraries are precompiled codes, so we do not need to compile them. Can we call library functions of one language from a different language?
user avatar
2 votes
2 answers
2k views

Low level system call [closed]

C provides library functions such as write(),read().. for system calls.How to make a system call without using any library in linux in C ?
user avatar
3 votes
4 answers
12k views

System calls source code

C library provides functions such as write(),read(),open()...that we can use in our C program to make system calls. where can I find source code for these functions?
user avatar
2 votes
1 answer
201 views

System calls in linux

Generally, systems provide a library or API that sits between normal programs and the operating system. On Unix-like systems, that API is usually part of an implementation of the C library (libc), ...
user avatar
4 votes
1 answer
448 views

FILE size limitation according to Robert Love's textbook

From Robert Love's Linux System Programming (2007, O'Reilly), this is what is given in the first paragraph (Chapter 1, Page 10): The file position’s maximum value is bounded only by the size of the ...
user avatar
  • 1,031
3 votes
5 answers
3k views

How to set proper monitoring of my services in a automated way? So that if one crash it auto on the fly restarts?

How can i setup monitoring to my system services? Either using automated script which scan every moment, if httpd, mysqld, and my custom daemon is running or not, if not running it will automatically ...
user avatar
7 votes
2 answers
29k views

Online course that covers Unix/Linux Systems programming [closed]

I am looking for an online course, something similar to the Berkely and Stanford Courses that covers Linux systems programming. A course which could use Stevens ( with some supplemental material ...
user avatar
-1 votes
3 answers
4k views

telnet implementation using C [closed]

The program in general is I want to implement telnet program. On the client side user send its logging name and password, and if it is correct he starts to send commands to the server On the Server ...
user avatar
  • 197
6 votes
1 answer
4k views

Concept of memory mapping in Unix like systems

Can some one explain in an easy to understand way the concept of memory mappings (achieved by mmap() system call) in Unix like systems ? When do we require this functionality ?
user avatar
  • 6,058
0 votes
2 answers
658 views

Can linux be configured as a server or workstation in DCS and how? [closed]

I am a student of Instrumentation and Control. Considering the versatility and stability of Linux, I was wondering if Linux can be configured to act as a Distributed Control System? Also if yes, ...
user avatar
  • 115
3 votes
0 answers
2k views

modetest.c from libdrm tests lists no framebuffers

I wanted to play with KMS since it seems to be the preferred low-level graphics library on Linux. However, after compiling the appropriate modetest.c version (2.4.32, since that's the version of ...
user avatar
2 votes
1 answer
828 views

Preventing ChromeOS from blanking the screen when working on a different tty

I am running Archlinux in a chroot alongside Chrome OS on a chromebook. The original project is there, my fork of it is here (mostly similar). The issue is that the display power management of Chrome ...
user avatar
  • 121
0 votes
2 answers
2k views

Automated SSH Login [duplicate]

Possible Duplicate: Shell Script for logging into a ssh server Autentification on SSH connection in OneLine How could I make a SSH Login programmatically on a unix server, I don't have rights ...
user avatar
  • 59
6 votes
2 answers
14k views

How to find the header file where a c function is defined?

Is there an easy way to find out which header file a C function declaration is in? cding into /usr/include and running (grep -E 'system.*\(' *.h -R) works with some trial and error, but isn't there an ...
user avatar
12 votes
2 answers
19k views

Difference between slow system calls and fast system calls

What's the difference between slow system calls and fast system calls? I have learned that slow system call can block if the process catches some signals, because the caught signals may wake up the ...
user avatar
  • 223
5 votes
3 answers
3k views

Cursor movement in terminals

I'm trying to wrap my head how shells move the screen cursor around (Moving around input the arrow keys and such). I've been doing a lot of testing, and I haven't found any system call that allows ...
user avatar
  • 153
2 votes
3 answers
1k views

Are all system call error numbers unique?

I'm writing a program for Systems Programming in Unix, and one of the requirements is to process all possible error returns from system calls. So, rather than having a function tailored to each ...
user avatar
  • 161
7 votes
2 answers
7k views

Learn Linux System Programming by doing projects [closed]

I have only a very basic idea about linux system programming. I have not done any real projects using linux system programming. In my current company I do system admin type work, but I am more ...
user avatar
5 votes
2 answers
3k views

Implementing a Unix shell in C: Logging [closed]

I am currently working on implementing my own UNIX shell in C. The basis of the shell is working, you could find the source code here. Right now my next task is to implement a logging feature for the ...
user avatar
  • 18.3k
3 votes
4 answers
168 views

SDK for Developer

Is there any SDK for developers under Linux? I mean more than man pages, it would be more like MSDN Library or Windows SDK under windows, where all documentation about programming and developer guide ...
user avatar
  • 3,660