OLD | NEW |
---|---|
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 #ifndef SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ | 5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ |
6 #define SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ | 6 #define SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 // Example usage: | 28 // Example usage: |
29 // for (SyscallIterator iter(false); !iter.Done(); ) { | 29 // for (SyscallIterator iter(false); !iter.Done(); ) { |
30 // uint32_t sysnum = iter.Next(); | 30 // uint32_t sysnum = iter.Next(); |
31 // // Do something with sysnum. | 31 // // Do something with sysnum. |
32 // } | 32 // } |
33 // | 33 // |
34 // TODO(markus): Make this a classic C++ iterator. | 34 // TODO(markus): Make this a classic C++ iterator. |
35 class SANDBOX_EXPORT SyscallIterator { | 35 class SANDBOX_EXPORT SyscallIterator { |
36 public: | 36 public: |
37 explicit SyscallIterator(bool invalid_only) | 37 explicit SyscallIterator(bool invalid_only) |
38 #if defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32) | |
39 : invalid_only_(invalid_only), done_(false), num_(4000) {} | |
jln (very slow on Chromium)
2014/05/02 20:42:04
Is there a defined symbol instad of "4000"?
nedeljko
2014/05/07 15:40:05
__NR_Linux can be used, although I need to include
| |
40 #else | |
38 : invalid_only_(invalid_only), done_(false), num_(0) {} | 41 : invalid_only_(invalid_only), done_(false), num_(0) {} |
39 | 42 #endif |
40 bool Done() const { return done_; } | 43 bool Done() const { return done_; } |
41 uint32_t Next(); | 44 uint32_t Next(); |
42 static bool IsValid(uint32_t num); | 45 static bool IsValid(uint32_t num); |
43 | 46 |
44 private: | 47 private: |
45 static bool IsArmPrivate(uint32_t num); | 48 static bool IsArmPrivate(uint32_t num); |
46 | 49 |
47 bool invalid_only_; | 50 bool invalid_only_; |
48 bool done_; | 51 bool done_; |
49 uint32_t num_; | 52 uint32_t num_; |
50 | 53 |
51 DISALLOW_IMPLICIT_CONSTRUCTORS(SyscallIterator); | 54 DISALLOW_IMPLICIT_CONSTRUCTORS(SyscallIterator); |
52 }; | 55 }; |
53 | 56 |
54 } // namespace sandbox | 57 } // namespace sandbox |
55 | 58 |
56 #endif // SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ | 59 #endif // SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ |
OLD | NEW |