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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:01:36+00:00 2026-05-28T07:01:36+00:00

A new process is created by fork/exec. Exec sets up the command line arguments

  • 0

A new process is created by fork/exec. Exec sets up the command line arguments but I don’t see that it sets up the number of those arguments to put in argc.

main() is supposed to be the first function to run in the new process but argc is already set by then.

Where is it set? It has to be some kind of setup code that counts parameters before main is called but nothing I have read explains what kinds of things this setup code does or where it resides.

Is this in libc? Is this the same on every OS and covered by some specification? Where would I find what goes on in the setup code besides this? Is it called before instantiating globals?

  • 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-28T07:01:37+00:00Added an answer on May 28, 2026 at 7:01 am

    There’s plenty of stuff that happens in most implementations before main is called (usually environment set up by something similar to crt0, the C runtime startup).

    There’s also plenty of stuff that may happen after main exits, such as resource closure, atexit exit handlers and so forth.

    The C standards only really cover the stuff that happens in terms of the language, not how implementations do their work under the covers (which is basically what you’re asking). Each implementation may do things in different ways but many UNIX types will have something like the afore-mentiond crt0 which does the setup.

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

Sidebar

Related Questions

Is there a command-line argument that would force firefox.exe to launch a new process
I'm trying to spawn a new process from my C++-project using fork-exec. I'm using
I read that node.js is single-threaded, so it doesn't fork a new process or
Lets say that I'm trying to create a new process with the following code:
I'm using VS2008 to debug an application that starts a new process. I believe
I created process and launched help-file Process help = new Process(); help.StartInfo.FileName = C:\MyProjects\comp\help_eng.hlp;
I want a script to start a new process, such that the new process
On Unix, we can create a new process with fork(); execvp(argv[0], argv); (with a
Is there any event when a new process is created. I'm writing a c#
I do not get why Unix has fork() for creating a new process. In

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.