libc: silence noncritical dummy implementations

* isatty

  For the moment it is not possible to determine if the fd belongs to a
  tty. For whatever reasons, the check is done multiple times, e.g.
  'tclsh', which will spam the LOG.

* sysctl(HW_FLOATINGPT)

  FPU is enabled on all our platforms, so return true.

Fixes #3389.
This commit is contained in:
Josef Söntgen 2019-05-29 11:15:54 +02:00 committed by Christian Helmuth
parent dc8a2ec523
commit 6b48a08697
3 changed files with 29 additions and 7 deletions

View File

@ -79,8 +79,6 @@ while {true} {
}
set reference_output_arm {
Warning: missing sysctl for [6][10]
Warning: isatty: isatty not implemented
FLT_RADIX = 2
FLT_MANT_DIG = 24
DBL_MANT_DIG = 53
@ -772,7 +770,6 @@ pow(-2, -2) = 0.25
}
set reference_output_x86_64 {
Warning: isatty: isatty not implemented
FLT_RADIX = 2
FLT_MANT_DIG = 24
DBL_MANT_DIG = 53
@ -1464,7 +1461,6 @@ pow(-2, -2) = 0.25
}
set reference_output_x86_32 {
Warning: isatty: isatty not implemented
FLT_RADIX = 2
FLT_MANT_DIG = 24
DBL_MANT_DIG = 53

View File

@ -55,6 +55,7 @@ ret_type name args \
return ret_val; \
}
#define __SYS_DUMMY(ret_type, ret_val, name, args)\
extern "C" __attribute__((weak)) \
ret_type __sys_##name args \
@ -74,6 +75,23 @@ ret_type name args \
ret_type name args __attribute__((weak, alias("__sys_" #name))); \
#define __SYS_DUMMY_SILENT(ret_type, ret_val, name, args)\
extern "C" __attribute__((weak)) \
ret_type __sys_##name args \
{ \
errno = ENOSYS; \
return ret_val; \
} \
extern "C" __attribute__((weak)) \
ret_type __libc_##name args \
{ \
errno = ENOSYS; \
return ret_val; \
} \
ret_type _##name args __attribute__((weak, alias("__sys_" #name))); \
ret_type name args __attribute__((weak, alias("__sys_" #name))); \
DUMMY(int , -1, chroot, (const char *))
DUMMY(char *, 0, crypt, (const char *, const char *))
DUMMY(DB * , 0, dbopen, (const char *, int, int, DBTYPE, const void *))
@ -100,7 +118,7 @@ DUMMY(pid_t , -1, getpgrp, (void))
DUMMY(int , -1, getpriority, (int, int))
DUMMY(int , -1, getrusage, (int, rusage *))
DUMMY(uid_t , 0, getuid, (void))
DUMMY(int , 1, isatty, (int))
DUMMY_SILENT(int , 1, isatty, (int))
DUMMY(int , -1, kill, (pid_t, int))
DUMMY(int , -1, link, (const char *, const char *))
DUMMY(int , 0, minherit, (void *, size_t, int))
@ -117,7 +135,7 @@ DUMMY(int , -1, sched_setparam, (pid_t, const sched_param *))
DUMMY(int , -1, sched_setscheduler, (pid_t, int, const sched_param *))
DUMMY(int , -1, sched_yield, (void))
DUMMY(int , -1, __semctl, (void))
DUMMY(sig_t, SIG_ERR, signal, (int, sig_t));
DUMMY_SILENT(sig_t, SIG_ERR, signal, (int, sig_t));
DUMMY(int , -1, setegid, (uid_t))
DUMMY(int , -1, seteuid, (uid_t))
DUMMY(int , -1, setgid, (gid_t))
@ -181,7 +199,7 @@ __SYS_DUMMY(int, -1, truncate, (const char *, off_t))
DUMMY(int, -1, sigblock, (int))
DUMMY(int, -1, thr_kill2, (pid_t pid, long id, int sig));
__SYS_DUMMY(int, -1, sigaction, (int, const struct sigaction *, struct sigaction *));
__SYS_DUMMY_SILENT(int, -1, sigaction, (int, const struct sigaction *, struct sigaction *));
__SYS_DUMMY(int, -1, sigsuspend, (const sigset_t *))
__SYS_DUMMY(int, -1, sigtimedwait, (const sigset_t *, siginfo_t *, const struct timespec *));
__SYS_DUMMY(int, -1, sigwaitinfo, (const sigset_t *, siginfo_t *));

View File

@ -100,6 +100,14 @@ extern "C" int __sysctl(const int *name, u_int namelen,
*(int*)oldp = (int)PAGESIZE;
*oldlenp = sizeof(int);
return 0;
/*
* Used on ARM platforms to check HW fp support. Since the
* FP is enabled on all our ARM platforms we return true.
*/
case HW_FLOATINGPT:
*(int*)oldp = 1;
*oldlenp = sizeof(int);
return 0;
} break;