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

  • SEARCH
  • Home
  • 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 5971445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:31:02+00:00 2026-05-22T20:31:02+00:00

I have a question about program exit state in Linux. In my program, I

  • 0

I have a question about program exit state in Linux. In my program, I fork a child process and invoke waitpid to reap it. When waitpid returns, I wanna check exit state of my child process. I turn to manual for help and find that the second argument of waitpid will hold exit state and I can use macro WEXITSTATE to read it. However, this macro just extract least significant 8 bits of the real exit state, while in manual of function exit(int ret_val), it will exit with ret_val & 0x377, instead of least significant 8 bits.

My question is, where is the other more bits? Do we simply drop them? Why Linux employ this strategy? Doesn’t this implementation introduce trouble to our program?

Thanks and Best Regards.

  • 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-05-22T20:31:03+00:00Added an answer on May 22, 2026 at 8:31 pm

    I think you will find that 0x377 is really, or should have been, 0377.

    It’s octal, so   3778   is 8 bits.

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

Sidebar

Related Questions

I have a question about debugging a running C++ program in Linux. If a
Have a question about linux bash. I want to start a program and then
I am working on a multi-thread program, and have a question about where to
I have a question about Symbian active objects handling. What's the problem: my program
I have a question about improving the efficiency of my program. I have a
I have a question about parallel processing in shell scripting. I have a program
I have a question about the best way to design a program I'm working
i have a question about event based program performance. in my company we have
I have a question about buffer overflaw, in this program : #include <stdio.h> #include
I am bit new to R and have a question about a program I

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.