Help me settle a score. I have a piece of software written in C++ that’s meant to run on as many linux distributions as possible and I need to figure out a strategy that’s effective. I’m trying to ship binaries in this case not source code (might be good to know). It’s already a commer…
Tag: linux
How to create a simple sysfs class attribute in Linux kernel v3.2
I’m learning how to use sysfs in my Linux modules, but I’m having the hardest time finding current documentation on these topics. The Linux Device Drivers 3rd Edition book I’ve been using seems to be rather dated in this area unfortunately (e.g. the class_device structure appears to be compl…
How to add .so file to the java.library.path in Linux
I am working with a java application which needs a .dll file in java.library.path in windows. To run same application in Linux I have the respective .so file which should be added to java.library.path in linux machine, I didnt find any easy solution for this so far I did put the .so in a folder which is alrea…
Calling assembly routines from C source code
I have this simple C source code : and i have this s.asm which defines the function _Sum : now , i compiled the .asm using : and compiled and linked the .c file using : this is the outcome : So what is the problem ? I’m using Ubuntu-Linux Any help would be greatly appreciated , Thanks [SOLVED] :
Unable to run compiled files – bash: ./a.out: Permission denied. (I’ve tried chmod)
I’ve compiled my C source using cc test.c, and it did generate a.out file. However when I run it I get this error – My source is not in the home directory, it is on different FAT-32 partition, so I’ve mounted the drive in which the code is using the following command – Then I compile m…
Checkpoint/restart using Core Dump in Linux
Can Checkpoint/restart be implemented using the core dump of a process? The core file contains a complete memory dump of the process, thus in theory it should be possible to restore the process to the same state it was in when the core was dumped. Answer No, this is not possible in general without special sup…
Pass parameter to an awk script file
If I want to pass a parameter to an awk script file, how can I do that ? Here I want to print the first argument passed to the script from the shell, like: Answer your hash bang defines the script is not shell script, it is an awk script. you cannot do it in bash way within your script.
Physical disk block size on POSIX using C/C++
I’m working on a high performance I/O program and I’m trying to find the best way to determine the _physical_ (and not the _logical_) byte size of a device’s disk blocks with C++. My research so far has led me to the following code snippet: The man pages says the following about st_blksize: …
Linux driver for embedded Linux
I’m looking to attach some USB devices to my embedded Linux board. It is an TI-ARM processor running embedded Linux, but I guess it could be any embedded Linux board. If I purchase an USB device which has Linux support/driver, can this driver (generally) be re-compiled to work with the ARM architecture?…
File size in human readable format
Given the size of a file in bytes, I want to format it with IEC (binary) prefixes to 3 significant figures with trailing zeros, e.g. 1883954 becomes 1.80M. Floating-point arithmetic isn’t supported in bash, so I used awk instead. The problem is I don’t how to keep the trailing zeros. Current solut…