linux

Is this a safe way to share read-only memory with child processes?

I want to allocate and initialise a fairly large chunk of contiguous memory (~1GB), then mark it as read-only and fork multiple (say several dozen) child processes which will use it, without making their own copies of the memory (the machine won't have enough memory for this). Am I right in thinking that if I malloc the memory as usual,...

How to mount a network directory using python?

I need to mount a directory "dir" on a network machine "data" using python on a linux machine I know that I can send the command via command line: mkdir ~/mnt/data_dir mount -t data:/dir/ /mnt/data_dir but how would I send that command from a python script? ...

I currently use SVN with Linux. How do I add files from my Windows Desktop?

You know, the regular "svn commit". "svn up." When I did svn co, it was linked with SSH. svn co +ssh or something. How would I link this with Windows? I'm using Windows and I'd like to put some code i this SVN. What tools do I use to get started? Can I checkout normally, with the Linux syntax? ...

Read GOT entry in Elf Binary

Hi, I want to write a little function's tracer. I use ptrace. I'm on ubuntu x86_64. I want to found the address of the shared library function (like printf). But i have some problem and some question about the Global Offset Table. I have the following code: size_t baseAddress = this->getBaseAddress(); Elf_Ehdr const * headerElf = sta...

learning Windows Development from a Linux background

No I didn't reverse my operating systems in that question! My background has been exclusively Linux/OSX to date, and I honestly don't know a thing about Windows development. Visusal *, *.NET, Powershell, WinForms, Win32, not a clue. They're just words to me. This is starting to be a problem because I've been tasked to port Linux/OSX soft...

Which is the best linux program for a C++ programmer?

I have always wanted to step away from windows and go completely linux, but the only thing that prevents me are the programs. The problem is that I am use to the intellisense in Visual Studio 2008. I have looked for many alternatives to a program which displays the functions as visual studio does, but none seem to have what I am looking ...

fptd 0.17 and directory access

I'm working on FTP demon 1.7 I have following questions. How can I restrict a user to one particular directory? Lets say a user logs in as "admin", he should be having access to only "/tmp" directory, nothing else. I'm going through ftpd's code and trying to modify as per my needs. Any good reference/documents to get hang of current co...

Easiest way to display a pdf, ps or dvi file from python in linux.

I have created an application with python and wxpython. I would like to display a help file in pdf, ps or dvi format in GNU/Linux. Could use the distribution pdf viewer, but not so easy when you don't know which they have. Any ideas on how to solve this? ...

Ruby/Glibc coredump (double free or corruption)

I am using a distributed continuous integration tool which I have written by myself in Ruby. It uses a fork of Mike Perham's "politics" for distribution of the tasks. The "politics" module is using threads for the mDNS part. Every now and then I encounter a core dump which I don't understand: *** glibc detected *** ruby: double free or...

What might make "Xclients" be executed twice when boot system?

For some special purpose, I modified /etc/X11/xinit/Xclients to start firefox instead of start Desktop Environment. # Argh! Nothing good is installed. Fall back to twm { # gosh, neither fvwm95 nor fvwm2 is available; # fall back to failsafe settings [ -x /usr/bin/xsetroot ] && /usr/bin/xsetroot -solid '#222E45' # if [ -x...

linux shell file size

I want to get size of file into variable ? How to do that? ls -l | grep testing.txt | cut -f6 -d' ' gave the size but how to store it in shell variable? ...

how can i compare strings in bash script?

I need to compare a variable to some string (and do something if they match). How can i do the comparison? ...

SSL_CTX_use_PrivateKey_file fail on Linux (part 2)

For some reason, my calls to OpenSSL's SSL_CTX_use_PrivateKey_file have started to fail (again) on Ubuntu. My previous post concerning this function; http://stackoverflow.com/questions/2028862/ssl-ctx-use-privatekey-file-fail-under-linux With the above fix, I have been able to use things fine until a couple of days ago. I have no idea w...

Reusing socket descriptor on connection failure

In my client code (Linux), I am following these steps to connect to a socket: Creating a socket sockDesc = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) Connecting it (retry for 'x' time in case of failure) connect(sockDesc, (sockaddr *) &destAddr, sizeof(destAddr)) (After filling the destAddr fields) Using the socket for se...

deploying intrusion prevention system with custom plugins (snort inline)

Hello, I have to deploy a Snort based intrusion prevention system. I am total newbie in this, so any kind of help , references for starters would be highly appreciated. Also snort documentation talks about Honeynet Snort Inline Toolkit, but the available link to it is returning 404. I checked it on Honey net but couldn't find it. Als...

How can I get and format yesterday's date on the command line?

I have a Perl script which will run in a cron job on linux suse. It will take as input a log file that was generated yesterday. The filename of the log contains the date (i.e. log.20100209) Can I send yesterday's date with the format in the prompt? Should I create an additional script to get the date and execute? If so, how can I do tha...

linux language to use to mirror iphone development

I want to create a gui program in linux which I eventually might move to the iphone. What programming language and GUI framework should I use to make this easiest? I'd assume using Objective-C would be best, since gcc will compile that, but are there GUI frameworks that work with Objective-C that are similar to Cocoa and won't require ...

Java keyPress/keyRelease issue under Linux/X11

I'm developing a small 2D game engine in Java, after playing around with my demo game in a VirtualBox VM hosting Ubuntu, I found a strange bug that would sometimes cause the game to ignore the fact that a key is pressed. So you're running to the left until you suddenly stop moving. Now under a real Ubuntu I found the cause of the proble...

File descriptor leak in nftw(FTW_CHDIR) ?

I am using the POSIX call nftw() for traversing a directory structure. The directory structure is flat - only 4 files and no subdirectories. However when I call nftw() a lot of times on this flat directory then I get an error message after a while: "too many open file handles". It turned out that this happens when the flag FTW_CHDIR ...

Technique to compute next day's date from a date supplied via an arg?

Hi All, I'm having some trouble figuring this out. I have a script that checks a log file that is generated the day after the date specified by the script call. This is because the files fetched for the specified day's data won't be fetched until the day after. And when that cron runs in the morning, the log file will have a timestamp...