Home | History | Annotate | Download | only in ltp-aiodio
      1 
      2 /*
      3  * Copyright (c) 2004 Daniel McNeil <daniel (at) osdl.org>
      4  *               2004 Open Source Development Lab
      5  *   This program is free software;  you can redistribute it and/or modify
      6  *   it under the terms of the GNU General Public License as published by
      7  *   the Free Software Foundation; either version 2 of the License, or
      8  *   (at your option) any later version.
      9  *
     10  *   This program is distributed in the hope that it will be useful,
     11  *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
     12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
     13  *   the GNU General Public License for more details.
     14  *
     15  *   You should have received a copy of the GNU General Public License
     16  *   along with this program;  if not, write to the Free Software
     17  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
     18  *
     19  * Module: .c
     20  */
     21 
     22 /*
     23  * Change History:
     24  *
     25  * 2/2004  Marty Ridgeway (mridge (at) us.ibm.com) Changes to adapt to LTP
     26  *
     27  */
     28 
     29 #include <stdlib.h>
     30 #include <fcntl.h>
     31 #include <memory.h>
     32 #include <stdio.h>
     33 #include <unistd.h>
     34 #include <limits.h>
     35 
     36 int main(void)
     37 {
     38 	int fd;
     39 	int i;
     40 	char buf[32 * 1024];
     41 	char filename[PATH_MAX];
     42 
     43 	printf("Starting dirty tests...\n");
     44 
     45 	snprintf(filename, sizeof(filename), "%s/aiodio/file.xx.%d",
     46 		 getenv("TMP") ? getenv("TMP") : "/tmp", getpid());
     47 
     48 	fd = open(filename, O_CREAT | O_WRONLY, 0666);
     49 
     50 	memset(buf, 0xaa, sizeof(buf));
     51 	for (i = 0; i < 3000; i++)
     52 		write(fd, buf, sizeof(buf));
     53 	fsync(fd);
     54 	close(fd);
     55 	unlink(filename);
     56 	return 0;
     57 }
     58