I don't think ioctl has anything for clock stretching.
The way that the restart works is that you can feed an array structure of operations to the i2c driver. When you feed it a 0 byte write followed by N byte read command you will get the two commands executed in sequence with a restart between them. It also means you need to make less OS calls so its slightly more CPU efficient.
Tho for this to work you need to have combined transactions enabled. To do this temporarly you can do this in the console:
sudo su -
echo -n 1 > /sys/module/i2c_bcm2708/parameters/combined
exit
Or to do it permanently this has to be appened on the end of "/etc/modprobe.d/i2c.conf" (If it does not exist create it)
options i2c-bcm2708 combined=1
These files might have an option to turn on clock stretching. I never needed that feature so i never looked into it, but the restart one was a big deal.
EDIT:
Oh and in case anyone needs it here is some code that makes it work:
#include <linux/i2c-dev.h>
#include <linux/i2c.h>
#include <linux/types.h>
unsigned char ReadRegI2C(unsigned char Addr, unsigned char Reg)
{
char bfr;
int result;
struct i2c_msg rdwr_msgs[2] = {
{ // Start address
.addr = Addr,
.flags = 0, // write
.len = 1,
.buf = &Reg
},
{ // Read buffer
.addr = Addr,
.flags = I2C_M_RD, // read
.len = 1,
.buf = (__u8*)&bfr
}
};
struct i2c_rdwr_ioctl_data rdwr_data = {
.msgs = rdwr_msgs,
.nmsgs = 2
};
bfr = Reg;
result = ioctl( Handle, I2C_RDWR, &rdwr_data );
return bfr;
}
It also does burst reads if you try to read a length of more than 1. And obviously this code has no error checking, its just a quick and dirty example.