Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Some Questions on : process, poll, pollfd

Posted on 2001-09-12
3
425 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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…

791 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