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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc

Issue 604513002: [NaCl SDK] nacl_io: Add chmod/fchmod (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "nacl_io/kernel_proxy.h" 5 #include "nacl_io/kernel_proxy.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <limits.h> 10 #include <limits.h>
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 792
793 error = fs->Remove(rel); 793 error = fs->Remove(rel);
794 if (error) { 794 if (error) {
795 errno = error; 795 errno = error;
796 return -1; 796 return -1;
797 } 797 }
798 798
799 return 0; 799 return 0;
800 } 800 }
801 801
802 // TODO(noelallen): Needs implementation. 802 int KernelProxy::fchmod(int fd, mode_t mode) {
803 int KernelProxy::fchmod(int fd, int mode) {
804 ScopedKernelHandle handle; 803 ScopedKernelHandle handle;
805 Error error = AcquireHandle(fd, &handle); 804 Error error = AcquireHandle(fd, &handle);
806 if (error) { 805 if (error) {
807 errno = error; 806 errno = error;
808 return -1; 807 return -1;
809 } 808 }
810 809
810 error = handle->node()->Fchmod(mode);
811 if (error) {
812 errno = error;
813 return -1;
814 }
815
811 return 0; 816 return 0;
812 } 817 }
813 818
814 int KernelProxy::fcntl(int fd, int request, va_list args) { 819 int KernelProxy::fcntl(int fd, int request, va_list args) {
815 Error error = 0; 820 Error error = 0;
816 821
817 // F_GETFD and F_SETFD are descriptor specific flags that 822 // F_GETFD and F_SETFD are descriptor specific flags that
818 // are stored in the KernelObject's decriptor map unlike 823 // are stored in the KernelObject's decriptor map unlike
819 // F_GETFL and F_SETFL which are handle specific. 824 // F_GETFL and F_SETFL which are handle specific.
820 switch (request) { 825 switch (request) {
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
1734 errno = ENOTSOCK; 1739 errno = ENOTSOCK;
1735 return -1; 1740 return -1;
1736 } 1741 }
1737 1742
1738 return 0; 1743 return 0;
1739 } 1744 }
1740 1745
1741 #endif // PROVIDES_SOCKET_API 1746 #endif // PROVIDES_SOCKET_API
1742 1747
1743 } // namespace_nacl_io 1748 } // namespace_nacl_io
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698