At the moment this test does nothing except reports failure from td_open()
for overloaded (implemented) dummy1_proc_lookup() (.proc_lookup from
td_proc_callbacks_t) of the following form:
static int
dummy1_proc_lookup(void *arg, const char *sym, caddr_t *addr)
{
return TD_ERR_ERR;
}
This file and directory with tests is placeholder for new ones, without
further need to alter mtree and distribution sets.
The libpthread_dbg interface and library is used by gdb(1) to handle
threads in applications.
Sponsored by <The NetBSD Foundation>
Move out wait(2) specific tests from t_ptrace and put them to t_ptrace_wait
Add generic code fragments to reuse the same source-code for every member
of the wait(2) family, namely:
- wait(2)
- waitpid(2)
- waitid(2)
- wait3(2)
- wait4(2)
- wait6(2)
Currently in the new test-suite there are the following tests:
- traceme1
- traceme2
- traceme3
- traceme4
- attach1
Not all tests are possible to be executed against every wait(2)-like
interface, therefore they will be disabled in such case. Currently this
limits attach1 to waitpid(2), waitid(2), wait4(2), wait6(2), while the
other tests (traceme 1-4) run with all of the interfaces.
The construct of this file is dedicated for addition of new tests in the
close future.
As of now all of the tests pass correctly.
Thanks for Robert Elz for suggestions on improving the code (earlier draft
of this new form).
Sponsored by <The NetBSD Foundation>.
The t_wait_noproc test checks whether wait(2)-family of functions return
error and set ECHILD for lack of childs.
The t_wait_noproc_wnohang adds to options (except wait(2), wait3(2)) new
parameter WNOHANG and verifies that error is still signaled and errno set
to ECHILD.
Currently t_wait_noproc_wnohang reports failures, these have been marked as
expected and referenced to PR standards/51606.
The problem report is authored by Robert Elz, and the initial regression
has been notified by Nicolas Joly.
Remove redundant test in tests/lib/libc/sys/t_wait for wait6(2) with no
WNOHANG specified.
Sponsored by <The NetBSD Foundation>.
This test is a placeholder for further checks of the native ptrace(2)
function calls.
XXX: Is it safe to call ATF functions from a child? FreeBSD seems to
construct dedicated asserts for them.
XXX: printf(3) calls from a child are not intercepted by atf-run(1)
Sponsored by <The NetBSD Foundation>.
This test is a clone on t_mutex with additional two tests for timed-mutex
specific block.
All simple-mutex (not with the timed property according to the C11 wording)
specific tests are covered by pthread_mutex_timedlock(3) with parameter
ts_lengthy of sufficiently large tv_sec value (right now UINT16_MAX). If,
a test will hang, it won't wait UINT16_MAX seconds, but will be terminated
within the default timeout for ATF tests (right now 300 [sec] in my
NetBSD/amd64 setup).
This test was inspired by a classic selflock test failure of
pthread_mutex_timedlock(3) of the following form:
#include <assert.h>
#include <errno.h>
#include <pthread.h>
#include <stdio.h>
#include <time.h>
int main(int argc, char **argv)
{
pthread_mutex_t mtx;
struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 1000;
printf("ts{.tv_sec = %d, .tv_nsec=%ld}\n", ts.tv_sec, ts.tv_nsec);
fflush(stdout);
printf("mtx_init\n");
assert(pthread_mutex_init(&mtx, NULL) == 0);
printf("mtx_lock\n");
assert(pthread_mutex_lock(&mtx) == 0);
printf("mtx_timedlock\n");
assert(pthread_mutex_timedlock(&mtx, &ts) == ETIMEDOUT);
printf("mtx_unlock\n");
assert(pthread_mutex_unlock(&mtx) == 0);
printf("mtx_destroy\n");
assert(pthread_mutex_destroy(&mtx) == 0);
return 0;
}
Current NetBSD implementation wrongly hangs on this test.
The issue was detected during development of the C11 portable threads.
My local tests in chroot presents that the are further issues:
t_timedmutex (21/25): 10 test cases
mutex1: [0.001142s] Failed: /usr/src/tests/lib/libpthread/t_timedmutex.c:75: *param != 20
mutex2: [0.261499s] Passed.
mutex3: [0.261496s] Passed.
mutex4: [0.001204s] Failed: /usr/src/tests/lib/libpthread/t_timedmutex.c:265: pthread_mutex_timedlock(&mutex, &ts_lengthy): Connection timed out
mutex5: [0.001235s] Failed: /usr/src/tests/lib/libpthread/t_timedmutex.c:337: pthread_mutex_timedlock(&mutex5, &ts_lengthy): Connection timed out
mutex6: [21.218497s] Failed: /usr/src/tests/lib/libpthread/t_timedmutex.c:512: start != 1
mutexattr1: [0.001328s] Passed.
mutexattr2: [0.001175s] Passed.
timedmutex1: [301.119397s] Failed: Test case timed out after 300 seconds
timedmutex2: [301.123081s] Failed: Test case timed out after 300 seconds
[623.990659s]
I'm also receiveing the same failure in the mutex6 test in t_mutex, so
there might be a false positives due to local chroot(8) issues.
Commit approved by <christos>.
The wcsnlen(3) function conforms to POSIX.1-2008 and is an addition to the
ISO C standard.
size_t wcsnlen(const wchar_t *s, size_t maxlen);
The wcsnlen(3) function computes the number of wide-characters in a wide-
-string to which s points, not including NULL terminating wide-character
code and checking no more than maxlen wide-characters. This function never
examines wide-characters beyond a wide-string of maxlen size.
This function is a safer version of wcslen(3):
size_t wcslen(const wchar_t *s);
Update STANDARDS section of wmemchr(3) describing wide-character functions.
These changes conforms to the C11 standard
References:
- 7.27.1/3 Components of time (struct timespec)
- 7.27.2.5 The timespec_get function
According to ISO/IEC 9899:201x (draft) <time.h> defines the timespec
structure and declares the timespec_get(3) function with TIME_UTC
definition.
According to a C++17 standard draft <ctime> offers the same interface in
the std:: namespace.
The timespec_get function modifies the timespec object pointed by ts
to hold the current calendar time in the given base. The standard notes
only the TIME_UTC base with implementation defined value, set it to 1
as zero is reserved for error handling. Once operation was successful this
function returns passed base, otherwise exits with zero.
The timespec struct was already part of the POSIX standard in <time.h>.
Enable this interface unconditionally in the header to allow to use it
in a code prior C11 and C++17 as an extension.
Review notes from <christos>
This header conforms to the C11 standard
Reference: ISO/IEC 9899:201x 7.15 Alignment <stdalign.h>
According to ISO/IEC 9899:201x (draft) 7.15 Alignment <stdalign.h> defines
four macros:
- alignas which expands to _Alignas
- alignof which expands to _Alignof
- __alignas_is_defined and __alignof_is_defined which both expand to 1
The _Alignas declaration appears as one of the type specifiers to modify
the alignment requirement of the object being declared.
The _Alignof operator is used to query the alignment requirement of its
operand type.
ISO/IEC N3242=11-0012 (C++1x) and ISO/IEC N3797 (C++1y) both note a header
<cstdalign> which defines only __alignas_is_defined and shall not define
the alignas macro. It misses the alignof case as it's probably based on an
older C1x draft, which defined only alignas. Assume that this is a bug in
the standard and treat alignof the same way as alignas in C++11.
Allow to define alignas and alignof in C++ prior the C++11 standard. It
might be broken but a nonstandard C++ compiler might support C11-like
_Alignas and _Alignof. Note that it's fatal for g++(1) v.5.4.
This header conforms to the C11 standard
Reference: ISO/IEC 9899:201x 7.23 _Noreturn <stdnoreturn.h>
According to ISO/IEC 9899:201x (draft) <stdnoreturn.> defines the
noreturn macro which expands to _Noreturn.
The _Noreturn keyword appears in a function declaration and specifies
that the function does not return by reaching the end of the function
body.
Design choices:
- don't implicitly break C++ code including this header with #error
C++11 offers [[noreturn]] which conflicts with C11 _Noreturn
- don't check for __STDC_VERSION__, everybody is free to reuse it with
a nonstandard compiler not conforming to C11 but supporting _Noreturn
gcc(1) and clang(1) support _Noreturn in -std=c99 and older standards
this follows <stdbool.h> choice for not checking for C99
- follow <stdbool.h> and declare the __noreturn_is_defined guard
- use a standard header guard (_STDNORETURN_H_), similar to <stdbool.h>
Reviewed by <pgoyette> and <joerg>
to come up with a better way to handle attachment-specific modules, and
possibly a better directory structure for modules in general, as the
current mechanism doesn't scale.
and PCI_IOC_DRVNAMEONBUS. the new ones also take a (autoconf) PCI bus
number, which allows lookups for any device on any pci bus node. use this
in pcictl which current reports the wrong values sometimes.
up next: use these in libpciaccess.