[DTrace-devel] [PATCH 10/12] Add support for copyin() subroutine
Eugene Loh
eugene.loh at oracle.com
Thu Jul 21 18:49:21 UTC 2022
On 7/21/22 13:03, Kris Van Hees wrote:
> On Thu, Jul 21, 2022 at 11:08:45AM -0700, Eugene Loh via DTrace-devel wrote:
>> Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
>> On 7/13/22 12:17, Kris Van Hees via DTrace-devel wrote:
>>> diff --git a/test/unittest/funcs/copyin/tst.copyin.d b/test/unittest/funcs/copyin/tst.copyin.d
>>> new file mode 100644
>> The test test/unittest/funcs/copyin/tst.copyin.d should ideally check the
>> output. I know it's hard, but the test is kind of toothless otherwise.
> Well, yes and no. The main point we're testing here is that we *can* read
> the data. I would like to come up with a test where I can also verify the
> correctness of the data but thus far I have not found a truly reproducible
> way for doing that.
How about something like this?
$ cat a.c
#include <stdio.h>
#include <string.h>
#include <sys/types.h> /* open */
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h> /* write */
int main(int c, char **v) {
char *s = "hello world, how are you?";
int fd = open("/dev/null", O_WRONLY);
write(fd, s, strlen(s));
close(fd);
return 0;
}
# dtrace -c ./a.out -qn 'syscall::write:entry /pid == $target/ {
printf("'%s'", (string)copyin(arg1, 256)); }'
hello world, how are you?
More information about the DTrace-devel
mailing list