12-26-2010
Thanks a lot anurag.
---------- Post updated at 07:02 AM ---------- Previous update was at 07:01 AM ----------
Thanks a lot corona.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I desperately wanted one of the UNIX Gurus to help me resolve my problem asap(I have to deliver the code to the client by Monday 08-oct).
I have a file with around 5 million records (50 lakhs). Now my original process was taking around 30 hours to read the complete file, process each and every... (4 Replies)
Discussion started by: kkumar1975
4 Replies
2. Programming
One more question. How can i calculate the time that system needs to make fork() system call? I need to make it with times function but i really don't know how. :( (2 Replies)
Discussion started by: davidoff
2 Replies
3. Programming
Dear Friends,
I write a c program to list the directories recursively. For this I write a function called my_readdir to read the content of directory. For this I use read system call it returns -1, then I use readdir system call it gives comment terminated error or segmentation... (1 Reply)
Discussion started by: spmlingam
1 Replies
4. UNIX for Dummies Questions & Answers
Can anyone explain me what really happens when a system call fork() is called ?
I like to know what happens internally.
Thanks in Advance.
- Arun (1 Reply)
Discussion started by: arunviswanath
1 Replies
5. AIX
Hi,
i am using IBM P6 server and OS is AIX 5.3. my code is written in c/pro C.
i am facing problem in msgctl() system call.The variables msg_qbytes and msg_cbytes are used to store total no of bytes and current no of bytes in a QUEUE,but it is showing me as ZERO though data are there... (0 Replies)
Discussion started by: ajaysahoo
0 Replies
6. UNIX for Dummies Questions & Answers
Hi folks,
I want to know how this below program works?
#include <stdio.h>
int main()
{
printf("A\n");
fork();
printf("B\n");
fork();
fork();
printf("D\n");
fork();
printf("C\n");
}
This is just for example. How this type of programs where fork is used many places, how the... (1 Reply)
Discussion started by: u_peerless
1 Replies
7. Linux
hi,
where can I find the detail information about the syscall in binary instructions of linux/mips.
for example, in linux/mips:
li v0, 4140
syscall
it's a syacall of "lseek" , but how can I find that which registers will be used in this syscall , and the meaning of the arguments in the... (2 Replies)
Discussion started by: zerocool_08
2 Replies
8. Homework & Coursework Questions
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:
i have a problem in understanding the behaviour of fork .
i understood fork as to create a new process and... (4 Replies)
Discussion started by: MrUser
4 Replies
9. Shell Programming and Scripting
hi,
i tried the following source codes:
fork1.c:
main()
{
printf("demo of fork\n");
fork();
printf("hello");
}
output:
demo of fork
hello hello
fork2.c:
main()
{
printf("demo of fork"); (0 Replies)
Discussion started by: pnirmala
0 Replies
10. UNIX for Advanced & Expert Users
Hi
I wrote a simple fork program to illustrate the fork() system cal. here it is
#include<stdio.h>
#include<sys/stat.h>
#include<sys/types.h>
main()
{
int flag;
flag=fork();
if(flag==0)
{
printf("Child \n");
printf("Process id= %d\n",getpid());
... (3 Replies)
Discussion started by: badsha6642
3 Replies
FORK1(9) BSD Kernel Developer's Manual FORK1(9)
NAME
fork1 -- create a new process
SYNOPSIS
#include <sys/types.h>
#include <sys/proc.h>
int
fork1(struct lwp *l1, int flags, int exitsig, void *stack, size_t stacksize, void (*func)(void *), void *arg, register_t *retval,
struct proc **rnewprocp);
DESCRIPTION
fork1() creates a new process out of the process behind l1, which is assumed to be the current lwp. This function is used primarily to
implement the fork(2) and vfork(2) system calls, but is versatile enough to be used as a backend for e.g. the __clone(2) call.
The flags argument controls the semantics of the fork operation, and is made up of the bitwise-OR of the following values:
FORK_PPWAIT The parent process will sleep until the child process successfully calls execve(2) or exits (either by a call to _exit(2) or
abnormally).
FORK_SHAREVM The child process will share the parent's virtual address space. If this flag is not specified, the child will get a copy-
on-write snapshot of the parent's address space.
FORK_SHARECWD The child process will share the parent's current directory, root directory, and file creation mask.
FORK_SHAREFILES The child process will share the parent's file descriptors.
FORK_SHARESIGS The child process will share the parent's signal actions.
FORK_NOWAIT The child process will at creation time be inherited by the init process.
FORK_CLEANFILES The child process will not copy or share the parent's descriptors, but rather will start out with a clean set.
A flags value of 0 indicates a standard fork operation.
The exitsig argument controls the signal sent to the parent on child death. If normal operation desired, SIGCHLD should be supplied.
It is possible to specify the child userspace stack location and size by using the stack and stacksize arguments, respectively. Values NULL
and 0, respectively, will give the child the default values for the machine architecture in question.
The arguments func and arg can be used to specify a kernel function to be called when the child process returns instead of child_return().
These are used for example in starting the init process and creating kernel threads.
The retval argument is provided for the use of system call stubs. If retval is not NULL, it will hold the following values after successful
completion of the fork operation:
retval[0] This will contain the pid of the child process.
retval[1] In the parent process, this will contain the value 0. In the child process, this will contain 1.
User level system call stubs typically subtract 1 from retval[1] and bitwise-AND it with retval[0], thus returning the pid to the parent
process and 0 to the child.
If rnewprocp is not NULL, *rnewprocp will point to the newly created process upon successful completion of the fork operation.
RETURN VALUES
Upon successful completion of the fork operation, fork1() returns 0. Otherwise, the following error values are returned:
[EAGAIN] The limit on the total number of system processes would be exceeded.
[EAGAIN] The limit RLIMIT_NPROC on the total number of processes under execution by this user id would be exceeded.
SEE ALSO
execve(2), fork(2), vfork(2)
BSD
January 4, 2008 BSD