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

Side by Side Diff: libraries/nacl-mounts/memory/MemNode.cc

Issue 10556007: changes in memory mount and socket subsystem to port thttpd (Closed) Base URL: http://naclports.googlecode.com/svn/trunk/src/
Patch Set: Created 8 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2011 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 6
7 #include "MemNode.h" 7 #include "MemNode.h"
8 #include <assert.h> 8 #include <assert.h>
9 #include <errno.h> 9 #include <errno.h>
10 #include <stdio.h> 10 #include <stdio.h>
11 #include <stdlib.h> 11 #include <stdlib.h>
12 12
13 MemNode::MemNode() { 13 MemNode::MemNode() {
14 data_ = NULL; 14 data_ = NULL;
15 len_ = 0; 15 len_ = 0;
16 capacity_ = 0; 16 capacity_ = 0;
17 use_count_ = 0; 17 use_count_ = 0;
18 } 18 }
19 19
20 MemNode::~MemNode() { 20 MemNode::~MemNode() {
21 children_.clear(); 21 children_.clear();
22 } 22 }
23 23
24 int MemNode::stat(struct stat *buf) { 24 int MemNode::stat(struct stat *buf) {
25 memset(buf, 0, sizeof(struct stat)); 25 memset(buf, 0, sizeof(struct stat));
26 buf->st_ino = (ino_t)slot_; 26 buf->st_ino = (ino_t)slot_;
27 if (is_dir()) { 27 if (is_dir()) {
28 buf->st_mode = S_IFDIR | 0777; 28 buf->st_mode = S_IFDIR | 0777;
29 } else { 29 } else {
30 buf->st_mode = S_IFREG | 0777; 30 buf->st_mode = S_IFREG | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH
31 | S_IWOTH;
31 buf->st_size = len_; 32 buf->st_size = len_;
32 } 33 }
33 buf->st_uid = 1001; 34 buf->st_uid = 1001;
34 buf->st_gid = 1002; 35 buf->st_gid = 1002;
35 buf->st_blksize = 1024; 36 buf->st_blksize = 1024;
36 return 0; 37 return 0;
37 } 38 }
38 39
39 void MemNode::AddChild(int child) { 40 void MemNode::AddChild(int child) {
40 if (!is_dir()) { 41 if (!is_dir()) {
(...skipping 17 matching lines...) Expand all
58 set_capacity(len); 59 set_capacity(len);
59 } 60 }
60 61
61 std::list<int> *MemNode::children() { 62 std::list<int> *MemNode::children() {
62 if (is_dir()) { 63 if (is_dir()) {
63 return &children_; 64 return &children_;
64 } else { 65 } else {
65 return NULL; 66 return NULL;
66 } 67 }
67 } 68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698