~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tests/fcntl-misc/src.c

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <errno.h>
 
3
#include <sys/stat.h>
 
4
#include <fcntl.h>
 
5
#include <string.h>
 
6
 
 
7
int main() {
 
8
  struct stat s;
 
9
  int f = open("/test", O_RDONLY, 0777);
 
10
 
 
11
  printf("posix_fadvise: %d\n", posix_fadvise(f, 3, 2, POSIX_FADV_DONTNEED));
 
12
  printf("errno: %d\n", errno);
 
13
  printf("\n");
 
14
  errno = 0;
 
15
 
 
16
  printf("posix_fallocate: %d\n", posix_fallocate(f, 3, 2));
 
17
  printf("errno: %d\n", errno);
 
18
  stat("/test", &s);
 
19
  printf("st_size: %d\n", s.st_size);
 
20
  memset(&s, 0, sizeof s);
 
21
  printf("\n");
 
22
  errno = 0;
 
23
 
 
24
  printf("posix_fallocate2: %d\n", posix_fallocate(f, 3, 7));
 
25
  printf("errno: %d\n", errno);
 
26
  stat("/test", &s);
 
27
  printf("st_size: %d\n", s.st_size);
 
28
  memset(&s, 0, sizeof s);
 
29
 
 
30
  return 0;
 
31
}