Created
March 31, 2016 16:41
-
-
Save mmgaggle/2c8c78da4545bf8fe3f519aedbe09fe4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
#define O_DIRECT 00040000ULL | |
#define O_ATOMIC 040000000ULL | |
#include<stdio.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
int main () | |
{ | |
FILE *fp; | |
int fd; | |
char *str; | |
str = (char *) malloc(16384); | |
memset(str,0,16384); | |
fd = open( "./append16kb.txt" , O_DIRECT | O_WRONLY | O_TRUNC | O_ATOMIC); | |
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