I am studying C and Operating system, during which i came across the system call exit() in *nix systems. 
I know there will be wrapper procedure call in C for each of the system call in *nix systems. In this case, exit() is the procedure call provided in the standard C library, let us consider glibc for the discussion. 
I have downloaded the glibc code and checked the code inside exit() it finally makes a call to _exit().
where can i find the function body of _exit()?
In library glibc, would the function _exit() be making a system call exit() in case of UNIX and ExitProcess() in case of Windows, based on the operating system? 
            Asked
            
        
        
            Active
            
        
            Viewed 201 times
        
    1
            
            
         
    
    
        Darshan L
        
- 824
- 8
- 30
- 
                    Did you try checking "Termination Internals" section? Here [is the link](https://www.gnu.org/software/libc/manual/html_node/Termination-Internals.html) – Ketan Mukadam Jan 13 '18 at 13:11
- 
                    It does not explain my question, though. I want to understand whether _exit () would call different system calls based on the operating system. exit () in case of Unix OS and ExitProcess () in case of windows? – Darshan L Jan 13 '18 at 13:35
- 
                    1The answer is yes. See this [SO answer](https://stackoverflow.com/questions/46903180/syscall-implementation-of-exit) – Ketan Mukadam Jan 13 '18 at 14:27
- 
                    *exit () in case of Unix OS* On Solaris, [the system call may be called `exit`, but it calls `rexit()`](http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/os/sysent.c#437) and thus shows up in dTrace as `rexit`. Unless you're actually doing *direct system calls* (and even if you use the `syscall()` **function** you are not doing actual system calls...) you're making function calls. How your code's *function* calls map to actual system calls isn't as direct as those who break `libc.so` into "functions" and "aystem calls" would lead you to believe. It's all very platform-specific – Andrew Henle Jan 13 '18 at 14:28
- 
                    Where to check function definition for _exit ()? I don't see it under exit.c file – Darshan L Jan 14 '18 at 12:53