Solved

Some Questions on : process, poll, pollfd

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

762 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now