linux

How do I know I reached a file's maximum size when using ofstream?

While writing a file using ofstream, how do I know when the file's size has reached the OS' maximum file size - more specifically linux's maximum file size - ?? ...

What are some interesting, small Linux kernel projects to help learn the source?

What small projects would you suggest to a novice with the kernel, but someone who has plenty of systems and C experience? The aim is to develop a familiarity with the kernel source code, and a facility for experimentation with crazy ideas. I'm trying to think of some manageable small tasks (for example, add a syscall), but what would y...

Put a process in a sandbox where it can do least harm

I'm looking for the concept to spawn a process such that: it has only access to certain libraries/APIs it cannot acess the file system or only specific parts it can do least harm should malicious code run in it This concept is known as sandbox or jail. It is required to do this for each major Operating system (Windows, MacOSX and Li...

Can you (and should you) straddle both worlds (Linux and Windows)

I am programmer from a Linux/Unix background with experience in Perl, Java, Sybase, Oracle. I recently switched jobs and now I am working on C#, ASP.NET, Classic ASP and SQL Server. Do you think you have to pick your camp and stick to it, or can you effectively live\work in both worlds? Comments from people with experience would be he...

Which distro of Linux is best suited for Java web apps?

There are so many Linux distributions to choose from! What is the "best" linux flavor for a web hosting environment running primarily: Apache HTTP, Tomcat or JBoss, MySQL and Alfresco (not necessarily all in the same instance). Are there any significant differences in terms of ease of administration and configuration, performance and s...

What does the "no version information available" error from linux dynamic linker mean?

In our product we ship some linux binaries that dynamically link to system libraries like "libpam". On some customer systems we get the following error on stderr when the program runs: ./authpam: /lib/libpam.so.0: no version information available (required by authpam) The application runs fine and executes code from the dynamic libra...

How do I find my PID in Java or JRuby on Linux?

I need to find the PID of the current running process on a Linux platform (it can be a system dependent solution). Java does not support getting the process ID, and JRuby currently has a bug with the Ruby method, Process.pid. Is there another way to obtain the PID? ...

linux to compile multiple java file

here is my directory structure. /user/a /user/b /user/b inside folder a,b,c there is a file person.java (it is the Same file, just a one line modification. now, on my shell, im on my /user/ directory and i try to do javac */person.java the shell returns the following error, person.java:14: duplicate class: person Is there any...

How to create a file with a given size in Linux?

For testing purposes I have to generate a file of a certain size (to test an upload limit). What is a command to create a file of a certain size on Linux? ...

#defines in linker scripts

For an embedded system I need to place a few data structures at fixed addresses, so that a separate control CPU can access them at a known location. I'm using linker scripts for the embedded target to accomplish this, plus #defines of those same addresses for the control CPU. It bothers me that these address constants are therefore defi...

Where to find packages names and versions for RedHat?

How can I find out whether a specific RedHat release (RHEL4, RHEL5...) contains a certain package (or a certain version of a package)? For Debian and Ubuntu, there's packages.debian.org and packages.ubuntu.com; is there a similar web site for RedHat? Note: I don't want to have to install all the releases just to check some package versi...

Setting the thread /proc/PID/cmdline ?

On Linux/NPTL, threads are created as some kind of process. I can see some of my process have a weird cmdline: cat /proc/5590/cmdline hald-addon-storage: polling /dev/scd0 (every 2 sec) Do you have an idea how I could do that for each thread of my process? That would be very helpful for debugging. /me now investigating in HAL sourc...

How can I simulate ext3 filesystem corruption?

I would like to simulate filesystem corruption for the purpose of testing how our embedded systems react to it and ultimately have them fail as gracefully as possible. We use different kinds of block device emulated flash storage for data which is modified often and unsuitable for storage in NAND/NOR. Since I have a pretty good idea of ...

Is it possible to simulate installation of Debian packages, still marking them installed?

Here's what I would like. Start with a virtual sytem with no installed packages. Then I invoke a tool similar to apt-get to ask it to compute the dependencies and mark all the packages that would be installed as installed. Let this be clear: it says the packages are installed, but they are no files actually installed. Then if I ask for ...

How can I determine if a different process id is running using Java or JRuby on Linux?

I need to see if a given process id is running, and it must work in either Java or JRuby (preferably a Ruby solution). It can be system dependent for Linux (specifically Debian and/or Ubuntu). I already have the PID I am looking for, just need to see if it is currently running. UPDATE: Thanks for all the responses everyone! I appr...

How do I use a shell command to tar a list of files and folders with exclusions

Hi, How do I tar a list of files and folders (all in the same directory) with the exclusion of a single directory (which contains a huge amount of data) ...

How to set CPU load on a Red Hat Linux box?

I have a RHEL box that I need to put under a moderate and variable amount of CPU load (50%-75%). What is the best way to go about this? Is there a program that can do this that I am not aware of? I am happy to write some C code to make this happen, I just don't know what system calls will help. ...

Tomcat deployment

Is there a way, given a war file, to deploy on a tomcat server. I want to do this without having to use the web interface. ...

How to most efficently handle large numbers of file descriptors?

There appear to be several options available to programs that handle large numbers of socket connections (such as web services, p2p systems, etc). Spawn a separate thread to handle I/O for each socket. Use the select system call to multiplex the I/O into a single thread. Use the poll system call to multiplex the I/O (replacing the sele...

How do I upgrade python 2.5.2 to python 2.6rc2 on ubuntu linux 8.04?

Hi, I'd like to how to upgrade the default python installation(2.5.2) supplied with ubuntu 8.04 to python 2.6rc2. I'd like to make 2.6 the default python version on the system and migrate all the other useful installed python libraries installed on 2.5.2 to python 2.6rc2. Please let me know how I can achieve this. Thanks Dirk ...