>I would like to do raw disk I/O on a Sun Ultra 5 machine
>with SunOS 5.6 (Solaris 2.6) operating system. I want to
>do raw disk I/O because I want to avoid using buffer
>cache. (I would like to perform some experiments with and
>without using buffer cache to study some effects.)
>I have read some man pages. There seem to be several relevant
>system calls: read (section 2 of the man pages), read (section
>9E of the man pages), physio, aphysio, aread, and so on.
>My question is: does anybody know how to do it? Can you
>provide me with an example? Is there an FAQ regarding this?
>Any information that you provide will be helpful.
>Please email me your suggestions in addition to posting them.
Depends on how deep you want to take it. physio() is a kernel routine
almost exclusively called from device drivers (hard disk, optical disk
etc) and is not accessible from a user program.. Are you really
looking to write a device driver for this? Sounds a bit too low level
for what you want to do. If so though, you'll need more than just a
few pointers. It's a field of programming in it's own right. I used to
write them and they're a pig to get right.
A quick and dirty way of doing your experiments would be to just
create your partition and use the dd command to read and write from
it. There should be a block device filename and a raw device filename
for the partition. Use dd on each of these files, time it, and compare
Otherwise, if you want to write a program to do it, then just use the
ordinary open (with O_SYNC set maybe to be sure in the case of raw),
read, write, close calls but open the block device name to access it
via the buffer cache, and use the raw device name for the other way.
Sorry, I'm not a Solaris guy and I don't know where in /dev the files
are held or the naming conventions etc. Maybe someone else could help
Hope I've understood your request and that this helps a little.