Mheanwhile I solved part of the riddle myself. For a plain file aiowrite
etc. is not a simple system call. It forks a thread that does complex
things and uses aio system calls and pwrite.
But one question I still have. The good old truss shows:
kaio(AIOWRITE, 3, 0x00021000, 2048, 4096, 0xFFBFFBF0) Err#81 EBADFD
But my dtrace script outputs these args:
kaio write 1 3 21000 2048 0 4096 1182001a00
There is a 0 for arg4 and the last arg is 1182001a00 instead of 0xFFBFFBF0.
Michael
Michael Mueller wrote:
Chad,
Unfortunateley this works except for the resultp argument of aiowrite
and the return value of aiowait. Does anybody know how to get this working?
Test program:
-------------
#include <stdio.h>
#include <sys/types.h>
#include <sys/asynch.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#define OFF 4096
#define L (2048)
char buf[L];
int
main()
{
int fd;
aio_result_t r, *p;
fd = open("FILE", O_RDWR|O_CREAT, 0666);
printf("aiowrite(fd %d, bufp %p, bufs %d, offset %d,"
" whence %d, resultp %p)\n", fd, buf, L, OFF,
SEEK_SET, &r);
if (aiowrite(fd, buf, L, OFF, SEEK_SET, &r))
perror("aiowrite");
p = aiowait(NULL);
if ((int)p == -1)
perror("aiowait");
printf("aiowait returned %p\n", p);
}
cc -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g tst.c -o tst -laio
# Platform is Solaris SPARC
Dtrace script:
--------------
/usr/sbin/dtrace -q -c tst -s /dev/fd/0 <<eof
syscall::kaio:entry
/arg0 == 1/ /* AIOWRITE */
{
printf("kaio write %d %d %x %d %d %d %x\n",
arg0, arg1, arg2, arg3, arg4, arg5, arg6);
}
syscall::kaio:entry
/arg0 == 2/ /* AIOWAIT */
{
printf("kaio wait %d %d\n", arg0, arg1);
self->f = 1;
}
syscall::kaio:return
/self->f/
{
self->f = 0;
printf("kaio wait return %p\n", arg0);
}
eof
Output:
-------
aiowrite(fd 3, bufp 21000, bufs 2048, offset 4096, whence 0,
resultp ffbffc40)
aiowait returned ffbffc40
kaio write 1 3 21000 2048 0 4096 1182001a04
kaio wait 2 0
kaio wait return 100000000
For the aiowrite resultp I get 1182001a04 instead of ffbffc40. And the
return value of aiowait is 100000000.
Michael
Chad Mynhier wrote:
On Wed, Feb 18, 2009 at 1:01 PM, Michael Mueller
<m...@michael-mueller-it.de> wrote:
Hi all,
Is there some documentation or some example on how to interpret the arg0
.. arg<n> for the aioread, aiowrite, aiowait syscalls? The system call
name for all three seems to be "kaio".
Michael
When you see things like this (i.e., multiple system calls mapping to
a single syscall probefunc, there are generally subcodes involved.
From
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/sys/syscall.h:
377 #define SYS_kaio 178
378 /*
379 * subcodes:
380 * aioread(...) :: kaio(AIOREAD, ...)
381 * aiowrite(...) :: kaio(AIOWRITE, ...)
382 * aiowait(...) :: kaio(AIOWAIT, ...)
383 * aiocancel(...) :: kaio(AIOCANCEL, ...)
384 * aionotify() :: kaio(AIONOTIFY)
385 * aioinit() :: kaio(AIOINIT)
386 * aiostart() :: kaio(AIOSTART)
387 * see <sys/aio.h>
388 */
What's going to happen is that arg0 to syscall::kaio:entry will be the
subcode, and then arg1 ... arg<n> will be the arguments passed to,
e.g., aioread().
Chad
--
==== Michael Mueller ============================
Tel. 49 8171 63600
Web: http://www.michael-mueller-it.de
http://www.planets.kay-mueller.de
=================================================
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org