linux

jffs2_gcd_mtd1 CPU load

On debian/ubuntu9 What is jffs2_gcd_mtd1 and why is it using CPU so extensively? Is it related to apache or mysql continuous usage? ...

Downloading files with Makefile rules

I was planning something like: URLS=www.host.com/file1.tar.gz www.host2.com/file2.tar.gz $(somefunc $URLS): #somefunc produces downloads/file1.tar.gz downloads/file2.tar.gz mkdir -P downloads wget whatever # I can't get the real url here because the targets don't contain the full url anymore myproject: $(somefunc URLS) #File...

Do other tasks while a system() command is being executed

I have this c++ program that is doing a simple ping on a specified ip address. I am not into networking so i'm just using the system() command in c++ to execute the ping from a shell and store the results in a file, that's easy. The problem is that i want some dots to be printed on the screen while the system() command is being execute...

Linux, Rails, Mono C#, No-SQL setup

Hi I am keen on setting up a Linux box to play around with Rails, No-Sql, Mono C#... and opensource projects! I am keen on learning Ruby on Rails and don't have a Mac so I think for now the cheapest option is to install a Linux distro on my computer. I am also keen on trying out MongoDB I am a complete nube to Linux and am wondering if...

how can I redirect output from javac back into the calling program

// this works if ("Show".equals (obj)) { try { String command= "/usr/bin/xterm -e javac panel_1.java"; Runtime rt = Runtime.getRuntime(); Process pr = rt.exec(command); BufferedReader in = new BufferedReader(new InputStreamReader(pr.getInputStream())); String line = null; while ((line = in.re...

Django management command not found by cron

I made a management app imaginitively called update. The following work fine from the command line: ./manage.py update /full/path/manage.py update But when I have the following cron command: 00 */3 * * * /websites/bnc/manage.py update >/dev/null It emails me this error: Unknown command: 'update' Type 'manage.py help' for u...

concatenate files without copying their contents

Hi, (In C/C++/Linux) Is there a way to concatenate file A and file B (or actually append one A's content to that of B) only by altering the file system without the overhead of data copying? File A then can be discarded. Thanks ...

Multithreaded Server Issue

I am writing a server in linux that is supposed to serve an API. Initially, I wanted to make it Multi-threaded on a single port, meaning that I'd have multiple threads working on various request received on a single port. One of my friends told me that it not the way it is supposed to work. He told me that when a request is received,...

Changing existing shared memory segment size

Hi. I have some legacy code that uses shmget/shmat/shmdt to create, attach and manage shared memory segments. The app with the code sometimes crashes, leaving the segments in memory. The code re-uses same segment key to reconnect to them, but the problem it uses different shared memory sizes every time, and unable to connect because of...

Get notified about network interface change on Linux

I need a way to notify my user space app when a network interface is enabled or disabled. I'm hoping to do this without resorting to polling. Does the kernel offer some sort of hook for triggering callback functions when network-related events occur? ...

Using directory traversal attack to execute commands

Is there a way to execute commands using directory traversal attacks? For instance, I access a server's etc/passwd file like this http://server.com/..%01/..%01/..%01//etc/passwd Is there a way to run a command instead? Like... http://server.com/..%01/..%01/..%01//ls ..... and get an output? EDIT: To be clear here, I've found the ...

Find and replace a particular term in multiple files

How can I replace a particular term in multiple files in Linux? For instance, I have a number of files in my directory: file1.txt file2.txt file3.txt And I need to find a word "searchword" and replace it with "replaceword". ...

How do I use ioctl() to manipulate my kernel module?

So I'm trying to write a kernel module that uses the linux/timer.h file. I got it to work inside just the module, and now I am trying to get it to work from a user program. Here is my kernel module: //Necessary Includes For Device Drivers. #include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/fs.h>...

Debugging in Linux using core dumps

What are the 'best practices' when it comes to debugging core dumps using GDB? Currently, I am facing a problem: The release version of my application is compiled without the '-g' compiler flag. The debug version of my application (compiled with '-g') is archived (along with the source code, and a copy of the release binary). Recent...

System call return value in C

Hi,  I am using system function in C code to invoke cp command. I want to know whether it got executed successfully or not? ...

Using Intel Threading Building Blocks (TBB) in Linux

Hi, I want to use Intel Threading Building Blocks (TBB) in Linux. Can anyone suggest a good IDE for that and possibly any steps to integrate TBB with that IDE? Thanks, Rakesh. ...

Android Plugin in Eclipse 3.5 on Ubuntu 64bit got problems with properties

Hi there! I got a huge problem with the Android Development Tools ADT running in Eclipse Galileo (3.5.1) on Ubuntu 9.10, 64bit. On this platform, I do not manage to see any property edit dialogs for layout properties. E.g. the one where you can select a string resource ID for text fields, or a drawable ID for image fields or backgrounds...

How to write a userspace linux block device driver?

Hello, I would like to write a linux block device driver. The driver would not need to access the hardware so it can be in userspace. To start, I have tried to build an example block device driver with this Makefile: obj-m = sbd.o KVERSION = $(shell pwd) PWD = $(shell pwd) all: make -C /lib/modules/$(KVERSION)/build M=$(PWD) modu...

How to count how many time a word occurs in an xml file.

I was given the task of doing quality check on a machine translation xml file. The translations are from English to a foreign language. I have about 2000 translation blocks in the file and I have to check 200 of them by adding my remarks in the block enclosed in a < comment > tag with a quality attribute. Is there a linux command or some...

Linux kernel: the cost of immediate descheduling.

Hello From the http://lkml.indiana.edu/hypermail/linux/kernel/0103.1/0030.html I learn about a new type of mutexes in linux, an adaptive_np one: The PTHRED_MUTEX_ADAPTIVE_NP is a new mutex that is intended for high throughput at the sacrifice of fairness and even CPU cycles. This mutex does not transfer ownership to a wa...