It might be a weird question as I searched and found many people asking about how to find the PPID given a PID. However, I’m interested in finding out all the PID of a given PPID. The incentive was to run a process check using pidstat and from my test with pidstat, it seems to be that pidstat only repor…
Tag: linux
SIGALRM, interval timers and problems with sleep()
I am working with porting one of our embedded microcontroller libraries to linux and writing a python wrapper around it. One of my low level modules depends on a callback that gets called every 10ms. This callback counts up software timers that each have callbacks of their own. These timers are used all over …
Making an RPM which sets POSIX files capabilities
How does one make an RPM which sets the POSIX capabilities of a file? If I try doing rpmbuild as a non-root user then I get an error when my makefile’s install hooks try to run setcap, but if I don’t run setcap how will rpmbuild copy the capabilities? There doesn’t seem to be any way to set …
__builtin_return_address returns null for index >0?
I want to get the return address of the caller function. I’m using __builtin_return_address() funtion, but if I give index value greater than 0 it is returning NULL. Please help me with this or tell me any other function to get the same. Answer See this answer to a related question. __builtin_return_add…
How to check a disk for partitions for use in a script in Linux?
I’m scripting something in Bash for Linux systems. How would I check a disk for partitions in a robust manner? I could use grep, awk, or sed to parse the output from fdisk, sfdisk, etc., but this doesn’t seem to be an exact science. I could also check if there are partitions in /dev, but it is als…
Communicating with CashCode bill acceptor in linux
I’ve implemented CCNET protocol to communicate with CashCode bill acceptor from my software on Linux. Initially I spent lots of time trying to figure out why the device does not respond to the commands I’m sending. Using trial-and-error method I found the solution to set the following options for …
cmake linking shared libraries on ubuntu
Hi I am having problems with linking two libraries on ubuntu using cmake 2.8.12 Directory structure CMakeLists.txt for lib1 This builds fine. Then for lib2 I have the following CMakeLists.txt Here I get Linking CXX shared library ../build/liblib2.so /usr/bin/ld: cannot find -llib1 I am not clear how to correc…
why file with hole has smaller disk block than file without hole?
I’m newbie in unix system programming There is code making file with hole. Output result is: Why file with hole has fewer disk block than file without hole? In my thinking, file without hole takes smaller disk blocks Because file with hole is more spreaded than without hole.. From “Advanced Progra…
Grey blank screen with various vnc services from Windows 7 to Ubuntu 14.04
So, I have been attempting to access my work computer (Ubuntu 14.04) from home (windows 7). I am using vnc and I have tried both tightvnc, xrdp, and default vino services on work computer. Here is what I found not working and working. Tightvnc server/xrdp server (linux) + tightvnc viewer (windows): NOT WORKIN…
Linux Bash XMLLINT with XPATH
Today I get to learn how to use xmllint properly. It does not seem to be well covered or explained. I plan to use a single language resource file to run my entire system. I have a mixture of bash scripts and php pages that must read from this language file. Currently I am using the following format in my