Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
BIND
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
582
Issues
582
List
Boards
Labels
Service Desk
Milestones
Merge Requests
110
Merge Requests
110
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
BIND
Commits
995134ce
Commit
995134ce
authored
Jan 28, 2019
by
Evan Hunt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename struct members to avoid a name collision on BSD
parent
64745bbc
Pipeline
#9107
passed with stages
in 15 minutes and 31 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
lib/isc/include/isc/quota.h
lib/isc/include/isc/quota.h
+3
-3
lib/isc/quota.c
lib/isc/quota.c
+17
-17
No files found.
lib/isc/include/isc/quota.h
View file @
995134ce
...
...
@@ -43,9 +43,9 @@ ISC_LANG_BEGINDECLS
/*% isc_quota structure */
struct
isc_quota
{
atomic_uint_fast32_t
__
max
;
atomic_uint_fast32_t
__
used
;
atomic_uint_fast32_t
__
soft
;
atomic_uint_fast32_t
max
;
atomic_uint_fast32_t
used
;
atomic_uint_fast32_t
soft
;
};
...
...
lib/isc/quota.c
View file @
995134ce
...
...
@@ -23,50 +23,50 @@
void
isc_quota_init
(
isc_quota_t
*
quota
,
unsigned
int
max
)
{
atomic_store
(
&
quota
->
__
max
,
max
);
atomic_store
(
&
quota
->
__
used
,
0
);
atomic_store
(
&
quota
->
__
soft
,
0
);
atomic_store
(
&
quota
->
max
,
max
);
atomic_store
(
&
quota
->
used
,
0
);
atomic_store
(
&
quota
->
soft
,
0
);
}
void
isc_quota_destroy
(
isc_quota_t
*
quota
)
{
INSIST
(
atomic_load
(
&
quota
->
__
used
)
==
0
);
atomic_store
(
&
quota
->
__
max
,
0
);
atomic_store
(
&
quota
->
__
used
,
0
);
atomic_store
(
&
quota
->
__
soft
,
0
);
INSIST
(
atomic_load
(
&
quota
->
used
)
==
0
);
atomic_store
(
&
quota
->
max
,
0
);
atomic_store
(
&
quota
->
used
,
0
);
atomic_store
(
&
quota
->
soft
,
0
);
}
void
isc_quota_soft
(
isc_quota_t
*
quota
,
unsigned
int
soft
)
{
atomic_store
(
&
quota
->
__
soft
,
soft
);
atomic_store
(
&
quota
->
soft
,
soft
);
}
void
isc_quota_max
(
isc_quota_t
*
quota
,
unsigned
int
max
)
{
atomic_store
(
&
quota
->
__
max
,
max
);
atomic_store
(
&
quota
->
max
,
max
);
}
unsigned
int
isc_quota_getmax
(
isc_quota_t
*
quota
)
{
return
(
atomic_load_relaxed
(
&
quota
->
__
max
));
return
(
atomic_load_relaxed
(
&
quota
->
max
));
}
unsigned
int
isc_quota_getsoft
(
isc_quota_t
*
quota
)
{
return
(
atomic_load_relaxed
(
&
quota
->
__
soft
));
return
(
atomic_load_relaxed
(
&
quota
->
soft
));
}
unsigned
int
isc_quota_getused
(
isc_quota_t
*
quota
)
{
return
(
atomic_load_relaxed
(
&
quota
->
__
used
));
return
(
atomic_load_relaxed
(
&
quota
->
used
));
}
isc_result_t
isc_quota_reserve
(
isc_quota_t
*
quota
)
{
isc_result_t
result
;
uint32_t
max
=
atomic_load
(
&
quota
->
__
max
);
uint32_t
soft
=
atomic_load
(
&
quota
->
__
soft
);
uint32_t
used
=
atomic_fetch_add
(
&
quota
->
__
used
,
1
);
uint32_t
max
=
atomic_load
(
&
quota
->
max
);
uint32_t
soft
=
atomic_load
(
&
quota
->
soft
);
uint32_t
used
=
atomic_fetch_add
(
&
quota
->
used
,
1
);
if
(
max
==
0
||
used
<
max
)
{
if
(
soft
==
0
||
used
<
soft
)
{
result
=
ISC_R_SUCCESS
;
...
...
@@ -74,7 +74,7 @@ isc_quota_reserve(isc_quota_t *quota) {
result
=
ISC_R_SOFTQUOTA
;
}
}
else
{
INSIST
(
atomic_fetch_sub
(
&
quota
->
__
used
,
1
)
>
0
);
INSIST
(
atomic_fetch_sub
(
&
quota
->
used
,
1
)
>
0
);
result
=
ISC_R_QUOTA
;
}
return
(
result
);
...
...
@@ -82,7 +82,7 @@ isc_quota_reserve(isc_quota_t *quota) {
void
isc_quota_release
(
isc_quota_t
*
quota
)
{
INSIST
(
atomic_fetch_sub
(
&
quota
->
__
used
,
1
)
>
0
);
INSIST
(
atomic_fetch_sub
(
&
quota
->
used
,
1
)
>
0
);
}
isc_result_t
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment