Skip to content

Commit

Permalink
libsepol: do not #include <sys/cdefs.h>
Browse files Browse the repository at this point in the history
ratbert90 submitted this patch via
#19.
Apparently musl does not provide sys/cdefs.h, see
http://wiki.musl-libc.org/wiki/FAQ#Q:_I.27m_trying_to_compile_something_against_musl_and_I_get_error_messages_about_sys.2Fcdefs.h.

Signed-off-by: Stephen Smalley <[email protected]>
  • Loading branch information
stephensmalley committed Nov 29, 2016
1 parent c034875 commit cf8625b
Show file tree
Hide file tree
Showing 38 changed files with 266 additions and 116 deletions.
10 changes: 7 additions & 3 deletions libsepol/include/sepol/boolean_record.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

#include <stddef.h>
#include <sepol/handle.h>
#include <sys/cdefs.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

struct sepol_bool;
struct sepol_bool_key;
Expand Down Expand Up @@ -51,5 +52,8 @@ extern int sepol_bool_clone(sepol_handle_t * handle,

extern void sepol_bool_free(sepol_bool_t * boolean);

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif
10 changes: 7 additions & 3 deletions libsepol/include/sepol/booleans.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#include <sepol/policydb.h>
#include <sepol/boolean_record.h>
#include <sepol/handle.h>
#include <sys/cdefs.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

/*--------------compatibility--------------*/

Expand Down Expand Up @@ -59,5 +60,8 @@ extern int sepol_bool_iterate(sepol_handle_t * handle,
int (*fn) (const sepol_bool_t * boolean,
void *fn_arg), void *arg);

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif
10 changes: 7 additions & 3 deletions libsepol/include/sepol/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#include <sepol/context_record.h>
#include <sepol/policydb.h>
#include <sepol/handle.h>
#include <sys/cdefs.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

/* -- Deprecated -- */

Expand All @@ -26,5 +27,8 @@ extern int sepol_mls_contains(sepol_handle_t * handle,
extern int sepol_mls_check(sepol_handle_t * handle,
const sepol_policydb_t * policydb, const char *mls);

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif
10 changes: 7 additions & 3 deletions libsepol/include/sepol/context_record.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#define _SEPOL_CONTEXT_RECORD_H_

#include <sepol/handle.h>
#include <sys/cdefs.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

struct sepol_context;
typedef struct sepol_context sepol_context_t;
Expand Down Expand Up @@ -53,5 +54,8 @@ extern int sepol_context_from_string(sepol_handle_t * handle,
extern int sepol_context_to_string(sepol_handle_t * handle,
const sepol_context_t * con, char **str_ptr);

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif
10 changes: 7 additions & 3 deletions libsepol/include/sepol/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#define _SEPOL_DEBUG_H_

#include <sepol/handle.h>
#include <sys/cdefs.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

/* Deprecated */
extern void sepol_debug(int on);
Expand Down Expand Up @@ -35,5 +36,8 @@ extern void sepol_msg_set_callback(sepol_handle_t * handle,
const char *fmt, ...),
void *msg_callback_arg);

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif
10 changes: 7 additions & 3 deletions libsepol/include/sepol/errcodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#define __sepol_errno_h__

#include <errno.h>
#include <sys/cdefs.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

#define SEPOL_OK 0

Expand All @@ -25,5 +26,8 @@ __BEGIN_DECLS
#define SEPOL_EEXIST -EEXIST
#define SEPOL_ENOENT -ENOENT

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif
11 changes: 7 additions & 4 deletions libsepol/include/sepol/handle.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef _SEPOL_HANDLE_H_
#define _SEPOL_HANDLE_H_

#include <sys/cdefs.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

struct sepol_handle;
typedef struct sepol_handle sepol_handle_t;
Expand Down Expand Up @@ -35,5 +35,8 @@ int sepol_get_preserve_tunables(sepol_handle_t * sh);
* 0 is default and discard such branch, 1 preserves them */
void sepol_set_preserve_tunables(sepol_handle_t * sh, int preserve_tunables);

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif
10 changes: 7 additions & 3 deletions libsepol/include/sepol/iface_record.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

#include <sepol/handle.h>
#include <sepol/context_record.h>
#include <sys/cdefs.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

struct sepol_iface;
struct sepol_iface_key;
Expand Down Expand Up @@ -59,5 +60,8 @@ extern int sepol_iface_clone(sepol_handle_t * handle,

extern void sepol_iface_free(sepol_iface_t * iface);

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif
10 changes: 7 additions & 3 deletions libsepol/include/sepol/interfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#include <sepol/policydb.h>
#include <sepol/iface_record.h>
#include <sepol/handle.h>
#include <sys/cdefs.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

/* Return the number of interfaces */
extern int sepol_iface_count(sepol_handle_t * handle,
Expand Down Expand Up @@ -43,5 +44,8 @@ extern int sepol_iface_iterate(sepol_handle_t * handle,
int (*fn) (const sepol_iface_t * iface,
void *fn_arg), void *arg);

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif
10 changes: 7 additions & 3 deletions libsepol/include/sepol/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@

#include <sepol/handle.h>
#include <sepol/policydb.h>
#include <sys/cdefs.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

struct sepol_module_package;
typedef struct sepol_module_package sepol_module_package_t;
Expand Down Expand Up @@ -82,5 +83,8 @@ extern int sepol_expand_module(sepol_handle_t * handle,
sepol_policydb_t * base,
sepol_policydb_t * out, int verbose, int check);

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif
10 changes: 7 additions & 3 deletions libsepol/include/sepol/node_record.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#include <stddef.h>
#include <sepol/context_record.h>
#include <sepol/handle.h>
#include <sys/cdefs.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

struct sepol_node;
struct sepol_node_key;
Expand Down Expand Up @@ -92,5 +93,8 @@ extern int sepol_node_clone(sepol_handle_t * handle,

extern void sepol_node_free(sepol_node_t * node);

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif
10 changes: 7 additions & 3 deletions libsepol/include/sepol/nodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
#include <sepol/handle.h>
#include <sepol/policydb.h>
#include <sepol/node_record.h>
#include <sys/cdefs.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

/* Return the number of nodes */
extern int sepol_node_count(sepol_handle_t * handle,
Expand Down Expand Up @@ -40,5 +41,8 @@ extern int sepol_node_iterate(sepol_handle_t * handle,
int (*fn) (const sepol_node_t * node,
void *fn_arg), void *arg);

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif
10 changes: 7 additions & 3 deletions libsepol/include/sepol/policydb.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#include <stdio.h>

#include <sepol/handle.h>
#include <sys/cdefs.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

struct sepol_policy_file;
typedef struct sepol_policy_file sepol_policy_file_t;
Expand Down Expand Up @@ -144,5 +145,8 @@ extern int sepol_policydb_mls_enabled(const sepol_policydb_t * p);
*/
extern int sepol_policydb_compat_net(const sepol_policydb_t * p);

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif
10 changes: 7 additions & 3 deletions libsepol/include/sepol/policydb/avrule_block.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
#define _SEPOL_AVRULE_BLOCK_H_

#include <sepol/policydb/policydb.h>
#include <sys/cdefs.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

extern avrule_block_t *avrule_block_create(void);
extern void avrule_block_destroy(avrule_block_t * x);
Expand All @@ -37,5 +38,8 @@ extern cond_list_t *get_decl_cond_list(policydb_t * p,
extern int is_id_enabled(char *id, policydb_t * p, int symbol_table);
extern int is_perm_enabled(char *class_id, char *perm_id, policydb_t * p);

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif
10 changes: 7 additions & 3 deletions libsepol/include/sepol/policydb/avtab.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@
#ifndef _SEPOL_POLICYDB_AVTAB_H_
#define _SEPOL_POLICYDB_AVTAB_H_

#include <sys/cdefs.h>
#include <sys/types.h>
#include <stdint.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

typedef struct avtab_key {
uint16_t source_type;
Expand Down Expand Up @@ -142,7 +143,10 @@ extern avtab_ptr_t avtab_search_node_next(avtab_ptr_t node, int specified);
/* avtab_alloc uses one bucket per 2-4 elements, so adjust to get maximum buckets */
#define MAX_AVTAB_SIZE (MAX_AVTAB_HASH_BUCKETS << 1)

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif /* _AVTAB_H_ */

/* FLASK */
10 changes: 7 additions & 3 deletions libsepol/include/sepol/policydb/conditional.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
#include <sepol/policydb/avtab.h>
#include <sepol/policydb/symtab.h>
#include <sepol/policydb/policydb.h>
#include <sys/cdefs.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

#define COND_EXPR_MAXDEPTH 10

Expand Down Expand Up @@ -136,5 +137,8 @@ extern int cond_read_list(policydb_t * p, cond_list_t ** list, void *fp);
extern void cond_compute_av(avtab_t * ctab, avtab_key_t * key,
struct sepol_av_decision *avd);

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif /* _CONDITIONAL_H_ */
9 changes: 7 additions & 2 deletions libsepol/include/sepol/policydb/constraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
#include <sepol/policydb/ebitmap.h>
#include <sepol/policydb/flask_types.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

#define CEXPR_MAXDEPTH 5

Expand Down Expand Up @@ -73,7 +75,10 @@ struct policydb;
extern int constraint_expr_init(constraint_expr_t * expr);
extern void constraint_expr_destroy(constraint_expr_t * expr);

__END_DECLS
#ifdef __cplusplus
}
#endif

#endif /* _CONSTRAINT_H_ */

/* FLASK */
Loading

0 comments on commit cf8625b

Please sign in to comment.