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.
This commit is contained in:
Jan Nieuwenhuizen 2019-08-24 19:05:58 +02:00
parent fd1109a25f
commit 58fb0cf764
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
7 changed files with 22 additions and 6 deletions

View file

@ -59,7 +59,7 @@ struct timespec
int clock_gettime (clockid_t clk_id, struct timespec *tp);
struct tm *localtime (time_t const *timep);
struct tm *gmtime (time_t const *time);
int mktime (struct tm *broken_time);
time_t mktime (struct tm *broken_time);
int nanosleep (struct timespec const *requested_time, struct timespec const *remaining);
time_t time (time_t * tloc);

View file

@ -19,6 +19,7 @@
*/
#include <mes/lib.h>
#include <errno.h>
#include <grp.h>
struct group *
@ -27,8 +28,13 @@ getgrgid (gid_t gid)
static int stub = 0;
if (__mes_debug () && !stub)
eputs ("getgrid stub\n");
static char *groups[2] = {"root", 0 };
static struct group root = {"root", 0, groups};
static char *groups[2] = { "root", 0 };
#if SYSTEM_LIBC
static struct group root = { "root", 0, 0 };
root.gr_mem = groups;
#else
static struct group root = { "root", 0, groups };
#endif
stub = 1;
errno = 0;
return &root;

View file

@ -19,6 +19,7 @@
*/
#include <mes/lib.h>
#include <errno.h>
#include <grp.h>
struct group *
@ -27,8 +28,13 @@ getgrnam (char const *name)
static int stub = 0;
if (__mes_debug () && !stub)
eputs ("getgrid stub\n");
static char *groups[2] = {"root", 0 };
static struct group root = {"root", 0, groups};
static char *groups[2] = { "root", 0 };
#if SYSTEM_LIBC
static struct group root = { "root", 0, 0 };
root.gr_mem = groups;
#else
static struct group root = { "root", 0, groups };
#endif
stub = 1;
errno = 0;
return &root;

View file

@ -19,6 +19,7 @@
*/
#include <mes/lib.h>
#include <errno.h>
#include <unistd.h>
int

View file

@ -19,6 +19,7 @@
*/
#include <mes/lib.h>
#include <errno.h>
#include <unistd.h>
pid_t

View file

@ -19,9 +19,10 @@
*/
#include <mes/lib.h>
#include <errno.h>
#include <time.h>
int
time_t
mktime (struct tm *broken_time)
{
static int stub = 0;

View file

@ -19,6 +19,7 @@
*/
#include <mes/lib.h>
#include <errno.h>
void
setgrent (void)