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
Jan Nieuwenhuizen
093a8b0903
bootstrap: Build files only once.
...
* build-aux/bootstrap.sh.in: Build files only once.
2019-12-07 23:29:34 +01:00
Jan Nieuwenhuizen
b4b20d6ac4
build: Add mescc scaffold for regular build.
...
* lib/x86-mes-mescc/exit-42.S: New file.
* lib/x86-mes-mescc/hello-mes.S: New file.
* lib/x86_64-mes-mescc/exit-42.S: New file.
* lib/x86_64-mes-mescc/hello-mes.S: New file.
2019-12-06 19:53:50 +01:00
Jan Nieuwenhuizen
3de6450117
test: 90-abtod: Remove printf dependency. Fixes gcc.
...
* lib/tests/mes/90-abtod.stdout: Remove.
* lib/tests/mes/90-abtod.c (main): Remove printf.
2019-12-02 10:00:03 +01:00
Jan Nieuwenhuizen
35c97baaef
test: 90-readdir: Remove qsort dependency. Fixes tmpfs failures.
...
* lib/tests/dirent/90-readdir.c (check_seen): New function.
(main): Use it instead of qsort.
(qsort_strcmp): Remove.
2019-12-01 23:58:48 +01:00
Jan Nieuwenhuizen
2673d28e50
mescc: Mes C Library: Support gcc-4.6.4: Fix ctime stub.
...
* lib/stub/ctime.c (ctime): Fix stub to avoid segfault upon use.
2019-11-23 21:35:05 +01:00
Jan Nieuwenhuizen
5480c133ae
mescc: Mes C Library: Fix isatty for x86_64.
...
* lib/linux/ioctl.c (ioctl3): New function.
* include/sys/ioctl.h: Declare it.
* lib/posix/isatty.c (__tcgetattr): Use it.
2019-11-23 21:29:36 +01:00
Jan Nieuwenhuizen
0e55071bc7
mescc: Mes C Library: Support gcc-4.6.4: vfprintf, vsnprintf: pad with space.
...
* lib/stdio/vfprintf.c (vfprintf): pad with space.
* lib/stdio/vsnprintf.c (vsnprintf): pad with space.
2019-09-20 14:44:31 +02:00
Jan Nieuwenhuizen
98b9ac8e98
mescc: Mes C Library: Support gcc-4.6.4: Add math stubs.
...
* lib/math/ceil.c: New file.
* lib/math/floor.c: New file.
* lib/stub/atan2.c: New file.
* lib/stub/cos.c: New file.
* lib/stub/exp.c: New file.
* lib/stub/log.c: New file.
* lib/stub/modf.c: New file.
* lib/stub/pow.c: New file.
* lib/stub/sin.c: New file.
* lib/stub/sqrt.c: New file.
* lib/libc+gnu.c: Include them.
* include/math.h (atan2, ceil, cos, exp, fabs, floor, log, modf, pow,
sin, sqrt): Declare.
* lib/math/fabs.c: Update.
* lib/stub/ldexp.c: Update.
2019-09-13 15:11:38 +02:00
Jan Nieuwenhuizen
6bb225b403
mescc: Mes C Library: Support gcc-4.6.4: Add fscanf, vfscanf.
...
* lib/stdio/vfscanf.c: New file.
* lib/stdio/fscanf.c: New file.
* build-aux/configure-lib.sh (libc_gnu_SOURCES): Add them.
* include/stdio.h (fscanf): Declare.
* include/stdarg.h (vfscanf): Declare.
* lib/stub/fscanf.c: Remove.
2019-09-06 19:04:50 +02:00
Danny Milosavljevic
73715dab4a
Add missing #include.
...
* lib/stdlib/mbstowcs.c: Add missing #include.
2019-08-27 01:46:57 +02:00
Danny Milosavljevic
01ae1994ed
Fix dtoab.
...
* lib/mes/dtoab.c (dtoab): Fix it.
* lib/tests/mes/90-dtoab.c (main): Fix test.
* build-aux/check-mescc.sh (XFAIL_TESTS: Remove it.
2019-08-27 00:43:37 +02:00
Danny Milosavljevic
abc0809bfa
Add missing #include.
...
* lib/tests/mes/90-abtod.c (main): Add missing #include.
2019-08-27 04:32:02 +02:00
Danny Milosavljevic
4c77c2c9ca
Fix variable argument list traversal for doubles.
...
* include/stdarg.h (va_align): New macro.
(va_arg8): New macro.
* lib/stdio/vfprintf.c (vfprintf): Use it.
* lib/stdio/vsnprintf.c (vsnprintf): Use it.
2019-08-27 04:04:56 +02:00
Jan Nieuwenhuizen
58fb0cf764
build: Improve --with-system-libc support.
...
* build-aux/build-lib.sh: Avoid building libc for --with-system-libc.
Make libmes richer.
build-aux/check-mescc.sh: Enable 50-malloc test.
* include/dirstream.h: Use HAVE_DIRSTREAM_H to cater for non-existing
dirstream.h.
* include/grp.h[SYSTEM_LIBC]: Typo.
* include/mes/lib.h (__brk, __call_at_exit)[SYSTEM_LIBC]: Declare.
* include/stdlib.h (comparison_fn_t)[SYSTEM_LIBC]: Declare.
* include/time.h (mktime): Return time_t.
* lib/posix/isatty.c [SYSTEM_LIBC]: Do not (re)declare termios.
* lib/stub/mktime.c (mktime): Return time_t.
* lib/tests/scaffold/41-ternary.c (main): Remove assumption that
locals are initialized.
* lib/tests/scaffold/70-stdarg.c: Cater for SYSTEM_LIBC.
* lib/tests/setjmp/80-setjmp.c: Declare jmp buf.
* lib/*/*.c: Add missing mes/lib.h, errno.h includes.
2019-08-24 19:05:58 +02:00
Jan Nieuwenhuizen
fd1109a25f
mescc: Mes C Library: vfprintf, vsnprintf: Pad floats with space.
...
* lib/stdio/vfprintf.c (vfprintf): Pad floats with space.
* lib/stdio/vsnprintf.c (vsnprintf): Pad floats with space.
* lib/tests/stdio/90-sprintf.c: Test it.
2019-09-01 22:18:00 +02:00
Jan Nieuwenhuizen
f097a9d270
mescc: Mes C Library: vsscanf: Increase count for scanned float.
...
* lib/stdio/vsscanf.c (vsscanf): Increase count for scanned float.
2019-08-01 11:01:47 +02:00
Jan Nieuwenhuizen
de197a48f5
mescc: Mes C Library: Support GNU Tar: Fix getpwnam, getpwuid stubs.
...
* lib/stub/getpwnam.c (getpwnam): Return pointer to static struct
passwd.
* lib/stub/getpwuid.c (getpwuid): Likewise.
2019-07-31 12:25:43 +02:00
Jan Nieuwenhuizen
5c979a8ce1
mescc: Mes C Library: Support GNU Tar: Add getgrgid, getgrnam, setgrent stub.
...
* include/grp.h: New file.
* lib/stub/getgrgid.c: New file.
* lib/stub/getgrnam.c: New file.
* lib/stub/setgrent.c: New file.
* lib/libc+gnu.c: Include them.
2019-07-24 12:23:54 +02:00
Jan Nieuwenhuizen
9573f469f8
mescc: Mes C Library: Support GNU Awk: Add wchar_t.
...
* include/sys/types.h (wchar_t): New typedef.
2019-07-21 13:23:49 +02:00
Jan Nieuwenhuizen
fe96cc37df
mescc: Mes C Library: Support GNU Awk: Add getpgid, getpgrp stubs.
...
* include/unistd.h (getpgid, getpgrp): Declare.
* lib/stub/getpgid.c: New file.
* lib/stub/getpgrp.c: New file.
* lib/libc+gnu.c: Include them.
2019-07-18 12:13:18 +02:00
Jan Nieuwenhuizen
0d3f1ed2ae
mescc: Mes C Library: Support GNU Tar: Add mktime stub, fix localtime stub.
...
* include/time.h (mktime): Declare.
* lib/stub/mktime.c: New stub.
* lib/libc+gnu.c: Include it.
* lib/stub/localtime.c (localtime): Return pointer to static struct
tm. Avoids segfaults.
2019-07-15 11:58:21 +02:00
Jan Nieuwenhuizen
b97c59ff21
mescc: Mes C Library: Support GNU Tar: Add creat, mknod.
...
* include/linux/x86_64/syscall.h (SYS_mknod): New macro.
* include/linux/x86/syscall.h (SYS_mknod): New macro.
* lib/linux/mknod.c: New file.
* build-aux/configure-lib.sh (libc_gnu_SOURCES): Add it.
* include/sys/stat.h (mknod): Declare it.
* include/fcntl.h (creat): New macro.
2019-07-12 11:56:58 +02:00
Jan Nieuwenhuizen
8d45c6484f
mescc: Mes C Library: Support GNU Awk: Implement atof.
...
* lib/stdlib/atoi.c: Update.
* lib/stdlib/atof.c: Rename from stub/atof.c; Implement.
* lib/libc+gnu.c: Update include.
* lib/libg.c: Update include.
2019-07-03 11:22:57 +02:00
Jan Nieuwenhuizen
f3154aabe4
mescc: Mes C Library: Support GNU Awk: Add dtoab, %f in vfprintf, vsnprintf.
...
* include/libmes.h (dtoab): Declare.
* lib/mes/ntoab.c (ntoab): Update.
* lib/mes/dtoab.c: New file.
* build-aux/configure-lib.sh (libmes_SOURCES, libc_tcc_SOURCES): Add
it.
* lib/tests/mes/90-dtoab.c: Test it.
* lib/tests/stdio/90-sprintf.c: Test it.
* build-aux/check-mescc.sh (tests): Run it, against...
* lib/tests/mes/90-dtoab.stdout: ...baseline.
* lib/stdio/vfprintf.c (vfprintf): Support %f, even more naive support
for %e, %E, %g, %G.
* lib/stdio/vsnprintf.c (vsnprintf): Likewise.
2020-01-12 18:42:25 +01:00
Jan Nieuwenhuizen
742e88abd5
mescc: Mes C Library: Support GNU Awk: Add abtod, implementing strtod.
...
* include/libmes.h (abtod): Declare.
* lib/mes/abtod.c: New file.
* build-aux/configure-lib.sh (libmes_SOURCES, libc_tcc_SOURCES): Add
it.
* lib/mes/abtol.c: Update.
* lib/stdlib/strtod.c: Use it to implement; move from stub/strtod.
* lib/tests/mes/90-abtod.c: Test it.
* lib/tests/mes/90-abtod.stdout: Baseline.
* build-aux/check-mescc.sh (tests): Run it.
2019-06-25 12:51:44 +02:00
Jan Nieuwenhuizen
cd50beca3a
mescc: Mes C Library: Support GNU Awk: vsscanf: Support %f.
...
* lib/stdio/vsscanf.c (vsscanf): Support %f.
2019-06-22 11:48:39 +02:00
Jan Nieuwenhuizen
749248ac3a
mescc: Mes C Library: Support GNU Awk: Do not flush std files.
...
* lib/stdio/fflush.c (fflush): Do not flush std files.
2019-06-19 11:26:37 +02:00
Jan Nieuwenhuizen
9faa38bee1
mescc: Mes C Library: Support GNU Awk: Add isgraph.
...
* lib/ctype/isgraph.c: New file.
* lib/libc+gnu.c: Include it.
* include/ctype.h: Add missing prototypes.
2019-06-16 11:25:37 +02:00
Jan Nieuwenhuizen
9be33485e2
mescc: Mes C Library: Support GNU Tar: Add readlink, symlink.
...
* lib/linux/gnu.c (readlink, symlink): New function.
* include/unistd.h (readlink, symlink): Declare.
* include/linux/x86/syscall.h (SYS_readlink, SYS_symlink): New macro.
* include/linux/x86_64/syscall.h (SYS_symlink, SYS_readlink): New
macro.
2019-06-13 01:07:19 +02:00
Jan Nieuwenhuizen
4e6a3ce846
mescc: Mes C Library: Support GNU Tar: Add execlp.
...
* lib/posix/execl.c (vexec): New function.
(execl): Use it.
* lib/posix/execlp.c: New file.
* build-aux/configure-lib.sh (libc_tcc_SOURCES): Add it.
* lib/libc+gnu.c: Include it.
* include/unistd.h (execlp): Declare.
* lib/tests/posix/90-execlp.c: New file.
* lib/tests/posix/90-execlp.stdout: New file.
* build-aux/check-mescc.sh: Test it.
2019-06-10 00:56:42 +02:00
Jan Nieuwenhuizen
18195b4d05
mescc: Mes C Library: Fix compile warnings.
...
* include/stdlib.h (abort): Add prototype.
2019-06-12 15:59:06 +02:00
Jan Nieuwenhuizen
396e96c056
mescc: Mes C Library: Add missing stubs.
...
* build-aux/configure-lib.sh (libc_gnu_SOURCES): Add fscanf, rewind stubs.
* lib/stdio/freeopen.c: Remove.
2019-11-10 09:00:08 +01:00
Jan Nieuwenhuizen
3bed314d94
getopt: Remove old FSF address, thanks Vagrant.
...
* lib/posix/getopt.c: Remove old FSF address.
2019-09-09 16:04:15 +02:00
Danny Milosavljevic
15a39f0efe
Add missing #include.
...
* lib/tests/scaffold/55-char-array.c: Add missing #include.
2019-09-09 16:04:15 +02:00
Danny Milosavljevic
e2dfaef89e
Add missing #include.
...
* lib/tests/io/90-stat.c: Add missing #include.
2019-09-09 16:04:15 +02:00
Danny Milosavljevic
5f82a697b3
Add missing #include.
...
* lib/posix/getcwd.c: Add missing #include.
2019-09-09 16:04:15 +02:00
Jan Nieuwenhuizen
2db5ec2f55
signal: Use SA_RESTORER on x86-64.
...
* lib/linux/signal.c (signal)[x86_64]: Avoid segfault by setting
SA_RESTORER flag.
2019-09-09 16:04:15 +02:00
Danny Milosavljevic
23d857c834
signal: Add comment on why we don't use the restorer.
...
* lib/linux/signal.c: Add comment on why we don't use the restorer.
2019-09-09 16:04:15 +02:00
Danny Milosavljevic
4a183fa1cf
signal: Remove SA_SIGINFO.
...
* lib/linux/signal.c (signal): Remove SA_SIGINFO.
2019-09-09 16:04:15 +02:00
Danny Milosavljevic
3e6306a5ce
signal: Don't use custom restorer.
...
* lib/linux/signal.c (signal): Don't use custom restorer.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
02fdead244
signal: Use SA_SIGINFO (like glibc).
...
* lib/linux/signal.c (_restorer): Rename to...
(_restorer_for_siginfo): ...this.
(signal): Use it. Use SA_SIGINFO.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
e8bbe21499
signal: Make sure that the signal mask is actually unsigned long.
...
* lib/linux/signal.c (signal): Make sure that the signal mask is actually
unsigned long.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
5754e379af
Delete "__sigmask".
...
Follow-up to 6d95b89759d3c598fc84194429ae8c57249daa1a
* lib/linux/signal.c (__sigmask): Delete definition.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
3f1ba73fc7
Fix "struct sigaction" structure for rt_sigaction.
...
* include/signal.h (sigset_t): Increase size.
* lib/linux/signal.c (signal): Use new sigset_t.
2019-09-09 16:04:14 +02:00
Danny Milosavljevic
c7d050c0cd
tests: Fail early on nonexistent file.
...
* lib/tests/io/90-stat.c (main): Fail early on nonexistent file.
2019-09-09 16:04:13 +02:00
Danny Milosavljevic
5a2a00f4e8
open: Check flags, and use _open2 if applicable.
...
* lib/linux/open.c (open): Check flags; use _open2.
2019-09-09 16:04:13 +02:00
Danny Milosavljevic
3943155a64
ldiv: Make rem < 0 if a < 0.
...
* lib/mes/div.c (ldiv): Make rem < 0 if a < 0.
2019-09-09 16:04:13 +02:00