Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 33 results for
vfork
- Page 1
Re: Behaviour of program in exit vs return with vfork
Programming
Software Development
13 Years Ago
by Narue
… in the child, it just ends the process. Since
vfork
() shares process memory between parent and child, letting the … a Bad Thing™. Technically, the way you're using
vfork
() is undefined regardless of your exit strategy, as allowed … are severely limited: [quote] (From POSIX.1) The
vfork
() function has the same effect as fork(2), except that…
Behaviour of program in exit vs return with vfork
Programming
Software Development
13 Years Ago
by Efficience
I have written a code for checking
vfork
in unix. But I am getting the ambiguous behavious.…of this behavior please ? I know in case of
vfork
same memory space is shared between parent and child but…pid,k=1; printf("Before fork \n"); pid =
vfork
(); if(pid == 0) { printf("I am a child …
Re: Behaviour of program in exit vs return with vfork
Programming
Software Development
13 Years Ago
by Narue
… closing any open file descriptor.[/QUOTE] IIRC, most versions of
vfork
() copy file descriptors, so closing them in the child is…, so once again I'll recommend using fork() instead of
vfork
(). The potential performance benefits aren't worth the risk.
Re: Behaviour of program in exit vs return with vfork
Programming
Software Development
13 Years Ago
by Efficience
… pid,k=1; printf("Before fork \n"); pid =
vfork
(); if(pid == 0) { printf("I am a child \n…
Re: Behaviour of program in exit vs return with vfork
Programming
Software Development
13 Years Ago
by Efficience
Hmm , I understand it now. Thanks a lot Narue. If child process is copying the descriptor their should not be such problem.
Problem with basic templates on GCC
Programming
Software Development
20 Years Ago
by winbatch
… -o Test /usr/lib/libstdc++.so: warning: reference to compatibility
vfork
(); include <unistd.h> for correct reference Test.o…
creating a process in UNIX
Hardware and Software
Linux and Unix
15 Years Ago
by want_to_code
what are the ways that a process can be created in UNIX apart from fork/
vfork
?
[Linux] Execve usage
Programming
Software Development
15 Years Ago
by Gonbe
… fragment underneath shows my usage: [CODE="C"] childPID =
vfork
(); if (childPID == 0) { execve(input.process, input.parameters, environ); printf…
execve problem: How to construct argument lists
Programming
Software Development
15 Years Ago
by QuantumMechanic
… line sprintf(cmdstr,"%s/%s",UTILPATH,script_name); pid =
vfork
(); if (pid == -1) { // fork error code here } if (pid == 0…
Re: variations in fread() buffering
Programming
Software Development
14 Years Ago
by nezachem
…This is the output on Solaris in the case of
vfork
(): Segmentation Fault (core dumped) [/QUOTE] A vforked child… undefined behaviour. [QUOTE]MS-Windows creates threads just like
vfork
, where all threads share the same memory. [/QUOTE] …It does not. After
vfork
the parent process is blocked until the child does either…
Re: variations in fread() buffering
Programming
Software Development
14 Years Ago
by Ancient Dragon
[QUOTE] It does not. After
vfork
the parent process is blocked until the child does either…while sharing memory space. [/QUOTE] I have no clue how
vfork
() works -- I was just comparing the posted results with how… I posted and ran works just as you described for
vfork
() -- the win32 api function WaitForSingleObject() causes the thread to wait…
Re: variations in fread() buffering
Programming
Software Development
14 Years Ago
by sree_ec
… not be same but fp is same. Then I used
vfork
() instead of fork(), with the same program.. [just gave it… parent fp at 22; just like your solaris output. In
vfork
() parent and child uses the same memory space [shared] So…
Re: variations in fread() buffering
Programming
Software Development
14 Years Ago
by sree_ec
…;1331588]Thanks sree_ec. I added exit(0) for child (the
vfork
case) and it gave the same output as Solaris gives… parameter is also varying.So in the case we use
vfork
() and assume that it shares same fle pointer structure , we…
Re: Need help passing data from child process to parent in simple fork() program
Programming
Software Development
10 Years Ago
by Kyle_4
You need to use
vfork
(). Here's an example. #include <iostream> #include <…; int num, sum=0; /*fork a child process*/ pid_t pid =
vfork
(); if(pid<0){ cout<<"fork failed…
Re: Unknown prototype ...
Programming
Software Development
17 Years Ago
by invisal
…(useconds_t, useconds_t); int unlink(const char *); int usleep(useconds_t); pid_t
vfork
(void); ssize_t write(int, const void *, size_t); [/code] Source: [url…
Re: variations in fread() buffering
Programming
Software Development
14 Years Ago
by Ancient Dragon
MS-Windows creates threads just like
vfork
, where all threads share the same memory. I didn't realize fork() creates new data space :-O
Re: variations in fread() buffering
Programming
Software Development
14 Years Ago
by sree_ec
[QUOTE=Ancient Dragon;1327960]MS-Windows creates threads just like
vfork
, where all threads share the same memory. I didn't …
Re: variations in fread() buffering
Programming
Software Development
14 Years Ago
by Jishnu
This is the output on Solaris in the case of
vfork
() [QUOTE]initial file handle :: 0 child read :: abcdefghij child file handle :: 11 parent file handle :: -1 Segmentation Fault (core dumped) [/QUOTE] I will add a detailed post later.
Re: variations in fread() buffering
Programming
Software Development
14 Years Ago
by sree_ec
[QUOTE=Jishnu;1328612]This is the output on Solaris in the case of
vfork
() I will add a detailed post later.[/QUOTE] we need to do a clean up before child terminates. So add an exit(0); or _exit(0); before the process terminates. This should solve the problem
Re: variations in fread() buffering
Programming
Software Development
14 Years Ago
by Jishnu
…[/QUOTE] Thanks sree_ec. I added exit(0) for child (the
vfork
case) and it gave the same output as Solaris gives…
Re: variations in fread() buffering
Programming
Software Development
14 Years Ago
by Jishnu
… parameter is also varying.So in the case we use
vfork
() and assume that it shares same fle pointer structure , we…
Re: Segmentation Fault, and I know where it is
Programming
Software Development
12 Years Ago
by Ancient Dragon
… = 2; for(i = 2; i < argc; i++) { pid_t pid =
vfork
(); if( pid == 0) { char* filename = argv[id]; id++; // ready for…
Re: C dissecting protocol level 3 and application and url name in packet hex va
Programming
Software Development
11 Years Ago
by newbie14
… checking for strsep... yes checking for fork... yes checking for
vfork
... yes checking for strftime... yes checking for setlinebuf... yes checking…
Re: C dissecting protocol level 3 and application and url name in packet hex va
Programming
Software Development
11 Years Ago
by newbie14
… checking for strsep... yes checking for fork... yes checking for
vfork
... yes checking for strftime... yes checking for setlinebuf... yes checking…
Re: Problem with basic templates on GCC
Programming
Software Development
20 Years Ago
by 1o0oBhP
not sure what is wrong there! However this code (untested) should work [CODE] #include <iostream> // std::cout #include <string> // std::string #include <cstdlib> // system template <class t> class mytemp { public: mytemp(t temp) { data = temp; } void print(void) { std::cout << data; }…
Re: creating a process in UNIX
Hardware and Software
Linux and Unix
15 Years Ago
by sknake
[icode]exec[/icode]
Re: creating a process in UNIX
Hardware and Software
Linux and Unix
15 Years Ago
by 50701735
i think that create a process in unix is like nearly with create process in linux . you can use system called that is fork(),exec(), or system();
Re: [Linux] Execve usage
Programming
Software Development
15 Years Ago
by Salem
The 'e' forms pass the environment. The 'p' forms (which you're not using) are the ones which search the PATH.
Re: [Linux] Execve usage
Programming
Software Development
15 Years Ago
by gerard4143
execve info/man has really good example code towards the bottom of the topic. Here's what I did: [CODE] #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char *argv[]) { char *newargv[] = { "/bin/ls", "-l", NULL }; char *newenviron[] = { NULL }; char *exeprog = &…
Re: execve problem: How to construct argument lists
Programming
Software Development
15 Years Ago
by nezachem
Few things are obvious right away: 1. cmdstr is not initialized. 2. my_env and my_args are not terminated by NULL. 3. A first element of my_args is a program name. The way you set the arguments up is not fatal, but highly unconventional. 4. You [I]must[/I] test the value returned by realloc. 5. You are working too hard. I'd just go with [CODE]char …
1
2
Next
Search
Search
Forums
Forum Index
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
Backlink Auditor
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2025 DaniWeb® LLC