Skip to content

Instantly share code, notes, and snippets.

@mmgaggle
Created December 12, 2015 07:00
Show Gist options
  • Save mmgaggle/cee2d932ae0312c6a56d to your computer and use it in GitHub Desktop.
Save mmgaggle/cee2d932ae0312c6a56d to your computer and use it in GitHub Desktop.
#define _GNU_SOURCE
#include<stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
int main ()
{
FILE *fp;
int fd;
char *str;
str = (char *) malloc(16384);
memset(str,0,16384);
fd = open( "/var/lib/mysql/append16kb.txt" , O_DIRECT | O_WRONLY | O_TRUNC);
while (1) {
write(fd, str, 16384);
fdatasync(fd);
}
close(fd);
return(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment