Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8818381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:05:38+00:00 2026-06-14T05:05:38+00:00

consider the following: a parent process with a child child runs another program using

  • 0

consider the following:

  1. a parent process with a child
  2. child runs another program using exec system call
  3. parent and child communicating through a bi-directional pipe(named MAINPIPE in rest)
  4. the child is a server binding on a port(e.g. 5000)

my program should work as follows:

if child receives a certain message from a client create another bi-directional pipe to his parent and send/receive some info.

the problem is:

when I create a pipe in the child (using pipe()) and pass the file descriptors to the parent (using MAINPIPE), parent gets “Bad file descriptor” error message when trying to read from pipe.

any idea?

EDIT:

guys,

my problem isn’t passing file-desciptors of new pipe -that is created in child process- to parent,
i’ve already done that using MAINPIPE,

but problem is : parent can’t read from new pipe, got this error message “bad file descriptor”
it seems that the file descriptors is closed in parent process!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:05:39+00:00Added an answer on June 14, 2026 at 5:05 am

    A file descriptor belongs to a process. In your case the child process.

    Transferring the number of a file descriptor, in your case 10, does not transfer the file descriptor itself. It just transfers the number 10. The number 10 can mean file descriptor 10 in the child process, but as a file descriptor belongs to a process, it is meaningless in the parent process. A child process only inherits the file descriptor from the parent when it was created.

    Any file descriptors opened after the child is created are not shared between the parent and child.

    If you need to pass the actual file descriptor to another (e.g. the parent) process, unix domain sockets have a mechanism for doing that, other posts here contains some relevant links for this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following parent/child relationship where Parent is 1..n with Kids (only the relevant
Consider the following requirement for building a forum App Parent Post - Child Post1
Consider the following Parent/Child relationship. What I would like to know is how I
Consider the following: class Parent include Mongoid::Document field:name references_one :child before_create :initialize_child protected def
Consider the following setup: class Parent < ActiveRecord::Base has_many :children end class Child <
Let's consider the following example. I have a parent process that creates a pipe,
I have a parent child relationship stored in a table consider the following example
Consider following string Some string with quotes and \pre-slashed\ quotes Using regex, I want
Consider following program: static void Main (string[] args) { int i; uint ui; i
Consider the following (simplistic) situation: CREATE TABLE PARENT ( PARENT_ID INT PRIMARY KEY );

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.