mes/lib/linux/waitpid.c

41 lines
1.3 KiB
C
Raw Normal View History

/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
kaem.run: Remove --bootstrap-mode. * include/linux/arm/syscall.h, include/linux/x86/syscall.h, include/mes/constants.h: Remove CONSTANTs. * lib/m2/open.c: Move to... * lib/linux/open.c: ...here. Update to make gcc-compatible. * scaffold/argv.kaem: Update accordingly. * lib/linux/lseek.c (_leek, lseek): Suport M2-Planet. * lib/linux/_open3.c (_open3): Fix cast. * lib/linux/waitpid.c (waitpid): Suport M2-Planet. * lib/m2/getcwd.c (PATH_MAX): Remove CONSTANT. * lib/m2/isatty.c (TCGETS): Remove CONSTANT. * lib/mes/ntoab.c: Support M2-Planet. * lib/posix/getcwd.c (__getcwd_buf): Remove. * lib/posix/getenv.c (M2_PTR_SIZE)[__M2__]: Update to #define. * lib/posix/setenv.c: Likewise. * lib/stub/__raise.c (SIGABRT): Remove CONSTANT. * src/core.c (error): Use __M2__ instead of __M2_PLANET__. * src/gc.c (M2_CELL_SIZE)[__M2__]: Update to #define. Support non-bootstrap-mode. * src/symbol.c: Likewise. * src/vector.c: Likewise. * src/posix.c: Likewise. (__raise): Move to... * include/mes/lib-cc.h (__raise): ...this new file to avoid M2-Planet crash. * include/sys/types.h: Include it. * lib/mes/div.c (__raise): Remove prototype. [__TINYC__ || SYSTEM_LIBC] (__raise): Remove macro. * include/mes/lib.h (__raise)[SYSTEM_LIBC]: Remove prototype. * kaem.run: Remove --botstrap-mode. Update source list accordingly. * simple.make (M2_PLANET_FLAGS): Remove --bootstrap-mode. * simple.make (M2_SOURCES, M2_PLANET_INCLUDES): Update source list accordingly. * include/sys/types.h (EOF): Move to... * include/mes/lib-cccc.h (EOF): ...here, and... * include/m2/types.h (EOF): ...here, to avoid M2-Planet crash.
2022-11-14 04:25:55 +00:00
* Copyright © 2016,2017,2018,2019,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
* GNU Mes is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* GNU Mes is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mes/lib.h>
build: Simplify. core: Make mes src/ c files separate compilation units. * include/mes/constants.h: New file. * include/mes/macros.h: New file. * include/mes/mes.h: New file. * src/gc.c: Update. * src/hash.c: Update. * src/lib.c: Update. * src/math.c: Update. * src/mes.c: Update. * src/module.c: Update. * src/posix.c: Update. * src/reader.c: Update. * src/string.c: Update. * src/struct.c: Update. * src/vector.c: Update. mes: Update datadir. * src/mes.c (g_datadir): New global. (open_boot): Rename from read_boot. (read_boot): New function. * mes/module/mes/boot-0.scm: Move from boot-0.scm.in * configure: Update. * configure.sh: Update. mescc: Create libraries from separate files. * .gitignore: Update. * build-aux/bootstrap-mes.sh: Remove. * build-aux/bootstrap.sh.in: Remove. * build-aux/build-guile.sh: Update. * build-aux/build-mes.sh: Update. * build-aux/build-scaffold.sh: New file. * build-aux/build.sh.in: Update. * build-aux/cc.sh: Update. * build-aux/check-tcc.sh: Remove. * build-aux/config.sh.in: New file. * build-aux/config.sh: Remove. * build-aux/install.sh.in: Update. * build-aux/test-boot.sh: New file. * build-aux/test-c.sh: New file. * build-aux/test-driver: New file. * build-aux/test-suite.sh: New file. * build-aux/trace.sh: Update. * build-aux/uninstall.sh.in: Update. * configure: Update. * configure.sh: Update. * lib/linux/x86-mes-mescc/crt1.c: Move from lib/linux/x86-mes. * lib/linux/x86-mes-mescc/mini.c: Likewise. * lib/linux/x86_64-mes-mescc/crt1.c: Move from lib/linux/x86_64-mes. * lib/linux/x86_64-mes-mescc/mini.c: Likewise. * lib/linux/x86-mes-gcc/syscall.c: Rename from mes.c. * lib/linux/x86-mes-mescc/syscall.c: Likewise. * lib/linux/x86_64-mes-gcc/syscall.c: Likewise. * lib/linux/x86_64-mes-mescc/syscall.c: Likewise. * lib/mes/mes_open.c: Include config.h. * lib/tests/stdio/70-printf-hello.c: Likewise. * lib/tests/stdio/70-printf-simple.c: Likewise. * scaffold/gc-test.sh: New file. * simple.sh: Update.
2019-06-08 14:36:22 +01:00
#include <linux/syscall.h>
#include <arch/syscall.h>
build: Simplify. core: Make mes src/ c files separate compilation units. * include/mes/constants.h: New file. * include/mes/macros.h: New file. * include/mes/mes.h: New file. * src/gc.c: Update. * src/hash.c: Update. * src/lib.c: Update. * src/math.c: Update. * src/mes.c: Update. * src/module.c: Update. * src/posix.c: Update. * src/reader.c: Update. * src/string.c: Update. * src/struct.c: Update. * src/vector.c: Update. mes: Update datadir. * src/mes.c (g_datadir): New global. (open_boot): Rename from read_boot. (read_boot): New function. * mes/module/mes/boot-0.scm: Move from boot-0.scm.in * configure: Update. * configure.sh: Update. mescc: Create libraries from separate files. * .gitignore: Update. * build-aux/bootstrap-mes.sh: Remove. * build-aux/bootstrap.sh.in: Remove. * build-aux/build-guile.sh: Update. * build-aux/build-mes.sh: Update. * build-aux/build-scaffold.sh: New file. * build-aux/build.sh.in: Update. * build-aux/cc.sh: Update. * build-aux/check-tcc.sh: Remove. * build-aux/config.sh.in: New file. * build-aux/config.sh: Remove. * build-aux/install.sh.in: Update. * build-aux/test-boot.sh: New file. * build-aux/test-c.sh: New file. * build-aux/test-driver: New file. * build-aux/test-suite.sh: New file. * build-aux/trace.sh: Update. * build-aux/uninstall.sh.in: Update. * configure: Update. * configure.sh: Update. * lib/linux/x86-mes-mescc/crt1.c: Move from lib/linux/x86-mes. * lib/linux/x86-mes-mescc/mini.c: Likewise. * lib/linux/x86_64-mes-mescc/crt1.c: Move from lib/linux/x86_64-mes. * lib/linux/x86_64-mes-mescc/mini.c: Likewise. * lib/linux/x86-mes-gcc/syscall.c: Rename from mes.c. * lib/linux/x86-mes-mescc/syscall.c: Likewise. * lib/linux/x86_64-mes-gcc/syscall.c: Likewise. * lib/linux/x86_64-mes-mescc/syscall.c: Likewise. * lib/mes/mes_open.c: Include config.h. * lib/tests/stdio/70-printf-hello.c: Likewise. * lib/tests/stdio/70-printf-simple.c: Likewise. * scaffold/gc-test.sh: New file. * simple.sh: Update.
2019-06-08 14:36:22 +01:00
#include <sys/types.h>
#include <sys/wait.h>
build: Simplify. core: Make mes src/ c files separate compilation units. * include/mes/constants.h: New file. * include/mes/macros.h: New file. * include/mes/mes.h: New file. * src/gc.c: Update. * src/hash.c: Update. * src/lib.c: Update. * src/math.c: Update. * src/mes.c: Update. * src/module.c: Update. * src/posix.c: Update. * src/reader.c: Update. * src/string.c: Update. * src/struct.c: Update. * src/vector.c: Update. mes: Update datadir. * src/mes.c (g_datadir): New global. (open_boot): Rename from read_boot. (read_boot): New function. * mes/module/mes/boot-0.scm: Move from boot-0.scm.in * configure: Update. * configure.sh: Update. mescc: Create libraries from separate files. * .gitignore: Update. * build-aux/bootstrap-mes.sh: Remove. * build-aux/bootstrap.sh.in: Remove. * build-aux/build-guile.sh: Update. * build-aux/build-mes.sh: Update. * build-aux/build-scaffold.sh: New file. * build-aux/build.sh.in: Update. * build-aux/cc.sh: Update. * build-aux/check-tcc.sh: Remove. * build-aux/config.sh.in: New file. * build-aux/config.sh: Remove. * build-aux/install.sh.in: Update. * build-aux/test-boot.sh: New file. * build-aux/test-c.sh: New file. * build-aux/test-driver: New file. * build-aux/test-suite.sh: New file. * build-aux/trace.sh: Update. * build-aux/uninstall.sh.in: Update. * configure: Update. * configure.sh: Update. * lib/linux/x86-mes-mescc/crt1.c: Move from lib/linux/x86-mes. * lib/linux/x86-mes-mescc/mini.c: Likewise. * lib/linux/x86_64-mes-mescc/crt1.c: Move from lib/linux/x86_64-mes. * lib/linux/x86_64-mes-mescc/mini.c: Likewise. * lib/linux/x86-mes-gcc/syscall.c: Rename from mes.c. * lib/linux/x86-mes-mescc/syscall.c: Likewise. * lib/linux/x86_64-mes-gcc/syscall.c: Likewise. * lib/linux/x86_64-mes-mescc/syscall.c: Likewise. * lib/mes/mes_open.c: Include config.h. * lib/tests/stdio/70-printf-hello.c: Likewise. * lib/tests/stdio/70-printf-simple.c: Likewise. * scaffold/gc-test.sh: New file. * simple.sh: Update.
2019-06-08 14:36:22 +01:00
pid_t
waitpid (pid_t pid, int *status_ptr, int options)
{
kaem.run: Remove --bootstrap-mode. * include/linux/arm/syscall.h, include/linux/x86/syscall.h, include/mes/constants.h: Remove CONSTANTs. * lib/m2/open.c: Move to... * lib/linux/open.c: ...here. Update to make gcc-compatible. * scaffold/argv.kaem: Update accordingly. * lib/linux/lseek.c (_leek, lseek): Suport M2-Planet. * lib/linux/_open3.c (_open3): Fix cast. * lib/linux/waitpid.c (waitpid): Suport M2-Planet. * lib/m2/getcwd.c (PATH_MAX): Remove CONSTANT. * lib/m2/isatty.c (TCGETS): Remove CONSTANT. * lib/mes/ntoab.c: Support M2-Planet. * lib/posix/getcwd.c (__getcwd_buf): Remove. * lib/posix/getenv.c (M2_PTR_SIZE)[__M2__]: Update to #define. * lib/posix/setenv.c: Likewise. * lib/stub/__raise.c (SIGABRT): Remove CONSTANT. * src/core.c (error): Use __M2__ instead of __M2_PLANET__. * src/gc.c (M2_CELL_SIZE)[__M2__]: Update to #define. Support non-bootstrap-mode. * src/symbol.c: Likewise. * src/vector.c: Likewise. * src/posix.c: Likewise. (__raise): Move to... * include/mes/lib-cc.h (__raise): ...this new file to avoid M2-Planet crash. * include/sys/types.h: Include it. * lib/mes/div.c (__raise): Remove prototype. [__TINYC__ || SYSTEM_LIBC] (__raise): Remove macro. * include/mes/lib.h (__raise)[SYSTEM_LIBC]: Remove prototype. * kaem.run: Remove --botstrap-mode. Update source list accordingly. * simple.make (M2_PLANET_FLAGS): Remove --bootstrap-mode. * simple.make (M2_SOURCES, M2_PLANET_INCLUDES): Update source list accordingly. * include/sys/types.h (EOF): Move to... * include/mes/lib-cccc.h (EOF): ...here, and... * include/m2/types.h (EOF): ...here, to avoid M2-Planet crash.
2022-11-14 04:25:55 +00:00
long long_pid = pid;
long long_status_ptr = cast_voidp_to_long (status_ptr);
long long_options = options;
#if defined (SYS_waitpid)
kaem.run: Remove --bootstrap-mode. * include/linux/arm/syscall.h, include/linux/x86/syscall.h, include/mes/constants.h: Remove CONSTANTs. * lib/m2/open.c: Move to... * lib/linux/open.c: ...here. Update to make gcc-compatible. * scaffold/argv.kaem: Update accordingly. * lib/linux/lseek.c (_leek, lseek): Suport M2-Planet. * lib/linux/_open3.c (_open3): Fix cast. * lib/linux/waitpid.c (waitpid): Suport M2-Planet. * lib/m2/getcwd.c (PATH_MAX): Remove CONSTANT. * lib/m2/isatty.c (TCGETS): Remove CONSTANT. * lib/mes/ntoab.c: Support M2-Planet. * lib/posix/getcwd.c (__getcwd_buf): Remove. * lib/posix/getenv.c (M2_PTR_SIZE)[__M2__]: Update to #define. * lib/posix/setenv.c: Likewise. * lib/stub/__raise.c (SIGABRT): Remove CONSTANT. * src/core.c (error): Use __M2__ instead of __M2_PLANET__. * src/gc.c (M2_CELL_SIZE)[__M2__]: Update to #define. Support non-bootstrap-mode. * src/symbol.c: Likewise. * src/vector.c: Likewise. * src/posix.c: Likewise. (__raise): Move to... * include/mes/lib-cc.h (__raise): ...this new file to avoid M2-Planet crash. * include/sys/types.h: Include it. * lib/mes/div.c (__raise): Remove prototype. [__TINYC__ || SYSTEM_LIBC] (__raise): Remove macro. * include/mes/lib.h (__raise)[SYSTEM_LIBC]: Remove prototype. * kaem.run: Remove --botstrap-mode. Update source list accordingly. * simple.make (M2_PLANET_FLAGS): Remove --bootstrap-mode. * simple.make (M2_SOURCES, M2_PLANET_INCLUDES): Update source list accordingly. * include/sys/types.h (EOF): Move to... * include/mes/lib-cccc.h (EOF): ...here, and... * include/m2/types.h (EOF): ...here, to avoid M2-Planet crash.
2022-11-14 04:25:55 +00:00
return _sys_call3 (SYS_waitpid, long_pid, long_status_ptr, long_options);
#elif defined (SYS_wait4)
return wait4 (pid, status_ptr, options, 0);
#else
#error arch not supported
#endif
}