Commit Graph

7 Commits

Author SHA1 Message Date
Jan (janneke) Nieuwenhuizen bc1fa57851
lib: stat: Use SYS_stat64 for 32bit platforms.
This fixes <https://debbugs.gnu.org/41264>.

* include/linux/arm/syscall.h (SYS_stat64, SYS_lstat64,
SYS_fstat64)[__SIZEOF_LONG_LONG__ == 8]:
New defines.
(SYS_stat, SYS_lstat, SYS_fstat)[__SIZEOF_LONG_LONG__ == 8]: Redefine them.
* include/linux/x86/syscall.h (SYS_stat64, SYS_lstat64,
SYS_fstat64)[__SIZEOF_LONG_LONG__ == 8]:
New defines.
(SYS_stat, SYS_lstat, SYS_fstat)[__SIZEOF_LONG_LONG__ == 8]: Redefine them.
* include/sys/stat.h (struct stat): Move definition to...
* include/linux/arm/kernel-stat.h,
include/linux/m2/kernel-stat.h,
include/linux/x86/kernel-stat.h,
include/linux/x86_64/kernel-stat.h: These new files.
* include/gnu/x86/kernel-stat.h: New file.
* configure (main): Copy <srcdest>include/<kernel>/<arch>/*.h to
include/.
* configure.sh: Likewise.
* .gitignore: Ignore them.  Add copyright header.
* build-aux/GNUmakefile.in (X86_ARCH_HEADERS, ARCH_HEADERS): New
variables.
(build): Use them.
(include/arch/%.h, arch-dir): New targets.
* build-aux/bootstrap.sh.in (AM_CPPFLAGS): Replace
<srcdest>include/<kernel>/<cpu> with built ../include.
* build-aux/build.sh.in (AM_CPPFLAGS): Likewise.
* build-aux/install.sh.in: Also install built include.
* include/m2/types.h: New file.
* kaem.run: Use it.
* simple.sh: Copy kernel-stat.h, syscall.h for kernel/cpu to
include/arch.
2022-10-29 13:17:58 +02:00
Jan Nieuwenhuizen 9b0009a888
hurd: Add malloc.
* include/gnu/syscall.h (__vm_allocate): New value.
(__vm_allocate): Declare.
* lib/gnu/malloc.c: New file.
* lib/stdlib/malloc.c[__GNU__]: Disable.  See FIXME.
* lib/gnu/vm-allocate.c: New file.
* build-aux/configure-lib.sh (libc_SOURCES): Add it.
2019-12-13 21:52:31 +01:00
Jan Nieuwenhuizen 89945751d9
hurd: Add open.
* include/fcntl.h (O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_APPEND,
O_TRUNC)[__GNU__]: Specialize for GNU.
* lib/gnu/dir-lookup.c: New file.
* lib/stdio/fopen.c (fopen): Use O_RDONLY.
* lib/tests/posix/50-open-read.c (main): Likewise.
* lib/tests/stdio/90-fseek.c (main): Likewise.
* include/gnu/syscall.h (SYS__dir_lookup): New value.
* lib/gnu/_open3.c: New file.
* build-aux/configure-lib.sh (libc_SOURCES): Build them.
2019-12-13 21:52:30 +01:00
Jan Nieuwenhuizen 67d82a6de5
hurd: Add argv and environ.
* include/gnu/hurd.h (struct hurd_startup_data): Add argp, envp.
* lib/gnu/hurd-start.c (__argv, __env): Define them.
* lib/gnu/exec-startup-get-data.c (mach_startup_info2hurd_startup_data):
Set them.
* lib/gnu/x86-mes-gcc/crt1.c (_start): Use them.
* build-aux/configure-lib.sh (libc_mini_SOURCES): Add argz-extract.c.
* include/argz.h: Build fix.
* lib/string/argz-count.c: Likewise.
* lib/string/argz-extract.c: Likewise.
2019-12-13 21:52:30 +01:00
Jan Nieuwenhuizen 6d3b9b687d
hurd: Add _read.
* include/gnu/hurd.h (fd_read): Declare.
* include/gnu/syscall.h (SYS__io_read): New value.
* lib/gnu/_read.c: New file.
* lib/gnu/fd-read.c: New file.
* lib/gnu/io-read.c: New file.
* build-aux/configure-lib.sh (libc_SOURCES): Add _read sources.
2019-12-13 21:52:30 +01:00
Jan Nieuwenhuizen db4a202c6b
hurd: Add _write.
* include/gnu/syscall.h (SYS__io_write): Add enum field.
(_hurd_dtable, _hurd_dtable_size): Declare variable.
(fd_get, fd_write, __io_write, __syscall_put): Declare.
* lib/gnu/hurd-start.c (_hurd_dtable, _hurd_dtable_size): Define
variable.
* lib/gnu/_write.c: New file.
* lib/gnu/fd-get.c (fd_get): New file.
* lib/gnu/fd-write.c (fd_write): New file.
* lib/gnu/io-write.c: New file.
* lib/gnu/syscall.c (__syscall_put): New function.
* build-aux/cofnigure-lib.sh (libc_mini_SOURCES): Add write sources.
* lib/tests/mes/30-oputs.c (main): Update.
* lib/tests/mes/30-oputs.stdout: New file.
* lib/tests/mes/30-eputs.c: New test.
* lib/tests/mes/30-eputs.stderr: New file.
* build-aux/check-mescc.sh (TESTS): Add it.
2019-12-13 21:52:30 +01:00
Jan Nieuwenhuizen 784838e368
hurd: Initial support.
This adds minimal Hurd support by implementing the _exit function.

* AUTHORS: Update.
* .gitignore: Ignore a.out, core, .config.
* include/sys/wait.h (W_EXITCODE): New define.
* lib/gnu/x86-mes-gcc/crt1.c: New file.
* lib/gnu/x86-mes-gcc/mini.c: New file.
* lib/gnu/hurd-start.c: New file.
* lib/gnu/_exit.c: New file.
* include/gnu/syscall.h: New file.
* include/gnu/hurd.h: New file.
* lib/gnu/_exit.c: New file.
* lib/gnu/exec-startup-get-data.c: New file.
* lib/gnu/hurd-start.c: New file.
* lib/gnu/proc-mark-exit.c: New file.
* lib/gnu/syscall.c: New file.
* lib/gnu/task-get-special-port.c: New file.
* lib/gnu/task-terminate.c: New file.
* lib/gnu/vm-statistics.c: New file.
* build-aux/configure-lib.sh (libc_mini_SOURCES): Add Hurd sources.
* build-aux/build.sh.in (CPPFLAGS): Add lib to includes, to find linux
crt1.c.
* build-aux/test-c.sh: Always use at least -l c+mini for GNU.
* lib/tests/scaffold/30-exit-42.exit: New file.
* lib/tests/scaffold/30-exit-42.c: New test.
* build-aux/check-mescc.sh (TESTS): Add it.
* lib/tests/scaffold/30-exit-0.c (main): Move from 00-exit-0.c; Rewrite,
use _exit.
* include/gnu/hurd-types.h: Import from GNU C Library.
* include/mach/mach-init.h: Likewise.
* lib/mach/mach-init.c: Likewise.
* lib/mach/mach_host_self.S: Likewise.
* lib/mach/mach_msg_trap.S: Likewise.
* lib/mach/mach_reply_port.S: Likewise.
* lib/mach/mach_task_self.S: Likewise.
* lib/mach/mach_thread_self.S: Likewise.
* lib/mach/msg.c: Likewise.
2019-12-13 21:52:29 +01:00