nsjail/macros.h

45 lines
1.6 KiB
C
Raw Normal View History

2015-05-15 05:44:48 +08:00
/*
nsjail - common macros
2015-05-15 05:44:48 +08:00
-----------------------------------------
Copyright 2014 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
2016-03-11 09:45:43 +08:00
#ifndef NS_COMMON_H
#define NS_COMMON_H
2015-05-15 05:44:48 +08:00
2018-02-10 12:25:55 +08:00
#include <unistd.h>
#if !defined(TEMP_FAILURE_RETRY)
#define TEMP_FAILURE_RETRY(expression) \
(__extension__({ \
long int __result; \
do __result = (long int)(expression); \
while (__result == -1L && errno == EINTR); \
__result; \
2018-02-10 12:25:55 +08:00
}))
#endif /* !defined(TEMP_FAILURE_RETRY) */
#if !defined(ARR_SZ)
#define ARR_SZ(array) (sizeof(array) / sizeof(*array))
#endif /* !defined(ARR_SZ) */
2016-03-09 01:22:50 +08:00
#define NS_VALSTR_STRUCT(x) \
{ (uint64_t) x, #x }
2017-10-09 05:06:40 +08:00
2017-10-09 05:00:45 +08:00
#endif /* NS_COMMON_H */