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 18 matching lines...) Expand all Loading... |
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 : invalid_only_(invalid_only), done_(false), num_(0) {} | 38 : invalid_only_(invalid_only), done_(false), num_(0) {} |
39 | |
40 bool Done() const { return done_; } | 39 bool Done() const { return done_; } |
41 uint32_t Next(); | 40 uint32_t Next(); |
42 static bool IsValid(uint32_t num); | 41 static bool IsValid(uint32_t num); |
43 | 42 |
44 private: | 43 private: |
45 static bool IsArmPrivate(uint32_t num); | 44 static bool IsArmPrivate(uint32_t num); |
46 | 45 |
47 bool invalid_only_; | 46 bool invalid_only_; |
48 bool done_; | 47 bool done_; |
49 uint32_t num_; | 48 uint32_t num_; |
50 | 49 |
51 DISALLOW_IMPLICIT_CONSTRUCTORS(SyscallIterator); | 50 DISALLOW_IMPLICIT_CONSTRUCTORS(SyscallIterator); |
52 }; | 51 }; |
53 | 52 |
54 } // namespace sandbox | 53 } // namespace sandbox |
55 | 54 |
56 #endif // SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ | 55 #endif // SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__ |
OLD | NEW |