LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-05-2013, 02:06 PM   #1
Anand Singh
LQ Newbie
 
Registered: Jan 2013
Posts: 1

Rep: Reputation: Disabled
how to emulate dup2() system call


I want to emulate dup2 without using fcntl. can anybody help me?

Regards,
Anand
 
Old 01-06-2013, 01:46 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 1,775

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
Give some context: if you want dup2, why don't you use dup2?
 
Old 01-06-2013, 03:59 PM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 2,202

Rep: Reputation: 569Reputation: 569Reputation: 569Reputation: 569Reputation: 569Reputation: 569
Quote:
Originally Posted by Anand Singh View Post
I want to emulate dup2 without using fcntl. can anybody help me?

Regards,
Anand
At a fundamental level, you can't. It is a system call that duplicates a file descriptor which is a kernel data structure. The file descriptor returned to a user process is nothing but an index into the kernel table - so "emulation" doesn't exist.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
may i know details about system call how to use system call and definition for virtua mahi rajee Programming 1 05-02-2012 07:45 AM
how to write a system call which returns current system time using call by reference mukul2kul4 Debian 2 09-25-2011 11:17 PM
calling a system call inside a system call suresh.j Linux - Kernel 1 08-03-2010 09:28 PM
Emulate "dup2()" without using "fcntl()" bit128_linux Linux - General 0 03-12-2008 11:12 AM
How can i make centos 4.5's system call using vDSO(call *%gs:0x10) instead of int80 tclwp Red Hat 3 08-06-2007 12:07 AM


All times are GMT -5. The time now is 05:10 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration