General :: Using Fork() To Create A Binary Tree?

Sep 26, 2010

I am working on a project where I need to use the C language to generate a tree of processes. I understand how fork() works but I cant seem to get fork() to create two children from one parent and then have the two children create two more children.

Right now what i am seeing is a chain...where the parent creates one child...and that child creates another ONE child..etc.

Here is what I have so far:

for (i=0; i<n;i++){
if (childpid = fork()) break;
}
if (childpid == -1){
perror ("

[Code]....

View 3 Replies


ADVERTISEMENT

Programming :: Sort A Binary Min-heap Tree

Mar 23, 2011

I'm searching for an algorithm to sort a binary min heap tree. That's when in root i have the smallest value in the tree. The only restriction it has, is that the parent must be smaller the its two children. i think something like quick-sort, but i don't know how to implement it.

View 8 Replies View Related

Programming :: Make A Binary Tree From An External File?

Dec 7, 2010

My assessment is making a tree from a text file as follows: -reading a file line by line

-making a binary tree from it
- traverse by level the binary tree
- posting the traversal result to the same file without overwriting the text file- it is required to be append to the bottom of the text file (i have to do this in 4 languages: c#,PHP from Xampp,java, python)

i read the file with this script in java:
public class FileToStringArray {
privateString strLine;
privateString[] stringArray;
privateFileInputStream in;

[Code]...

View 9 Replies View Related

General :: Create Archives Of A Directory Tree On Ubuntu Box?

Oct 29, 2010

Are there any other archiving tools than tar that preserve Linux file permissions and user/group flags? I want to create archives of a directory tree on my ubuntu box. The directory trees are large, a first run with tar cvpzf archive.tgz /home/foo/bar yielded a 5GB archive. I also want to keep all permissions and other flags and special files.I'm fine with a 5GB archive, however to look inside that archive -- since it is a compressed tar archive -- the whole 5GB have to be decompressed first! (Or so it appears when opening it with the archive viewer -- I'm happy to be corrected.)So I need a way to "backup" a directory (tree) while preserving full filesystem attributes and right and creating an archive with an "index" that hasn't to be decompressed for browsing its contents. An archive is either a single file, or a (small) set of files that carries full and complete information within this file/s. That is, it can live on any filesystem (size permitting), it can be burnt onto a DVD, you can split it (after which the point of this question is really lost - but still), ...

View 3 Replies View Related

General :: How To Create Binary RPM From Source Tar

Jun 7, 2011

Right now to install software from source I do a ./configure && make && make install which doesn't allow for easy uninstallation (some don't come with an 'uninstall' goal, and if they do you have to keep the source around). I'd like to learn how to create binary RPMs from source tar.gz files (one reason being that it makes for easier uninstallation). I tried the following but it complains with the following errors:

Code:
$ rpmbuild -ta mysource.tar.gz
error: Name field must be present in package: (main package)
error: Version field must be present in package: (main package)
error: Release field must be present in package: (main package)
error: Summary field must be present in package: (main package)
error: Group field must be present in package: (main package)
error: License field must be present in package: (main package)

Apparently that's what happens when there is no SPEC file in the tarball. But all the tars I've tried give this same error. Is there a simple way to create binary RPMs from source files - as an example, this source tar [URL].

View 4 Replies View Related

Red Hat / Fedora :: Makfile Which Can Compile A Tree For Source File And Create Output In Separate Directory

Jul 29, 2010

I am new to linux platform and my requirment is to write a makfile which can compile a tree for source file and create the output in separate directory .

View 1 Replies View Related

Software :: Create Binary File With Text In It?

Nov 17, 2010

How to create binary file with text in it, something like

Quote:

Hola Mundo!

I want it binary, because I want to execute it directly from Bios before Windows.

View 7 Replies View Related

Software :: Create Iptables Binary To Use It In An Android Application?

Jan 9, 2011

how to create iptables binary, that i can use in my android application for performing some firewall related functionality like restricting some websites/packet filtering. and will it be possible to alter the rules later?iptables binary will contain the rulesets stored and which can be modified. how this can be achieved.?

View 2 Replies View Related

General :: How To Use Fork In My Programme

Aug 31, 2009

1) Write a C program using the fork() system call that that generates the Fibonacci sequence in the child process. The number of the sequence will be provided in the command line. For example, if 5 is provided, the first five numbers in the Fibonacci sequence will be output by the child process. Because the parent and child processes have their own copies of the data, it will be necessary for the child to output the sequence. Have the parent invoke the wait() call to wait for the child process to complete before exiting the program. Perform necessary error checking to ensure that a non-negative number is passed on the command line.

2) Repeat the preceding exercise, this time using the CreateProcess () in the Win32 API. In this instance, you will need to specify a separate program to be invoked from CreateProcess(). It is this separate program that will run as a child process outputting the Fibonacci sequence. Perform necessary error checking to ensure that a non-negative number is passed on the command line.i have done with Fibonacci sequence .but i dont know how to include tht fork() function and win32 api .any one can help to finish?

View 4 Replies View Related

General :: Fork Process Will Not Exit - Ksh

Aug 19, 2010

I've a script that forks to another script.

The problem is that the child will not return to main process.

Main script "fork.sh"

Code:

The child process "smb_fork.sh"

Code:

when running it from the terminal "sh -x ./foork.sh"

Code:

My goal is via cron connect to ~100 remote winXP computers and download a single file. There fore I like to fork the process.

View 1 Replies View Related

General :: Regarding Fork() Multiple Process?

Aug 2, 2011

trying to fork multiple child but the program does not go as i want...

My code :

Code:

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

[code].....

View 14 Replies View Related

Programming :: Finding A Utility To Combine Two Or More Binary Files Into A Single Binary File?

May 5, 2011

Is there any Linux utility to combine two or more binary files into a single binary file ?

View 7 Replies View Related

Programming :: Version Info Coded Into ELF Binary / Author And Company Name Into ELF Binary?

Nov 30, 2010

How to coded version info and other information likes author and company name into the ELF binary?

I prefer the put the version info during build step.

View 5 Replies View Related

General :: Fork() Always Return 0 Even In The Parent Process?

Mar 18, 2011

my code is very simple:

int pid, status;
printf("parent process id=%d, to call fork
",getpid());
if(pid=fork()<0)

[Code].....

but everytime I can only get two fork return pid=0. In parent process, the pid returned by fork() should be >0 and equal to the child process id.

View 1 Replies View Related

General :: Fork: Resources Temporarily Unavalbale?

Apr 30, 2010

I am continuously getting fork: resources temporarily unavailable even when I am typing ls command.

View 1 Replies View Related

General :: Single Process Firefox (Disable Fork)

Aug 31, 2010

I would like to run versions of Mozilla Firefox 3.6.5+ as a single process, just as it was in versions 3.6.3 and prior. The reason is that, on Linux, I am running within proxychains - which doesn't bind to forked processes. Because the plugins in versions 3.6.5+ run in a forked process I can't use proxychains to redirect Flash streams. Is there a setting in modern versions of Firefox that allow me to run plugins in the main process?

View 1 Replies View Related

General :: Stat File For Permissions - Fork() Or Execve()?

May 6, 2011

When a application is ran from the shell:fork() is calledexecve() is calledI know the shell stats the file to make sure the required permissions are allowed in the child shell. But I can not find this in the man fork. Nor can I find this in man execve. Which one of these processes/calls stats the binary to be ran?

View 1 Replies View Related

General :: Fork Behavior While Copying File Descriptors

Jun 17, 2010

I am quite confused about the following description on fork. Could you please explain it ?The child process shall have its own copy of the parent's file descriptors. Each of the child's file descriptors shall refer to the same open file description with the corresponding file descriptor of the parent.For example, I am opening a socket and then fork. Now, does the child have a separate socket or is shares it with the parent. Does I have any impact on using it in child?

View 2 Replies View Related

General :: Copy An Entire Folder Tree ?

Sep 27, 2010

I am trying to use the cp command to copy some files around but want to preserve the entire folder structure. Example:

Then within the /backup location I want to see /backup/folder1/folder2/file.

I have tried cp -a and cp -p but neither give me the above.

View 3 Replies View Related

General :: Sorting In Aggregate Rather Than Tree Fashion With 'ls -Rt'?

Apr 28, 2010

The command: Code: ls -lRt Shows a recusrive listing, and sorts by modification time. But this in in tree fashion, where it first lists the contents of the current folder sorted by time, and then the contents of each child folder sorted by time. How would one accomplish this type of sort, but with an aggregate listing - all items recursively sorted together, rather than by individual folder?

View 3 Replies View Related

General :: Rsync To Copy Directory Tree From NAS Drive ?

Apr 10, 2010

I have a WD world book edition 1TB NAS drive, and just purchased an acomdata 1tb drive and connected it to the NAS via USB. If I recall I think the WD NAS has a ext_ or some type of linux filesystem on it, and the acomdata has a ntfs filesystem on it.

What I want to do is copy over certain directory trees of the NAS to the USB attached drive. I usually use MS synctoy to sync folders from my windows pc to the NAS drive, and MS richcopy to make the initial transfer from PC to NAS. For this operation though, since it is taking place entirely on the NAS and its connected drive, I thought that rsync would be the best option, and it is available on my NAS drive.

Last night I entered in rsync -avr /movies/* /usb1-1share1/ to copy the entire "movies" dir to the drive, which shows up as usb1-1share1 on the NAS drive. It copied most of the directory tree ok, but a lot of the folders were empty, so this morning I tried rsync -Carv --ignore-existing /movies/* /usb1-1share1/ to try and get all the files missed, without recopying the 24GB that did make it across. This also managed to copy a few more GB over, but not everything.

I am running the command from an ssh session on the NAS using putty on my PC, in as user "admin" which should have all rights over these folders. There is a bunch of errors in the command window like this: rsync: failed to set times on "/shares/usb1-1share1/movies/classics/fulldvd/First Blood DVD/.VTS_01_2.VOB.RxdjWZ": Operation not permitted (1)

I want to restart another session and get the files it missed, but I want to find out what I am doing wrong first. Should I be doing this as root user? am I missing some switches or just plain doing it all wrong?

View 3 Replies View Related

General :: Ftp Whole Directory Tree Using Vsftpd As Ftp Server In Fedora11

Feb 11, 2010

I am trying to ftp a whole directory tree using vsftpd as ftp server in fedora11

Code:

I am getting error while transfering a directory tree ...

View 1 Replies View Related

General :: Cannot Predict How Many Levels Deep Directory Tree Is

Sep 30, 2010

This little fragment does the opposite of what I want and I am trying to figure out how to reverse it. I want to strip off the directory and echo just the filenames. I cannot predict how many levels deep the directory tree is.

View 6 Replies View Related

General :: Find A Phrase/word Recursivly In A File Tree?

Aug 31, 2010

how do I find a phrase/word recursively in a file tree in Linux?I tried find . -name ./* | grep my_phraseand I tried grep -r "register_long_arrays" *

View 5 Replies View Related

General :: Overwriting Specific Files In Directory Tree Recursively

Jul 19, 2011

I would like to overwrite files in a directory tree, recursively. The ones I would like to overwrite match the filename "x_alpha*.png" and have a size exactly 456 bytes. Is there any way to search for these recursively in a directory tree, and overwrite them with a reference file, for example "e:mydirgood.png"

I am using Windows 7, but I have UnxUtils, so I can use those too. What I am looking for is something like this, generated automatically:
copy /y e:mydirgood.png e:mydiracx_alpha0023.png
copy /y e:mydirgood.png e:mydirefgx_alpha0045.png
copy /y e:mydirgood.png e:mydirhx_alpha0248.png

View 2 Replies View Related

General :: Use A 'distro' That Has Been Knocked Off The Update Tree With Security Intact?

Jan 8, 2011

Can you still use a 'distro' that has been knocked off the update tree with security intact, i.e., what are the risks. I ask because I am quite happy with fed 12 but there is a sound problem with my hardware on fed 14. My idea of extended support is 10 years, nieve I know but a nice thought.

View 11 Replies View Related

General :: Possible To Run An X86 Binary On An ARM Processor?

Dec 13, 2010

Is it possible to convert/recompile an already compiled x86 binary into an ARM binary?I'm using a BeagleBoard with a command-line Ubuntu (Maverick) and want to run a Ventrilo server but the x86 executable they supply cannot be run on the hardware as far as I can tell (most likely due to differing architecture).Unfortunately I don't have access to the source to allow me to recompile it natively.

View 3 Replies View Related

General :: See If A Binary Is Running?

Aug 19, 2010

I'm trying to autodetect if certain applications (for example, Firefoxre running. I figured the easiest way would be by checking process names.

View 2 Replies View Related

General :: Creating A New Binary?

Jan 5, 2011

I need to change the functions of some linux commands. We can't edit the binary files provided in /bin, is there any other method other than alias.For ex. - I need to change the function chmod so that it takes only three consecutive integers as input (chmod 777 filename) and nothing else ? Do I have to write by own code for it, or is there any other alternate method.

View 2 Replies View Related

General :: FTP Always In Binary Mode?

Dec 27, 2010

In a DOS prompt, I would like to ftp ASCII get a file from a Linux machine. The file was created in vi, just a normal text file.in DOS prompt:

Code:
ftp> ascii
200> Switching to ASCII mode.

[code]...

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved