mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-12 06:24:56 +00:00
7520e4ff57
When namespaces are disabled, support is still reported because the file is built with almost nothing in it but built anyway. Instead of extending the scope of the numerous ifdefs in this file, better avoid building it when namespaces are diabled. In this case we define my_socketat() as an inline function mapping directly to socket(). The struct netns_entry still needs to be defined because it's used by various other functions in the code.
34 lines
689 B
C
34 lines
689 B
C
#ifndef _NAMESPACE_H
|
|
#define _NAMESPACE_H
|
|
|
|
#include <stdlib.h>
|
|
#include <ebistree.h>
|
|
|
|
#ifdef CONFIG_HAP_NS
|
|
|
|
struct netns_entry
|
|
{
|
|
struct ebpt_node node;
|
|
size_t name_len;
|
|
int fd;
|
|
};
|
|
|
|
int my_socketat(const struct netns_entry *ns, int domain, int type, int protocol);
|
|
struct netns_entry* netns_store_insert(const char *ns_name);
|
|
const struct netns_entry* netns_store_lookup(const char *ns_name, size_t ns_name_len);
|
|
|
|
int netns_init(void);
|
|
|
|
#else /* no namespace support */
|
|
|
|
struct netns_entry;
|
|
|
|
static inline int my_socketat(const struct netns_entry *ns, int domain, int type, int protocol)
|
|
{
|
|
return socket(domain, type, protocol);
|
|
}
|
|
|
|
#endif /* CONFIG_HAP_NS */
|
|
|
|
#endif /* _NAMESPACE_H */
|