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 7407917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:48:54+00:00 2026-05-29T05:48:54+00:00

When I call system(0) it returns 0, which means shell is not available .

  • 0

When I call system(0) it returns 0, which means shell is not available.

When a command using system (calls gcc to compile a hello world program), it works just fine but returns -1 (I assume it’s the same cause as for system(0) returning 0). What causes it to be “not available” and why does it work anyway?

Compiler: gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)

OS: Ubuntu 11.10

EDIT

Errno says No Child Processes.

I have also compiled another test program that does not do anything but calls system(0) and it returns nonzero value. Can it be affected by Code::Blocks?

EDIT

So far I have figured out that system(0) only fails after I start my first pthread.

SOLVED

I used fork in my early implementation of one of this piece of code:

signal(SIGCHLD,SIG_IGN);

I used it to “handle” zombies. I just found out that this caused the error.

  • 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-29T05:48:55+00:00Added an answer on May 29, 2026 at 5:48 am

    This could happen if you are ignoring the SIGCHLD signal using code like :

    signal(SIGCHLD, SIG_IGN);
    

    This would cause system to return -1 when all children have ended, setting errno to ECHILD.

    Refer to http://pubs.opengroup.org/onlinepubs/009695399/functions/wait.html. Specifically :

    If the calling process has SA_NOCLDWAIT set or has SIGCHLD set to SIG_IGN, and the process has no unwaited-for children that were transformed into zombie processes, the calling thread shall block until all of the children of the process containing the calling thread terminate, and wait() and waitpid() shall fail and set errno to [ECHILD].

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

Sidebar

Related Questions

I have a program which does a system call: latex somefile.latex This runs ok,
I'm gluing together a number of system calls using the Amazon Elastic Map Reduce
I have an API call which returns a double. The double's decimal length can
When I try to call System.IO.File.Encrypt() on an existing file, it throws a generic
I've previously encountered the suggestion to call System.Threading.Thread.Sleep(0); in tights loops in C# to
I've got a few methods that should call System.exit() on certain inputs. Unfortunately, testing
The clone() system call on Linux takes a parameter pointing to the stack for
After my system call has returned because it was interrupted by a signal, is
It is said that fork system call creates a clone of the calling process,
I'm trying to make a system call in Python and store the output to

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.