Commit 3d85e0a0 authored by gejun's avatar gejun

Minor patches from svn

parent 22c662c8
...@@ -213,7 +213,7 @@ size_t IOBuf::new_bigview_count() { ...@@ -213,7 +213,7 @@ size_t IOBuf::new_bigview_count() {
} }
struct IOBuf::Block { struct IOBuf::Block {
base::atomic<int32_t> nshared; base::atomic<int> nshared;
uint16_t size; uint16_t size;
uint16_t cap; uint16_t cap;
Block* portal_next; Block* portal_next;
...@@ -242,7 +242,7 @@ struct IOBuf::Block { ...@@ -242,7 +242,7 @@ struct IOBuf::Block {
} }
} }
int32_t ref_count() const { int ref_count() const {
return nshared.load(base::memory_order_relaxed); return nshared.load(base::memory_order_relaxed);
} }
...@@ -253,7 +253,7 @@ struct IOBuf::Block { ...@@ -253,7 +253,7 @@ struct IOBuf::Block {
namespace iobuf { namespace iobuf {
// for unit test // for unit test
int32_t block_shared_count(IOBuf::Block const* b) { return b->ref_count(); } int block_shared_count(IOBuf::Block const* b) { return b->ref_count(); }
IOBuf::Block* get_portal_next(IOBuf::Block const* b) { IOBuf::Block* get_portal_next(IOBuf::Block const* b) {
return b->portal_next; return b->portal_next;
......
...@@ -245,7 +245,9 @@ static int get_fd_count(int limit) { ...@@ -245,7 +245,9 @@ static int get_fd_count(int limit) {
for (base::FilePath name = fd_enum.Next(); for (base::FilePath name = fd_enum.Next();
!name.empty() && count <= limit; !name.empty() && count <= limit;
name = fd_enum.Next(), ++count) {} name = fd_enum.Next(), ++count) {}
return count - 2/*. and ..*/ - 1/*opendir itself*/; // FileEnumerator already filtered . and .., due to its implementation,
// the fd created by opendir is not counted as well.
return count;
} }
extern PassiveStatus<int> g_fd_num; extern PassiveStatus<int> g_fd_num;
......
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
namespace bvar { namespace bvar {
// TODO: naming should be consistent with Status<>
// Display a updated-by-need value. This is done by passing in an user callback // Display a updated-by-need value. This is done by passing in an user callback
// which is called to produce the value. // which is called to produce the value.
// Example: // Example:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment