<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/93581>93581</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc] add `quick_exit`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
michaelrj-google
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
michaelrj-google
</td>
</tr>
</table>
<pre>
The `quick_exit` function is defined in the C standard on page 382 of this PDF: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf
For this issue we'll skip `at_quick_exit`, it will be handled in a followup patch.
### Build System
In [entrypoints.txt](https://github.com/llvm/llvm-project/blob/main/libc/config/linux/x86_64/entrypoints.txt)
- [ ] Add the new function to the list of entrypoints for stdlib.h (you need to do this before it will build)
In [stdlib/CMakeLists.txt](https://github.com/llvm/llvm-project/blob/main/libc/src/stdlib/CMakeLists.txt)
- [ ] Add new entrypoint objects to the list
In [stdc.td](https://github.com/llvm/llvm-project/blob/main/libc/spec/stdc.td)
- [ ] Add the functions to the list of functions for unistd.h (this can be confusing, ask for help if you're stuck).
### Code
Rename existing `quick_exit`
- [ ] There is currently a function named `quick_exit` defined in [src/__support/OSUtil/quick_exit.h](https://github.com/llvm/llvm-project/blob/main/libc/src/__support/OSUtil/quick_exit.h) which should be put in the `LIBC_NAMESPACE::internal` namespace and renamed to just `exit`.
- [ ] Make sure to rename all of the `quick_exit` files and functions in the subfolders of `OSUtil`
Create `stdlib/quick_exit.h`
- [ ] look at [exit.h](https://github.com/llvm/llvm-project/blob/main/libc/src/stdlib/exit.h) for an example of how this should be laid out (copying the whole file and modifying it is fine).
Create `stdlib/quick_exit.cpp`
- [ ] Again, look at look at [exit.cpp](https://github.com/llvm/llvm-project/blob/main/libc/src/stdlib/exit.cpp) for an example.
### Testing
Create `test/src/stdlib/quick_exit_test.cpp`
- [ ] This should be based on [_Exit_test.cpp](https://github.com/llvm/llvm-project/blob/main/libc/test/src/stdlib/_Exit_test.cpp).
- [ ] That test should also be split into tests for `_Exit` and `exit` so either add a `TODO` or split it in this patch.
Add your tests to [test/src/stdlib/CMakeLists.txt](https://github.com/llvm/llvm-project/blob/main/libc/test/src/stdlib/CMakeLists.txt)
- [ ] Hopefully self-explanatory
Fixes #92977
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VttuIjkQ_RrzUgpq3EDDAw8EprUjzeyMdrLPyN2upp0Yu9eXAf5-VW4SCCF7kTJS1FFi1-WcU1Uu4b3aGsQFm9wzzneqbgVq93i3tXarkXHOJuuBiKG1bnF9OqisPC4eWgQ2zf6Kqn7a4EEFNs2giaYOyhpQHiQ2yqAEZSC0CCvwQRgpnARroBNbhHzGwTYQWuXh-7pk-RLaEDrP8iXjJePlfr8f2g7NnQ9yaN2W8fIx1CPGS19zThe2o3F_j_FS2tozXpqc82zYyYZla5Yt-29pXR9HeR8R9sh4oTX4J9URChE2r4AwvgIVYK-0hgqhFUbqHoqAxmpt97GDToS6HV5GYTzvf-A-Ki3hx9EH3F3e-GyATe7RBHfsrDLBD8MhsMma8dlr6FsV2lgNa7tjvNT65_Ovu87ZR6wD42WlbcV4uRPK0KGqasbL2ppGbdPfJh4YLw-z6WZKJF0H5fM-pTvKCNhkDUspk1QG92clg03_08oHEuvCCzTWgQ9Sq2rYAuOzo41gECXZSNvzXWFjHZ7JJF5eQl9y0jtivFx9FU_4RfmP58a79H0n0G0-iIszZrAVBfCXrNyEUg-D_NDUOzzlnjy_r92zbv5auPMByRaNop5KsiWdamGo0ql8oldmSx0g_FO63KLuQDVwtJHxwiH4EOsnxufvFP_KSrw8-QON2CHgQfmgzPbN2LjG8tAilYyHOjqHJugjtd1zQZIv-Xb0XIwbkiBJvdn42HXWEa3ffvwZlGa8PJsN24-vrn8Pyeewb1Xdgm9t1JJY72J4HpNsmn35fL_a_L78-unH9-XqE-WVL5UJ6IzQhJQI8J2oEYSR4LAnJFh4jD6QgxMlw2teqd7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