Remove some problematic APIs

In order to improve our chances of success building other open source
projects we shouldn't define APIs that'll lead any ./configure script
astray. For example:

- brk() and sbrk() can break mac/windows support
- syscall() is a superb way to break portability
- arch_prctl() is the greatest of all horror shows
This commit is contained in:
Justine Tunney 2023-06-08 06:12:26 -07:00
parent 7512318a2a
commit 32682f0ce7
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
24 changed files with 37 additions and 919 deletions

View file

@ -16,8 +16,10 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "tool/plinko/lib/plinko.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/sigaction.h"
#include "libc/calls/syscall-sysv.internal.h"
#include "libc/errno.h"
#include "libc/intrin/likely.h"
#include "libc/intrin/strace.internal.h"
@ -43,7 +45,6 @@
#include "tool/plinko/lib/gc.h"
#include "tool/plinko/lib/histo.h"
#include "tool/plinko/lib/index.h"
#include "tool/plinko/lib/plinko.h"
#include "tool/plinko/lib/print.h"
#include "tool/plinko/lib/printf.h"
#include "tool/plinko/lib/stack.h"
@ -935,8 +936,8 @@ int Plinko(int argc, char *argv[]) {
}
}
if (arch_prctl(ARCH_SET_FS, 0x200000000000) == -1 ||
arch_prctl(ARCH_SET_GS, (intptr_t)DispatchPlan) == -1) {
if (sys_arch_prctl(ARCH_SET_FS, 0x200000000000) == -1 ||
sys_arch_prctl(ARCH_SET_GS, (intptr_t)DispatchPlan) == -1) {
fputs("error: ", stderr);
fputs(strerror(errno), stderr);
fputs("\nyour operating system doesn't allow you change both "