aboutsummaryrefslogtreecommitdiffstats
path: root/sys/decl.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-01-05 14:33:44 +0100
committerDmitry Vyukov <dvyukov@google.com>2017-01-09 20:20:48 +0100
commite8ddc2ae566d258db10a700b9e3a2e9548126d69 (patch)
tree6082046e106867f70bb22818b55addaae6a079fb /sys/decl.go
parent9ba75ee1d71c41ca08dd45eaafacd2bd94303c00 (diff)
sys: don't add clock_gettime always
Currently we always enable clock_gettime in config. This is required since the call is needed for generation of timespec/timeval structs. The negative side effect is that one gets clock_gettime even if he wants to fuzz a small set of unrelated syscalls. Don't enable clock_gettime by default. Instead handle timeval/timespec as other resources.
Diffstat (limited to 'sys/decl.go')
-rw-r--r--sys/decl.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/decl.go b/sys/decl.go
index 322158b92..d09328c91 100644
--- a/sys/decl.go
+++ b/sys/decl.go
@@ -437,10 +437,8 @@ func TransitivelyEnabledCalls(enabled map[*Call]bool) map[*Call]bool {
}
for {
n := len(supported)
- for c := range enabled {
- if !supported[c] {
- continue
- }
+ haveGettime := supported[CallMap["clock_gettime"]]
+ for c := range supported {
canCreate := true
for _, res := range c.InputResources() {
noctors := true
@@ -455,6 +453,15 @@ func TransitivelyEnabledCalls(enabled map[*Call]bool) map[*Call]bool {
break
}
}
+ // We need to support structs as resources,
+ // but for now we just special-case timespec/timeval.
+ if canCreate && !haveGettime {
+ ForeachType(c, func(typ Type) {
+ if a, ok := typ.(*StructType); ok && a.Dir() != DirOut && (a.Name() == "timespec" || a.Name() == "timeval") {
+ canCreate = false
+ }
+ })
+ }
if !canCreate {
delete(supported, c)
}