fork

fork() and pipe()

I need help with this sample application. When I run it, it gets stuck after the child process prints "Child sending!". #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <stdlib.h> #include <string.h> #define INPUT 0 #define OUTPUT 1 int main() { int fd1[2]; int fd2[2]; int pid; if (pipe(fd1) < 0) ...

Problem forking fork() multiple processes Unix

So I have this function that forks N number of child processes. However it seems to be forking more than specified. Can you tell me what I'm doing wrong? Thanks void forkChildren(int nChildren){ int i; for(i = 1; i <= nChildren; i++){ pid = fork(); if(pid == 0) printf("I'm a child: %d PID: %d\...

How do I get the child process id in Parallel::ForkManager?

use LWP::Simple; use Parallel::ForkManager; @links=( ["http://prdownloads.sourceforge.net/sweethome3d/SweetHome3D-2.1-windows.exe","SweetHome3D-2.1-windows.exe"], ["http://prdownloads.sourceforge.net/sweethome3d/SweetHome3D-2.1-macosx.dmg","SweetHome3D-2.1-macosx.dmg"], ["http://prdownloads.sourceforge.net/sweethome...

Threads not copied while forking?

I have one application which has several different threads. Then I forked with fork() but found the child process has to recreate those threads. Is that possible to copy the threads during the clone? Thanks! ...

fork/chroot equivalent for Windows server application

I have written a small custom web server application in C running on Linux. When the application receives a request it calls fork() and handles the request in a separate process, which is chrooted into a specific directory containing the files I want to make available. I want to port the application to Windows, but neither fork() nor ch...

Help with C program(gcc) in Linux

Hi... I have a project for my college but unfortunately, I struggle in programming, apart from simple C programs. Anyway, the way I see it, I think the code I need should be around 20-30 lines, so if somebody can provide me some help I'll be really grateful. Here is the project: A parent process will produce 10 random integer numbers (...

Difference between "system" and "exec" in Linux?

What is the difference between system and exec family commands? Especially i want to know which one of them creates child process to work? ...

Forks and Pipes in C UNIX

I'm not sure if I am even barking up the right tree here... but here goes. I'm trying to pass data from my parent process to all children. It's a simple server program that basically will keep a list of connected clients and then send the routing table of connected clients to every client. This is eventually going to include a struct of...

How do I fork multiple projects into one repository with git?

I have a 3 projects I'd like to fork. They're all related to each other - changing one will likely require a change to another. Because they're all related, I'd like to create 1 repository for the forks, while maintaining the ability to pull down updates from each original. How would I setup my git repository? These are preliminary th...

Create a daemon with double-fork in Ruby

What is the proper way to create a well-behaved Unix or Linux daemon in Ruby? What is the definition of a well-behaved daemon anyway, and how would one write such a program in Ruby? ...

Perl Script, Fork/Exec, System claims my process has died when in fact only my child process has died

I have a Perl script that does a fork/exec to start another tool in the background and monitor some file system changes while this other tool is running. This seems to work like expected. When I start this Perl script from a shell (e.g. Bash), of course the shell prompt should be gone for as long as my Perl script is running. And it wil...

Ruby/RoR and many subprocesses

I am trying to build a free web application using ruby/rails It should be able to send sms through online forms of various mobile operators. (like this one (in russian)). So, I need to wait for the user, who wants to send an sms through my website. establish connection to operator website. Probably, using Mechanize. retrieve captcha s...

Run child processes as different user from a long running process

I've got a long running, daemonized Python process that uses subprocess to spawn new child processes when certain events occur. The long running process is started by a user with super user privileges. I need the child processes it spawns to run as a different user (e.g., "nobody") while retaining the super user privileges for the parent...

forking a process seems to eat up certain lines of code - Objective-C

Here's a simplified version of my code: - (IBAction)convert:(id)sender { /* these two lines are ignored */ [textbox setStringValue:@"converting"]; [convertButton setEnabled:NO]; pid_t pid; if((pid=fork())==-1) { [log setStringValue:@"couldn't fork a new process."]; converting = 0; [convertBut...

Controlling wget with PHP

Hi there, I’m writing a command line PHP console script to watch for new URLs and launch (large) downloads for a client’s project I am working on. The client is currently manually downloading them with a slightly specific wget command and ideally would like to stay with that. I was wondering what the best way to call wget from PHP woul...

Lost in Multiple Fork(), Pipe() and Select()

Hello, Hope I can find some help here cause I'm starting to give up. Heads up as this is an homework assignment, hence why it might be stupid. Context: Have to program something which will be shell executed as such: logn [--tick n] cmd [args] [, cmd [args]]... Basically, it's a program that multiple programs simultanously. Constraint...

Having trouble with pipes and select()

Hello, I seem to be having trouble with pipe and select. Context: Have to program something which will be shell executed as such: logn [--tick n] cmd [args] [, cmd [args]]... Basically, it's a program that multiple programs simultanously. Constraints: Each output line has to start with it's command number in front in format printf ...

Signal 11 segfault on wait() system call?

I'm new to processes in *nix, and am working on a basic shell in C... in implementing pipes, I count the commands on the line and iteratively fork() a new process. At the end of each iteration I wait() on the child before proceeding to the next command. This was working fine, but I've apparently changed something to break it: Program ...

Is there a Qt Jambi fork?

In March or April 2009 Qt Jambi was made open source and then the commercial project was kicked. I'd really like to use Qt Jambi but can't do that if the code isn't maintained any longer. Is there a fork of Qt Jambi, either commercial or open source? ...

forking multiple processes and making the parent wait for all of them (in C)

I'm creating various processes (3 to be precise) and making them do different things. So far so good. I'm trying to wait in the parent until all children are completed. I've played around with many options (such as the one listed below) but either the parent waits but I have to press enter to return to the shell (meaning that some child...