linux

Reading from a promiscuous network device

Does anyone know how to read from a promiscuous (or sniffing) device in C? I know that you need to have root access to do it, but I was wondering if anyone knew what functions were necessary to do this (normal sockets wouldn't seem to make sense here)? I want to write a real-time analysis tool for wireless traffic. ...

How to add /usr/share/java libs to webapp's classpath?

Summary Is that possible for webapps deployed on linux + tomcat5.5 to use/see all /usr/share/java/ jars automatically? Details I'm packaging my java webapp for Ubuntu (yet the question is related to any linux-based distro) and going to make it depend on tomcat. I'm going to put context descriptor (an xml file) to /usr/share/tomcat5.5...

What is the difference between vmalloc and kmalloc?

I've googled around and found most people advocating the use of kmalloc, as you're guaranteed to get contiguous physical blocks of memory. However, it also seems as though kmalloc can fail if a contiguous physical block that you want can't be found. What are the advantages of having a contiguous block of memory? Specifically, why would I...

Low Java single process thread limit in Red Hat Linux

I'm experiencing an issue on a test machine running Red Hat Linux (kernel version is 2.4.21-37.ELsmp) using Java 1.6 (1.6.0_02 or 1.6.0_04). The problem is, once a certain number of threads are created in a single thread group, the operating system is unwilling or unable to create any more. This seems to be specific to Java creating thr...

How can a C/C++ program put itself into background?

What's the best way for a running C or C++ program that's been launched from the command line to put itself into the background, equivalent to if the user had launched from the unix shell with '&' at the end of the command? (But the user didn't.) It's a GUI app and doesn't need any shell I/O, so there's no reason to tie up the shell af...

Licensing and using the Linux kernel

I would like to write my own OS, and would like to temporarily jump over the complicated task of writing the kernel and come back to it later by using the Linux kernel in the mean time. However, I would like to provide the OS as closed source for now. What license is the Linux kernel under and is it possible to use it for release with ...

Best practices for withstanding launch day traffic burst

We are working on a website for a client that (for once) is expected to get a fair amount of traffic on day one. There are press releases, people are blogging about it, etc. I am a little concerned that we're going to fall flat on our face on day one. What are the main things you would look at to ensure (in advance without real traffic d...

Best text search engine for integrating with custom web app?

We have a web app that allows users to upload documents, create their own documents, and so on. Uploaded files are stored on Amazon S3, created information is stored in a MySQL database. What I'm looking for is some sort of search engine, where I feed it all of our text documents, each with a unique ID, and it builds an index or whatever...

A way to determine a process's "real" memory usage, i.e. private dirty RSS?

Tools like 'ps' and 'top' report various kinds of memory usages, such as the VM size and the Resident Set Size. However, none of those are the "real" memory usage: Program code is shared between multiple instances of the same program. Shared library program code is shared between all processes that use that library. Some apps fork off ...

Best LaTeX viewer for Linux

Just want to be able to read LaTeX source when necessary. No desire to manipulate or convert. Edit: So, if only the source is provided -- it must be "rendered" in order to view it formatted? ...

Best PHP IDE for Linux / Gnome ?

Hey, I'm on a continuous mission to find the ultimate PHP IDE that will work with Gnome on Linux. Let me know what you think. Thanks a million! ...

Know of an OCAML IDE?

Know of an OCAML/CAML IDE? Especially one that runs on Linux? ...

How to set my application's desktop icon for Linux: KDE, Gnome etc?

I have a cross platform program that runs on Windows, Linux and Macintosh. My windows version has an Icon but I don't know how to make have one for my Linux build. Is there a standard format for KDE, Gnome etc. or will I have to do something special for each one? My app is in c++ and distributed as source so the end user will compile it...

Specify the from user when sending email using the mail command

Does anyone know how to change the from user when sending email using the mail command? I have looked through the man page and can not see how to do this. We are running Redhat Linux 5. ...

How to route in linux

Hi, I have 20 ips from my isp. I have them bound to a router box running centos. What commands, and in what order, do I set up so that the other boxes on my lan, based either on their mac addresses or 192 ips can I have them route out my box on specific ips. For example I want mac addy xxx:xxx:xxx0400 to go out 72.049.12.157 and xxx:xxx...

Manualy choose an interface on TCP to send data

Hi I have a TCP server that is listening on a particular interface only. I want that after the accept() call if the incoming connection was from xxx.xxx.xxx.0 subnet then the data should go through intf1 otherwise the data should be sent through intf2 which is where my server is listening. Both the interfaces have the same route setti...

How can you get more information about processes when Linux runs out of memory?

I had recently a problem with oom-killer starting to kill processes after some time. I could see that the memory was consumed, but by the time I got to the server it wasn't clear anymore what consumed it. Is there a good non-obvious place to get more info about oom-killer? E.g. detailed info about processes at the time of activation, det...

What is the best replacement for Windows' rand_s in Linux/POSIX?

The problem is not about randomness itself (we have rand), but in cryptographically secure PRNG. What can be used on Linux, or ideally POSIX? Does NSS have something useful? Clarification: I know about /dev/random, but it may run out of entropy pool. And I'm not sure whether /dev/urandom is guaranteed to by cryptographically secure. ...

Used Ctrl-Alt-F6 in Linux, and can't get my screen back.

This is obviously a stupid question. I am coding in Eclipse both on Mac and Linux, but I mixed up and used the Mac shortcut to window tabbing (Ctrl-Cmd-F6), but I was using the Linux on uni and screen went black. I've done this before, but this time I can't get back to my desktop. Ctrl-Alt F1-F6 gives me different terminals, F7 gives me ...

Why do my keystrokes turn into crazy characters after I dump a bunch of binary data into my terminal?

If I do something like: $ cat /bin/ls into my terminal, I understand why I see a bunch of binary data, representing the ls executable. But afterwards, when I get my prompt back, my own keystrokes look crazy. I type "a" and I get a weird diagonal line. I type "b" and I get a degree symbol. Why does this happen? ...