linux

Can't redirect output to /var/lib/varlibfile, but I can copy a varlibfile to /var/lib

Hi, I have a script which is running as root, it's supposed to store it's cache file (only modified by the script) at /var/lib/varlibfile. However the script does not seem to create the file, and my investigation led me to this: $ sudo echo "something" >/var/lib/varlibfile bash: /var/lib/varlibfile: Permission denied $ sudo echo "somet...

How to capture raw HID input on linux?

Short version of what I want to accomplish: I have a foot pedal (INFINITY-IN-USB-1, if that's of any interest) that is implemented as a generic HID device, and I would like it to be behave as control and alt keys on linux. I'm looking for something on the level on X, i.e. not just individual programs. Longer version: I have this setup ...

Estimation or measurement of amount of iops to create a file

I'd like to know how many I/O operations (iops) does it take to create an empty file. I am interested in linux and GFS file system, however other file systems information is also very welcome. Suggestions how to accurately measure this would be also very welcome. Real scenario (requested by answers): Linux GFS file system (if you can...

Supporting byte ordering in Linux user space

I'm writing a program on Linux in C to analyze core files produced from an embedded system. The core files might be little endian (ARM) or big endian (MIPS), and the program to analyze them might be running on a little endian host (x86) or big endian (PowerPC). By looking at the headers I know whether the core is LE or BE. I'd rather my...

gcc: Do I need -D_REENTRANT with pthreads?

On Linux (kernel 2.6.5) our build system calls gcc with -D_REENTRANT. Is this still required when using pthreads? How is it related to gcc -pthread option? I understand that I should use -pthread with pthreads, do I still need -D_REENTRANT? On a side note, is there any difference that you know off between the usage of REENTRANT betwee...

bash: redirect and append both stdout and stderr

To redirect stdout in bash, overwriting file cmd > file.txt To redirect stdout in bash, appending to file cmd >> file.txt To redirect both stdout and stderr, overwriting cmd &> file.txt How do I redirect both stdout and stderr appending to file? cmd &>> file.txt does not work for me ...

Linux iNotify one shot and event mask problem

I'm trying to use iNotify in linux rhel5, kernel 2.6.18, glibc 2.5-18. I did not define the event as one shot but for some some reason it behaves as if I did. The impact is that I have to re-add a watch after each event. Any one ever used iNotify? Another problem is that the mask returned in the event object contains only one flag: IN_ON...

When I run a raw socket program it generates an invalid arguments error.

please help me. i don't find answers for it, after long serch for 2 days iam posting. please help me i very new to socket programing and i written a small code to divert packets at tcp layer for that i used ip_queue's and netlinks with NETLINK_FIREWALL protocol. What i have done is iptables -I OUTPUT -j QUEUE -p udp --destination-port...

Need text to speech and speech recognition tools for Linux

I'm planning on writing a program for Linux that uses text to speech and speech recognition. What are the best tools/libraries for this? Should I use Windows instead to be able to use better tools? The tools need to be easily callable from a console or C program. ...

Normal disk read/write value for a ubuntu server.

How would your determine a max value to set an alarm on the I/O activity of a ubuntu/linux server hosting upto 4 sites running apache, mysql and upto 4 tomcats? Or in general (if there is one such) what is a suitable operational range for I/O read/write per second in a production server with a 7.2K SATA HDD? What I'm trying to understan...

Workaround for no default browser on Linux?

I am trying to use Desktop.browse() to invoke a URL, this works fine on Windows machines or on Linux machines with a default browser configured. However, it throws an IOException exception when no default browser is found on Linux. What are some of the ways to work around this? I suppose I can attempt to launch Firefox and assume its ...

How can I detect file accesses in Linux?

I have a bunch of flows and data processing applications that I occasionally need to spy on, meaning I need to know what files they read. This is mostly to aid in packaging testcases, but can also be useful when debugging. Is there a way to run the executables in such a way that produces such a list? I have two thoughts on this: Ther...

Renaming a set of files to 001, 002, ... on Linux

I originally had a set of images of the form image_001.jpg, image_002.jpg, ... I went through them and removed several. Now I'd like to rename the leftover files back to image_001.jpg, image_002.jpg, ... Is there a Linux command that will do this neatly? I'm familiar with rename but can't see anything to order file names like this. I'm...

Howto disable password request on file creation on newly formatted hard disk

I have just formatted an external hard disk using this command: $ sudo mkfs -t ext3 /dev/sdc1 However, once this is done, whenever I want to create a directory or file in this hard disk, it always ask for password (i.e. permission requirement). Is there a way I can disable that? Note that I can't format the partition with mkfs unles...

What is the most violent way that an application can terminate itself (linux)

I'd like to emulate violent system shutdown, i.e. to get as close as possible to power outage on an application level. We are talking about c/c++ application on Linux. I need the application to terminate itself. Currently i see several options: call exit() call _exit() call abort() do division by zero or dereference NULL. other option...

How to use sprof ?

please explain with example? ...

Developing Kernels to support Multiple CPUs

I am looking to get into operating system kernel development and figured my contribution would be to extend the SANOS operating system in order to support multiple core machines. I have been reading books on operating systems (Tannenbaum) as well as studying how BSD and Linux have tackled this challenge but still am stuck on several conc...

Adding Blue Screen of Death to Non-Windows OS

I am looking to get into operating system kernel development and figured and have been reading books on operating systems (Tannenbaum) as well as studying how BSD and Linux have tackled this challenge but still am stuck on several concepts. If I wanted to mimic the Windows Blue Screen of Death on an operating system, would I simply put...

Gurus say that LD_LIBRARY_PATH is bad - what's the alternative?

Hi. I read some articles about problems in using the LD_LIBRARY_PATH, even as a part of a wrapper script: http://linuxmafia.com/faq/Admin/ld-lib-path.html http://blogs.sun.com/ali/entry/avoiding_ld_library_path_the In this case - what are the recommended alternatives? Thanks. ...

Any downsides to using statically linked applications on Linux?

Hi. I seen several discussions here on the subject, but wanted to ask about my particular situation: If I have some 3rd part libraries which my application is using, and I'd like to link them together in order to save myself the hassle in LD_LIBRARY, etc., is there any downside to it on Linux, other then larger file size? Also, is it ...