linux

How can I tarball the proc file system?

I would like to take a snapshot of my entire proc file system, and save it in a tarball (or in the worst case concatenate all of the text files together into a single text file). But when I run: tar -c /proc I get a segfault. What's the best way to do this? Should I set up some kind of recursive walk through each file? I only have...

RS-232 for Linux and WIN32 cannot receive data on Linux

I am trying to receive characters from an Arduino board on linux, but this library returns no characters. The code: #include "rs232.h" #include <time.h> #include <stdio.h> void main() { int res = OpenComport(16, 9600); printf("Open port result: %d\n\n\n", res); unsigned char *buf; while(1) { int n = PollCompor...

How to do this on the tcsh shell in linux

I want to efficiently do the following on the tcsh in Linux. somecommand a; somecommand b; somecommand c; If I do somecommand {a,b,c}, this does somecommand a b c, which is not what I want. Is there a way to do what I want? ...

pthread sleep linux

I am creating multiple threads programme using pthread. Is sleep() cause the process ( all the threads) to stop executing or just the thread where I am calling sleep? Thanks ...

Back to older version of glibc

Hi all Currently, I use the 2.10.1 version glibc in my project, but I found this version cause some problem in my project. I want to back to version 2.5, what should I do? I use two different distribution, one is Ubuntu, another one is CentOs. Best Regards, ...

Understanding the counters in /proc/[pid]/io

I'm creating a plugin for Munin to monitor stats of named processes. One of the sources of information would be /proc/[pid]/io. But I have a hard time finding out what the difference is between rchar/wchar and read_bytes/written_bytes. They are not the same, as they provide different values. What do they represent? ...

installing Eclipse on ubuntu

hey everyone i am trying to install Eclipse helios for C/C++ developers on a ubntu OS i am new with all this ubntu stuff - even though i downloaded a version of helios from the Eclipse site i have no idea how to install the program i can't find the eclipse.exe file that it has when is installed it in windows! thanks allot. Brad ...

Question on signal handling, interrupt handling

Hi, While the process is executing a blocking system call, say read or write, signal has arrived. Does the system call is terminated with the error EINTR? Does the system call is restarted after handling the system call? Suppose, system call is terminated with the error EINTR, Kernel handles the signal before returing to user space. ...

what possible reasons could block a virtual terminal on Linux?

Or is it possible at all that some process or something else could block a virtual terminal? Or what could be a reason that an application hangs when trying to access the VT1? It seems, while that is happening, it is hanging in the function ioctl. Esp., this is the code which fails: int vtno = 1; const char* vtname = "/dev/tty1"; int ...

Read-only, rather small database - ways to optimise?

Hi all, I have a following design. There's a pool of identical worker processes (max 64 of them, on average 15) that uses a shared database for reading only. The database is about 25 MB. Currently, it's implemented as a MySQL database, and all the workers connect to it. This works for now, but I'd like to: eliminate cross-process data ...

Trouble cross compiling OpenCV for ARM9 Montavista Linux

I'm trying to cross-compile the OpenCV library for using it on an embedded system running Montavista Linux(the system has an ARM926 processor). I've managed to configure and generate the makefiles; the sources are built OK, including the 3rd party libraries. The trouble comes at link time. For some reason libtool picks some libraries fro...

Deleting a broken link Unix

I want to delete a broken link, but before that I want to confirm if the link file is present in directory. Let's call the link A: if [ -a A ] then print 'ya A is ther' fi But if A is a broken link then how can I check? ...

Waiting for execvp in main

int main() { ... if(!fork()) { execvp(cmdName,cmdParam); } printf("In main()..."); return(0); } Assuming I have correctly passed the cmdName & cmdParam arguments, how do I wait for the process created by execvp to finish, before resuming the execution of main()? Does the execvp() create a proces...

How can we use the output of a program to make further calculations? C (Linux)

When I write code in C, I often get confused when the questions/problems demand the usage of the output for further calculations. For example, if we have to print an array and then add only the prime numbers from it? or something which is similar. I get stuck and I don't know how to tackle such questions. As in when we take input from...

Shell script to find and replace a string

Hello I have a colleague of mine who is a procedural code developer and has same smtp server name sitting in 120 different files, now I have to change them to something else. But doing that one by one would be impossible. I am using "grep" to recursively search for a string in all the files sitting in that directory. But I am not sure if...

Which file systems support splicing via Linux's splice(2)?

The man page for the splice system call says that splice may fail and set errno to EINVAL if: Target file system doesn't support splicing; neither of the descriptors refers to a pipe; or offset given for non-seekable device Which file systems support splicing? ...

Determining whether a readable file descriptor is the read end of a pipe

I would like to use splice to zero-copy data from STDIN_FILENO to a file descriptor (which could be to a regular file, char or block device, FIFO, or anything that can be opened with open). In order to use splice, either the from file descriptor or to file descriptor must be the appropriate end of a pipe, so generally a pipe is created t...

Environment variable CLASSPATH <> Clojure's CLASSPATH. Why?

Here I check the environment variable CLASSPATH daniel@daniel-laptop:~/ps/clojure/projects/ring-tutorial$ echo $CLASSPATH /home/daniel/ps/clojure/projects/ring-tutorial/src Here I check what java thinks it is. daniel@daniel-laptop:~/ps/clojure/projects/ring-tutorial$ lein repl Clojure 1.1.0 user=> (System/getProperty "java.class.path") ...

Why does this loopback device creation malfunction?

At the bottom of the code you can see it failing. In fact, I'll put it here at the start too because it is the problem I need to solve: [350591.924819] EXT4-fs (loop0): bad geometry: block count 9750806 exceeds size of device (9750168 blocks) I don't understand why the device is supposedly too small. I made this partition two days ago...

Is there any possibilty of Linux to become Paid OS, when it became the most popular?

Is there any possibility of Linux to turn into Paid OS, after it reaches most of the people in the world. How much of the probability are there. Experts, please lightup my mind. ...