diff options
Diffstat (limited to 'pkg/sentry/usermem')
-rw-r--r-- | pkg/sentry/usermem/access_type.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/sentry/usermem/access_type.go b/pkg/sentry/usermem/access_type.go index c71d05afe..9e6a27bcf 100644 --- a/pkg/sentry/usermem/access_type.go +++ b/pkg/sentry/usermem/access_type.go @@ -93,6 +93,15 @@ func (a AccessType) Intersect(other AccessType) AccessType { } } +// Union returns the access types set in either a or other. +func (a AccessType) Union(other AccessType) AccessType { + return AccessType{ + Read: a.Read || other.Read, + Write: a.Write || other.Write, + Execute: a.Execute || other.Execute, + } +} + // Effective returns the set of effective access types allowed by a, even if // some types are not explicitly allowed. func (a AccessType) Effective() AccessType { |