OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2008 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that be | 3 * Use of this source code is governed by a BSD-style license that be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 NaClSrpcArg **in_args, \ | 52 NaClSrpcArg **in_args, \ |
53 NaClSrpcArg **out_args, \ | 53 NaClSrpcArg **out_args, \ |
54 NaClSrpcClosure *done) | 54 NaClSrpcClosure *done) |
55 | 55 |
56 NACL_SRPC_HANDLER("file:shi:", NaClFile) { | 56 NACL_SRPC_HANDLER("file:shi:", NaClFile) { |
57 char *pathname; | 57 char *pathname; |
58 int fd; | 58 int fd; |
59 int last; | 59 int last; |
60 struct nacl_file_map *entry; | 60 struct nacl_file_map *entry; |
61 | 61 |
62 pathname = in_args[0]->u.sval; | 62 pathname = in_args[0]->arrays.str; |
63 fd = in_args[1]->u.ival; | 63 fd = in_args[1]->u.ival; |
64 last = in_args[2]->u.hval; | 64 last = in_args[2]->u.hval; |
65 | 65 |
66 printf("NaClFile(%s,%d,%d)\n", pathname, fd, last); | 66 printf("NaClFile(%s,%d,%d)\n", pathname, fd, last); |
67 | 67 |
68 entry = malloc(sizeof *entry); | 68 entry = malloc(sizeof *entry); |
69 | 69 |
70 if (NULL == entry) { | 70 if (NULL == entry) { |
71 fprintf(stderr, "No memory for file map for %s\n", pathname); | 71 fprintf(stderr, "No memory for file map for %s\n", pathname); |
72 exit(1); | 72 exit(1); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 case SEEK_END: | 228 case SEEK_END: |
229 offset = __real_lseek(nacl_files[dd].real_fd, offset, SEEK_END); | 229 offset = __real_lseek(nacl_files[dd].real_fd, offset, SEEK_END); |
230 break; | 230 break; |
231 } | 231 } |
232 if (-1 != offset) { | 232 if (-1 != offset) { |
233 nacl_files[dd].pos = offset; | 233 nacl_files[dd].pos = offset; |
234 } | 234 } |
235 pthread_mutex_unlock(&nacl_files[dd].mu); | 235 pthread_mutex_unlock(&nacl_files[dd].mu); |
236 return offset; | 236 return offset; |
237 } | 237 } |
OLD | NEW |