| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 #include <assert.h> | 6 #include <assert.h> |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <ppapi/c/pp_file_info.h> | 8 #include <ppapi/c/pp_file_info.h> |
| 9 #include <ppapi/c/ppb_file_io.h> | 9 #include <ppapi/c/ppb_file_io.h> |
| 10 #include <ppapi/cpp/file_io.h> | 10 #include <ppapi/cpp/file_io.h> |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 PepperNode *node = slots_.At(slot); | 148 PepperNode *node = slots_.At(slot); |
| 149 if (node == NULL) { | 149 if (node == NULL) { |
| 150 errno = ENOENT; | 150 errno = ENOENT; |
| 151 return -1; | 151 return -1; |
| 152 } | 152 } |
| 153 | 153 |
| 154 if (node->is_dir()) { | 154 if (node->is_dir()) { |
| 155 memset(buf, 0, sizeof(struct stat)); | 155 memset(buf, 0, sizeof(struct stat)); |
| 156 buf->st_ino = (ino_t)slot; | 156 buf->st_ino = (ino_t)slot; |
| 157 buf->st_mode = S_IFDIR | 0777; | 157 buf->st_mode = S_IFDIR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |
| 158 | S_IWOTH; |
| 158 buf->st_size = 0; | 159 buf->st_size = 0; |
| 159 buf->st_uid = 1001; | 160 buf->st_uid = 1001; |
| 160 buf->st_gid = 1002; | 161 buf->st_gid = 1002; |
| 161 buf->st_blksize = 1024; | 162 buf->st_blksize = 1024; |
| 162 return 0; | 163 return 0; |
| 163 } | 164 } |
| 164 | 165 |
| 165 PepperFileIOJob *job = new PepperFileIOJob; | 166 PepperFileIOJob *job = new PepperFileIOJob; |
| 166 job->set_op(QUERY_FILE); | 167 job->set_op(QUERY_FILE); |
| 167 job->set_file_io(node->file_io()); | 168 job->set_file_io(node->file_io()); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 // will return null if d_ino is zero. | 335 // will return null if d_ino is zero. |
| 335 dir->d_ino = 0x60061E; | 336 dir->d_ino = 0x60061E; |
| 336 dir->d_off = sizeof(struct dirent); | 337 dir->d_off = sizeof(struct dirent); |
| 337 dir->d_reclen = sizeof(struct dirent); | 338 dir->d_reclen = sizeof(struct dirent); |
| 338 strncpy(dir->d_name, it->c_str(), sizeof(dir->d_name)); | 339 strncpy(dir->d_name, it->c_str(), sizeof(dir->d_name)); |
| 339 ++dir; | 340 ++dir; |
| 340 bytes_read += sizeof(struct dirent); | 341 bytes_read += sizeof(struct dirent); |
| 341 } | 342 } |
| 342 return bytes_read; | 343 return bytes_read; |
| 343 } | 344 } |
| OLD | NEW |