Sponsored Content
Top Forums Programming parent not waiting until child complete executing another program through execl() Post 302195671 by vvaidyan on Thursday 15th of May 2008 05:02:28 PM
Old 05-15-2008
# define MAXLINE 1024

char line[MAXLINE];

while( (rv = read(fd2[0], line, MAXLINE)) != 0)
{
// do whatever
}
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

what are parent and child processes all about?

I don't follow what these are... this is what my text says... "When a process is started, a duplicate of that process is created. This new process is called the child and the process that created it is called the parent. The child process then replaces the copy for the code the parent... (1 Reply)
Discussion started by: xyyz
1 Replies

2. Programming

shared memory between parent and child, when execl()

Hi, Am new to Linux internals. I want to use shared memory segment between the parent and the child processess. if i create a shared memory before fork,the child inherits the attached shared memory segments but once i call exec in the child process, all attached shared memory segments... (1 Reply)
Discussion started by: rvan
1 Replies

3. Shell Programming and Scripting

parent shell is waiting upon the child shell

Hi, I haev to devlop a script which when executed will take in a sudo privelege and run a set of commands then will go back to parent shell and execute the rest of the command But the problem I am facing is that when the script is executed it takes the sudo privelege but it waits for the... (0 Replies)
Discussion started by: ruchirmayank
0 Replies

4. Solaris

Timed out waiting for Autonegotiation to complete

Received the Timed out message consistently when I tried to jumpstart an M5000 with: boot jsnet:speed=1000,duplex=full - install Made the error go away by adding link-clock parameter: boot jsnet:speed=1000,duplex=full,link-clock=master - install "link-clock=master" disables... (1 Reply)
Discussion started by: markoakley
1 Replies

5. Homework & Coursework Questions

Need help with deleting childīs parent and child subprocess

1. The problem statement, all variables and given/known data: I need to make an program that in a loop creates one parent and five children with fork(). The problem i'm trying to solve is how to delete the parent and child of the childīs process. 2. Relevant commands, code, scripts,... (0 Replies)
Discussion started by: WhiteFace
0 Replies

6. Shell Programming and Scripting

forking a child process and kill its parent to show that child process has init() as its parent

Hi everyone i am very new to linux , working on bash shell. I am trying to solve the given problem 1. Create a process and then create children using fork 2. Check the Status of the application for successful running. 3. Kill all the process(threads) except parent and first child... (2 Replies)
Discussion started by: vizz_k
2 Replies

7. Windows & DOS: Issues & Discussions

AutoSys Job not waiting for script to complete

I'm not sure if this is the right place to post this issue...but here goes... I am converting a set of windows jobs from Control-M to AutoSys r11.3. The same command line is being executed in both systems. The Control-M job runs to compltion in about 1.5 hours, waiting for the entire batch... (3 Replies)
Discussion started by: ajomarquez
3 Replies

8. Shell Programming and Scripting

Waiting for a process to complete in shell script

Hi, I need to initiate a process script which will start and do some processing and then shuts down. Then i need to other verifications. But the the process takes around 25 to 3o minutes. One thing i can monitor the nohup.out file for this process where i can wait for shutting down statement to... (3 Replies)
Discussion started by: Prashanth19
3 Replies

9. Homework & Coursework Questions

Help with Execl system call in a C program?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: "Your a7.c program should use printf to print a nice message. (You can decide what to say.) Then the process... (9 Replies)
Discussion started by: miniviking10
9 Replies

10. Shell Programming and Scripting

Subprocess.popen() should write to log without waiting for process to complete

Here is my test code process = sp.Popen( + , bufsize=1, universal_newlines=True, stdout=sp.PIPE, stderr=sp.STDOUT, cwd=src_home) output, _ =... (2 Replies)
Discussion started by: ezee
2 Replies
JudyHS(3)						     Library Functions Manual							 JudyHS(3)

NAME
JudyHS macros - C library for creating and accessing a dynamic array, using an array-of-bytes of Length as an Index and a word as a Value. SYNOPSIS
cc [flags] sourcefiles -lJudy #include <Judy.h> Word_t * PValue; // JudyHS array element int Rc_int; // return flag Word_t Rc_word; // full word return value Pvoid_t PJHSArray = (Pvoid_t) NULL; // initialize JudyHS array uint8_t * Index; // array-of-bytes pointer Word_t Length; // number of bytes in Index JHSI( PValue, PJHSArray, Index, Length); // JudyHSIns() JHSD( Rc_int, PJHSArray, Index, Length); // JudyHSDel() JHSG( PValue, PJHSArray, Index, Length); // JudyHSGet() JHSFA(Rc_word, PJHSArray); // JudyHSFreeArray() DESCRIPTION
A JudyHS array is the equivalent of an array of word-sized value/pointers. An Index is a pointer to an array-of-bytes of specified length: Length. Rather than using a null terminated string, this difference from JudySL(3) allows strings to contain all bits (specifically the null character). This new addition (May 2004) to Judy arrays is a hybird using the best capabilities of hashing and Judy methods. JudyHS does not have a poor performance case where knowledge of the hash algorithm can be used to degrade the performance. Since JudyHS is based on a hash method, Indexes are not stored in any particular order. Therefore the JudyHSFirst(), JudyHSNext(), JudyH- SPrev() and JudyHSLast() neighbor search functions are not practical. The Length of each array-of-bytes can be from 0 to the limits of malloc() (about 2GB). The hallmark of JudyHS is speed with scalability, but memory efficiency is excellent. The speed is very competitive with the best hashing methods. The memory efficiency is similar to a linked list of the same Indexes and Values. JudyHS is designed to scale from 0 to billions of Indexes. A JudyHS array is allocated with a NULL pointer Pvoid_t PJHSArray = (Pvoid_t) NULL; Because the macro forms of the API have a simpler error handling interface than the equivalent functions, they are the preferred way to use JudyHS. JHSI(PValue, PJHSArray, Index, Length) // JudyHSIns() Given a pointer to a JudyHS array (PJHSArray), insert an Index string of length: Length and a Value into the JudyHS array: PJHSArray. If the Index is successfully inserted, the Value is initialized to 0. If the Index was already present, the Value is not modified. Return PValue pointing to Value. Your program should use this pointer to read or modify the Value, for example: Value = *PValue; *PValue = 1234; Note: JHSI() and JHSD can reorganize the JudyHS array. Therefore, pointers returned from previous JudyHS calls become invalid and must be re-acquired (using JHSG()). JHSD(Rc_int, PJHSArray, Index, Length) // JudyHSDel() Given a pointer to a JudyHS array (PJHSArray), delete the specified Index along with the Value from the JudyHS array. Return Rc_int set to 1 if successfully removed from the array. Return Rc_int set to 0 if Index was not present. JHSG(PValue, PJHSArray, Index, Length) // JudyHSGet() Given a pointer to a JudyHS array (PJHSArray), find Value associated with Index. Return PValue pointing to Index's Value. Return PValue set to NULL if the Index was not present. JHSFA(Rc_word, PJHSArray) // JudyHSFreeArray() Given a pointer to a JudyHS array (PJHSArray), free the entire array. Return Rc_word set to the number of bytes freed and PJHSArray set to NULL. ERRORS
: See: Judy_3.htm#ERRORS EXAMPLES
Show how to program with the JudyHS macros. This program will print duplicate lines and their line number from stdin. #include <unistd.h> #include <stdio.h> #include <string.h> #include <Judy.h> // Compiled: // cc -O PrintDupLines.c -lJudy -o PrintDupLines #define MAXLINE 1000000 /* max fgets length of line */ uint8_t Index[MAXLINE]; // string to check int // Usage: PrintDupLines < file main() { Pvoid_t PJArray = (PWord_t)NULL; // Judy array. PWord_t PValue; // Judy array element pointer. Word_t Bytes; // size of JudyHS array. Word_t LineNumb = 0; // current line number Word_t Dups = 0; // number of duplicate lines while (fgets(Index, MAXLINE, stdin) != (char *)NULL) { LineNumb++; // line number // store string into array JHSI(PValue, PJArray, Index, strlen(Index)); if (PValue == PJERR) // See ERRORS section { fprintf(stderr, "Out of memory -- exit "); exit(1); } if (*PValue == 0) // check if duplicate { Dups++; printf("Duplicate lines %lu:%lu:%s", *PValue, LineNumb, Index); } else { *PValue = LineNumb; // store Line number } } printf("%lu Duplicates, free JudyHS array of %lu Lines ", Dups, LineNumb - Dups); JHSFA(Bytes, PJArray); // free JudyHS array printf("JudyHSFreeArray() free'ed %lu bytes of memory ", Bytes); return (0); } AUTHOR
JudyHS was invented and implemented by Doug Baskins after retiring from Hewlett-Packard. SEE ALSO
Judy(3), Judy1(3), JudyL(3), JudySL(3), malloc(), the Judy website, http://judy.sourceforge.net, for further information and Application Notes. JudyHS(3)
All times are GMT -4. The time now is 07:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy