02-22-2001
Hi im a student,
1st time using unix, currently were writing programs using fork() and identifying differences between the parent child processes. Im finding getpid(), getppid(), retVal confusing and we are moving on to grps now any
sites or information you can supply me to make this alittle clearer would be greatly appreciated.
9 More Discussions You Might Find Interesting
1. IP Networking
Hey,
I am learning to program a TCP server and managed to get it up and running (I am using Windows 98SE).
I can use the send function to send information to the client and I can use the recv function to ask the user to pass information through, but when I do so it only allows the client to... (1 Reply)
Discussion started by: KrazyGuyPaul
1 Replies
2. Programming
i would like advice on the usbject of c programming (in the middle of reading a book on C). could i benefit more if i apply that knowledge in the unix format if i were able to, or would that take the point out of learning C, basically I want to stay away from strying too far away from unix and use... (1 Reply)
Discussion started by: moxxx68
1 Replies
3. UNIX for Dummies Questions & Answers
hi guys,
I m from india. I m working as programmer in one of MNC. Since 3 years im working on Microsoft platform on dot net and platforms.
but now i decided to shift my future to unix , Linux side. I want to be the part of this open source family.
and with this i want to make my future also.... (6 Replies)
Discussion started by: d_swapneel14
6 Replies
4. Shell Programming and Scripting
Several months ago I found a link that explained the difference between how a Unix Systems Admin would do scripting compared to what a Unix Programmer would do.
It showed a basic script and then show several iterations that explained how the Systems Admin would change it to make it better. I was... (0 Replies)
Discussion started by: BCarlson
0 Replies
5. UNIX for Dummies Questions & Answers
Hello,
I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
Discussion started by: vibhory2j
5 Replies
6. Programming
Hi,
I have a client-server socket program. It has been working fine for over a year, but recently it started to show strange behavior.:confused:
After the server program runs for a while, it will show in the top command saying it is using lots of CPU, MEM. I assume it means the server code is... (1 Reply)
Discussion started by: natxie
1 Replies
7. Shell Programming and Scripting
hey guys im trying to create a batch file that makes directories
i have this code atm
#!/bin/sh
echo "Please enter file name:"
read Filename
echo "enter number of files to be created "
read created
for (( i = 1; i < &created; 1++ ))
do
mkdir $Filename$i
done
assume i enter... (7 Replies)
Discussion started by: josh111
7 Replies
8. UNIX for Dummies Questions & Answers
How does unix system administration, unix programming, unix network programming differ?
Please help. (0 Replies)
Discussion started by: thulasidharan2k
0 Replies
9. Programming
Sorry if I posted 2 separate questions.
I'm currently doing socket programming on my current task. As you can see below in the client side. I've tried to do a loop so I will be able to get prompt for input over and over again.
This is the code.
do{
printf("Please your name > ");... (10 Replies)
Discussion started by: aLHaNz
10 Replies
GETPID(2) Linux Programmer's Manual GETPID(2)
NAME
getpid, getppid - get process identification
SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
pid_t getpid(void);
pid_t getppid(void);
DESCRIPTION
getpid() returns the process ID of the calling process. (This is often used by routines that generate unique temporary filenames.)
getppid() returns the process ID of the parent of the calling process.
ERRORS
These functions are always successful.
CONFORMING TO
POSIX.1-2001, 4.3BSD, SVr4.
NOTES
Since glibc version 2.3.4, the glibc wrapper function for getpid() caches PIDs, so as to avoid additional system calls when a process calls
getpid() repeatedly. Normally this caching is invisible, but its correct operation relies on support in the wrapper functions for fork(2),
vfork(2), and clone(2): if an application bypasses the glibc wrappers for these system calls by using syscall(2), then a call to getpid()
in the child will return the wrong value (to be precise: it will return the PID of the parent process). See also clone(2) for discussion
of a case where getpid() may return the wrong value even when invoking clone(2) via the glibc wrapper function.
SEE ALSO
clone(2), fork(2), kill(2), exec(3), mkstemp(3), tempnam(3), tmpfile(3), tmpnam(3), credentials(7)
COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2008-09-23 GETPID(2)