Solved

Some Questions on : process, poll, pollfd

Posted on 2001-09-12
3
418 Views
Last Modified: 2006-11-17
Hi All
 
I have some questions :
 
1. Can I change the owner of the process? Suppose I execute a program.
    pid = 1234
    process owner = "x"
   
    then I fork the process.
    pid of child = 12345
 
    Now I kill the parent.(1234). parent of 1235 is "1" now (init process). but owner still remains the same.. "x". can I change it to y?
 
2. what does POLLHUP signify in poll system call? does somebody have a piece of code that can emulate this??? when will I get POLLHUP as in reevent member of pollfd structure?
 
3. what is the significance of events & revents members of pollfd??? any program that emulates "all/most of" the conditions of poll will be really great.
 
Regards
 
Ajay
0
Comment
Question by:avi_india
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
chris_calabrese earned 100 total points
ID: 6477724
1.  Only processes running as uid 0 (i.e., 'root') can change their uid.
 This is done with the setuid() system call.

2.  According the poll() man page, it happens when you're trying to access a device that's been physically disconnected..

3.  The significance of event and revent is that these are the structures
used to pass the list of things you want to poll for and where you find
out what actually happened respectively.

Don't have any code, but check the man pages.  The man page for poll
has excellent examples on every system I've seen.
0
 

Author Comment

by:avi_india
ID: 6478440
Thanks Chris....

About 2nd point my main concern is that in real scenario when this actually would happen??? i.e. if I've made a poll call, then when will I get POLLHUP?

0
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 6480075
Say you're reading a file on a CD-ROM and someone ejects the CD...
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question