Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: tests/glibc_syscall_wrappers/test_fstat.c

Issue 6018003: Add fxstat check to glibc_syscall_wrappers test. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/glibc_syscall_wrappers/nacl.scons ('k') | tests/glibc_syscall_wrappers/test_fstat.stdout » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /*
2 * Copyright 2010 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can
4 * be found in the LICENSE file.
5 */
6
7 #include <assert.h>
8 #include <errno.h>
9 #include <stddef.h>
10 #include <stdio.h>
11 #include <sys/stat.h>
12
13 int main(int argc, char** argv) {
14 struct stat st;
15 FILE* file;
16 int fd;
17 if (2 != argc) {
18 printf("Usage: sel_ldr test_fstat.nexe test_stat_data\n");
19 return 1;
20 }
21 st.st_size = 0;
22 printf("st_dev offset %d, size %d\n",
23 offsetof(struct stat, st_dev),
24 sizeof(st.st_dev));
25 printf("st_ino offset %d, size %d\n",
26 offsetof(struct stat, st_ino),
27 sizeof(st.st_ino));
28 printf("st_mode offset %d, size %d\n",
29 offsetof(struct stat, st_mode),
30 sizeof(st.st_mode));
31 printf("st_nlink offset %d, size %d\n",
32 offsetof(struct stat, st_nlink),
33 sizeof(st.st_nlink));
34 printf("st_uid offset %d, size %d\n",
35 offsetof(struct stat, st_uid),
36 sizeof(st.st_uid));
37 printf("st_gid offset %d, size %d\n",
38 offsetof(struct stat, st_gid),
39 sizeof(st.st_gid));
40 printf("st_rdev offset %d, size %d\n",
41 offsetof(struct stat, st_rdev),
42 sizeof(st.st_rdev));
43 printf("st_size offset %d, size %d\n",
44 offsetof(struct stat, st_size),
45 sizeof(st.st_size));
46 printf("st_blksize offset %d, size %d\n",
47 offsetof(struct stat, st_blksize),
48 sizeof(st.st_blksize));
49 printf("st_blocks offset %d, size %d\n",
50 offsetof(struct stat, st_blocks),
51 sizeof(st.st_blocks));
52 printf("st_atim offset %d, size %d\n",
53 offsetof(struct stat, st_atim),
54 sizeof(st.st_atim));
55 printf("struct st size %d\n",
56 sizeof(st));
57 file = fopen(argv[1], "r");
58 if (file == NULL)
59 return 2;
60 fd = fileno(file);
61 errno = 0;
62 if (fstat(fd, &st))
63 return 3;
64 printf("%d\n", (int)st.st_size);
65 if (errno != 0)
66 return 4;
67 if (fclose(file))
68 return 5;
69 errno = 0;
70 if (fstat(-1, &st) != -1)
71 return 6;
72 if (errno != EBADF)
73 return 7;
74 return 0;
75 }
OLDNEW
« no previous file with comments | « tests/glibc_syscall_wrappers/nacl.scons ('k') | tests/glibc_syscall_wrappers/test_fstat.stdout » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698