What part of the OS cares when we return 0 in C?

I understand we return 0 when a program execute successfully, but what components of the operating system, specifically Linux, actually recognize this status?

Attached: fuckingdork.jpg (2832x4240, 659K)

Other urls found in this thread:

dbp-consulting.com/tutorials/debugging/linuxProgramStartup.html
twitter.com/SFWRedditImages

It is used by calling programs.
korn shells and other things that check the return code before continuing or doing some cleanup.

Isn't Korn shell pretty much phased out, outside of legacy?

You can check the return code of any program in bash, too. It helps people build scripts decide what to do after a program finished executing, since they have to determine if it succeeded or failed some way

>I understand we return 0 when a program execute successfully,
Have fun with your boilerplate and weak ass type safety in your legacy language

Derivatives of it, like pdksh, are widely used and actively developed today
But that's beside the point, return codes are as old as Unix itself and all shells can use them

It just sets an enviroment variable that anything can look at. I use it a lot in scripting.

dbp-consulting.com/tutorials/debugging/linuxProgramStartup.html

Good luck writing a kernel in anything else (excluding assembly)

Also have fun with shitty language design choices

Cool man tell me about all these kernels you write on a daily basis at your job?

what language do you recommend for a hobbyist pleb tier brainlet?

any decent compiler will do it for you if you forget, btw

Haskell

I think the point he was trying to make had to do with the practical use of returning 0, not his personal use.

is that linustechtips?

No thats moot you fucking retard

truly an hero.
will be missed.
f


:DDDDDDDDDDDDDDDDd

The parent process uses the return code, although it's free to ignore it. It may be your shell, it may be init, it may be some other random process; it doesn't matter.

That's all I wanted to hear.

man 2 syscalls has the details

If you mean inside the kernel, no clue if it is used except when returning errors back to user space.

Linux is a kernel

Linux itself does actually handle return codes, but it does not interpret them.

It's just a convention.

It's so later on you can do something like this in a shell script:
if myprogram
then
# actions if the program was successful
else
# actions if the program failed
fi

systemd will treat any non-zero return as failed