| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "files/public/c/mojio_sys_stat.h" | |
| 6 | |
| 7 #include "files/public/c/lib/fd_impl.h" | |
| 8 #include "files/public/c/lib/fd_table.h" | |
| 9 #include "files/public/c/lib/singletons.h" | |
| 10 | |
| 11 namespace mojio { | |
| 12 namespace { | |
| 13 | |
| 14 int FstatImpl(int fd, struct mojio_stat* buf) { | |
| 15 FDImpl* fd_impl = singletons::GetFDTable()->Get(fd); | |
| 16 if (!fd_impl) | |
| 17 return -1; | |
| 18 | |
| 19 return fd_impl->Fstat(buf) ? 0 : -1; | |
| 20 } | |
| 21 | |
| 22 } // namespace | |
| 23 } // namespace mojio | |
| 24 | |
| 25 extern "C" { | |
| 26 | |
| 27 int mojio_fstat(int fd, struct mojio_stat* buf) { | |
| 28 return mojio::FstatImpl(fd, buf); | |
| 29 } | |
| 30 | |
| 31 } // extern "C" | |
| OLD | NEW |