linux

How to simulate memory allocation errors

My C application uses 3rd libraries, which do their own memory management. In order to be robust, my application has code to deal with failures of library functions due to lack of free memory. I would like to test this code, and for this, I need to simulate failures due to lack of memory. What tool/s are recommended for this? My enviro...

How can I programatically manage iptables rules on the fly?

I need to query existing rules, as well as being able to easily add and delete rules. I haven't found any APIs for doing this, is there something that I'm missing? The closest I've come to a solution is using iptables-save | iptables-xml for querying, and manually calling the iptables command itself to add/delete rules. Another solution...

likely/unlikely macros in the Linux kernel

I've been digging through some parts of the Linux kernel, and found calls like this: if (unlikely(fd < 0)) { /* Do something */ } or if (likely(!err)) { /* Do something */ } I've found the definition of them: #define likely(x) __builtin_expect((x),1) #define unlikely(x) __builtin_expect((x),0) I know that they ...

What is the current state of art in Linux virtualization technology?

What VM technologies exist for Linux, their pros and cons, and which is recommended for which application? Since this kind of question can be asked for X other than "VM technologies for Linux", and since the answer changes with progress, I suggest to define a template for this kind of pages. Those pages will have the tag 'stateoftheart...

Programmatically determine video file format?

Ok, I get the basics of video format - there are some container formats and then you have core video/audio formats. I would like to write a web based application that determines what video/audio codec a file is using. How best can I programmatically determine a video codec? Would it be best to use a standard library via system calls and...

Unknown ioctl 2062, 2065, 2066 from vmmon when starting a VM (VMware server 1.0.7 for Linux)

VMware server 1.0.7 installed with vmware-package Debian GNU/Linux testing (lenny) Kernel 2.6.26-1-686 vmware-any-any-update117d had to change VMMON_VERSION from 168 to 138 in vmmon-only/include/iocontrols.h to make vmware-server recognize vmmon When trying to start a VM, vmmon complains in dmesg: Sep 21 03:20:04 pita kernel: [ 2701....

Windows Licensing Question

This is slightly off topic of programming but still has to do with my programming project. I'm writing an app that uses a custom proxy server. I would like to write the server in C# since it would be easier to write and maintain, but I am concerned about the licensing cost of Windows Server + CALS vs a Linux server (obviously, no CALS)...

TCP handshake with SOCK_RAW socket

Ok, I realize this situation is somewhat unusual, but I need to establish a TCP connection (the 3-way handshake) using only raw sockets (in C, in linux) -- i.e. I need to construct the IP headers and TCP headers myself. I'm writing a server (so I have to first respond to the incoming SYN packet), and for whatever reason I can't seem to ...

VMware server 1.0.7 modules incompatible with kernel 2.6.26 -- patched, where to submit?

VMware server 1.0.7 installed with vmware-package Debian GNU/Linux testing (lenny) Kernel 2.6.26-1-686 There were several compile problems when trying to build the binary kernel modules from the vmware-server-kernel-source package made by vmware-package from the VMware server tarball. Recently VMware has updated their kernel module so...

MD5 routines that are GLib friendly?

Does anyone know of an MD5/SHA1/etc routine that is easily used with GLib (i.e. you can give it a GIOChannel, etc)? ...

Graphical DIFF programs for linux

I really like Araxis Merge for a graphical DIFF program for the PC. I have no idea what's available for linux, though. We're running SUSE linix on our z800 mainframe. I'd be most grateful if I could get a few pointers to what programs everyone else likes. Thanks, Scott ...

Create a small 'window-form' application that runs anywhere

I work in the embedded world, using mainly C and no GUI at all (because there is no display screen). Moving over to the non-embedded world, in which I have nearly no experience, what is the best programming environment (langauge/IDE/etc) for me to build a simple window-form application that will run on all the common platforms: windows/...

Maintaining Multiple Databases Across Several Platforms

What's the best way to maintain a multiple databases across several platforms (Windows, Linux, Mac OS X and Solaris) and keep them in sync with one another? I've tried several different programs and nothing seems to work! ...

How to clear the scrollback in the screen command?

Hi, I use the screen command for command-line multitasking in Linux and I set my scrollback buffer length to a very large value. Is there a key combination to clear the buffer for a certain tab when I don't want it sitting there anymore? Thanks. ...

Windows Performance Counter Port to Linux, HP-UX and AIX

We implemented a server application available on Windows only. Now we like to port it to Linux, HP-UX and AIX, too. This application provides internal statistics through performance counters into the Windows Performance Monitor. To be more precise: The application is a data base, and we like to provide information like number of connect...

What is the best Linux distribution for Vmware server?

In terms of Webserver and low package size installation. ...

How do I run a script when ip-address changes (most likely using a dhclient hook) on a (Ubuntu) Linux machine?

Hi, I have a script which contacts a few sources and tell them "the IP-address XXX.XXX.XXX.XXX is my current one". My test web server has a dynamic IP-address through DHCP and amongst other things it needs to update a DDNS entry when its IP-address changes. However it's not the only thing it does, so I will need to run my own custom scr...

How do you recursively ftp a folder in linux

I'm trying to ftp a folder using the command line ftp client, but so far I've only been able to use 'get' to get individual files. ...

Common Causes of Operating System Crashes

I am interested to learn: what are the most common technical causes (from the perspective of operating system programming) of an operating system crash (not limited to Windows crashes)? I'm looking for an answer not like "too many apps open", but what specifically happens when too many apps are open that causes the crash. ...

reinitialize system wide environment variable in linux

I just want my apache to register some of my predefined environment so that i can retrieve it using getenv function in php. How can i do this? I tried adding /etc/profile.d/foo.sh with export FOO=/bar/baz using root and restarted apache. ...