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

Side by Side Diff: sandbox/linux/seccomp-bpf/syscall_iterator.h

Issue 11096012: Add a platform-specific syscall number iterator. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed upload. Created 8 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__
6 #define SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__
7
8 #include <stdint.h>
9
10 namespace playground2 {
11
12 class SyscallIterator {
13 public:
14 // Iterates over the entire system call range from 0..0xFFFFFFFFu. This
jln (very slow on Chromium) 2012/10/12 20:26:52 Style: This class comment should be above the clas
Jorge Lucangeli Obes 2012/10/13 01:39:30 Done.
15 // iterator is aware of how system calls look like and will skip quickly
16 // over ranges that can't contain system calls. It iterates more slowly
17 // whenever it reaches a range that is potentially problematic. And it
18 // iterates over individual values whenever it is in the normal range for
19 // system calls (typically MIN_SYSCALL..MAX_SYSCALL).
20 // If "invalid_only" is "true", the iterator still iterates from
21 // 0..0xFFFFFFFFu, but it never returns values from the range of valid
22 // system call numbers. This feature can be used when verifying that all
23 // "impossible" system call values are treated the same.
jln (very slow on Chromium) 2012/10/12 20:26:52 This should be made more clear: with invalid_only,
jln (very slow on Chromium) 2012/10/12 20:26:52 The way to use the iterator is really weird: You
Jorge Lucangeli Obes 2012/10/13 01:39:30 Done.
Jorge Lucangeli Obes 2012/10/13 01:39:30 Done.
24 explicit SyscallIterator(bool invalid_only)
25 : invalid_only_(invalid_only),
jln (very slow on Chromium) 2012/10/12 20:26:52 Style: the colon should be indented 4 spaces.
Jorge Lucangeli Obes 2012/10/13 01:39:30 Done.
26 done_(false),
27 num_(0) {}
28
29 bool Done() const { return done_; }
30 uint32_t Next();
31 static bool IsValid(uint32_t num);
32
33 private:
34 static bool IsArmPrivate(uint32_t num);
35
36 bool invalid_only_;
37 bool done_;
38 uint32_t num_;
39 };
jln (very slow on Chromium) 2012/10/12 20:26:52 DISALLOW_COPY_AND_ASSIGN ?
Jorge Lucangeli Obes 2012/10/13 01:39:30 Done.
40
41 } // namespace
42
43 #endif // SANDBOX_LINUX_SECCOMP_BPF_SYSCALL_ITERATOR_H__
44
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698