Port lib/libc/gen/t_siginfo to FreeBSD

- mcontext_t on FreeBSD doesn't have a __gregs field (it's split out on FreeBSD
into separate fields). In order to avoid muddying the test code with MD code,
the debugging trace info has not been implemented
- FreeBSD does not implement the si_stime and si_utime fields in siginfo_t, so
omit the debugging code that dumps the values
- sys/inttypes.h doesn't exist on FreeBSD

Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
Enji Cooper 2014-10-21 17:56:06 +00:00
parent e0912e08e4
commit 192a7b5f9e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=273389

View File

@ -29,7 +29,9 @@
#include <atf-c.h>
#include <atf-c/config.h>
#if defined(__NetBSD__)
#include <sys/inttypes.h>
#endif
#include <sys/resource.h>
#include <sys/sysctl.h>
#include <sys/time.h>
@ -86,9 +88,11 @@ sig_debug(int signo, siginfo_t *info, ucontext_t *ctx)
printf("uc_stack %p %lu 0x%x\n", ctx->uc_stack.ss_sp,
(unsigned long)ctx->uc_stack.ss_size,
ctx->uc_stack.ss_flags);
#if defined(__NetBSD__)
for (i = 0; i < __arraycount(ctx->uc_mcontext.__gregs); i++)
printf("uc_mcontext.greg[%d] 0x%lx\n", i,
(long)ctx->uc_mcontext.__gregs[i]);
#endif
}
}
@ -141,8 +145,10 @@ sigchild_action(int signo, siginfo_t *info, void *ptr)
printf("si_uid=%d\n", info->si_uid);
printf("si_pid=%d\n", info->si_pid);
printf("si_status=%d\n", info->si_status);
#if defined(__NetBSD__)
printf("si_utime=%lu\n", (unsigned long int)info->si_utime);
printf("si_stime=%lu\n", (unsigned long int)info->si_stime);
#endif
}
ATF_REQUIRE_EQ(info->si_code, code);
ATF_REQUIRE_EQ(info->si_signo, SIGCHLD);