Have you looked at
man 2 ioctl? What exactly do you want to do? Something like the following?
Code:
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/fs.h>
#include <linux/ext3_fs.h>
int main(int argc, char *argv[])
{
int fd, flags = EXT3_SYNC_FL;
if(argc != 2) {
fprintf(stderr, "Usage: %s filename\n", argv[0]);
exit(EXIT_FAILURE);
}
if((fd = open(argv[1], O_RDWR)) == -1) {
perror("open");
exit(EXIT_FAILURE);
}
if(ioctl(fd, EXT3_IOC_SETFLAGS, &flags) == -1) {
perror("ioctl");
close(fd);
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
}