/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
\f
/* Process title. */
-#ifdef LINUX_DATAPATH
+#ifdef __linux__
static struct ovs_mutex proctitle_mutex = OVS_MUTEX_INITIALIZER;
/* Start of command-line arguments in memory. */
}
ovs_mutex_unlock(&proctitle_mutex);
}
-#else /* !LINUX_DATAPATH*/
+#else /* !__linux__ */
/* Stubs that don't do anything on non-Linux systems. */
void
proctitle_restore(void)
{
}
-#endif /* !LINUX_DATAPATH */
+#endif /* !__linux__ */
/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
COVERAGE_DEFINE(dpif_execute_with_help);
static const struct dpif_class *base_dpif_classes[] = {
-#ifdef LINUX_DATAPATH
+#ifdef __linux__
&dpif_linux_class,
#endif
&dpif_netdev_class,
fatal_signal_add_hook(restore_all_flags, NULL, NULL, true);
netdev_vport_patch_register();
-#ifdef LINUX_DATAPATH
+#ifdef __linux__
netdev_register_provider(&netdev_linux_class);
netdev_register_provider(&netdev_internal_class);
netdev_register_provider(&netdev_tap_class);
#include "poll-loop.h"
#include "util.h"
#include "vlog.h"
-#if AF_PACKET && LINUX_DATAPATH
+#ifdef __linux__
#include <linux/if_packet.h>
#endif
#ifdef HAVE_NETLINK
/* #ifdefs make it a pain to maintain code: you have to try to build both ways.
* Thus, this file compiles all of the code regardless of the target, by
- * writing "if (LINUX_DATAPATH)" instead of "#ifdef __linux__". */
-#ifndef LINUX_DATAPATH
-#define LINUX_DATAPATH 0
+ * writing "if (LINUX)" instead of "#ifdef __linux__". */
+#ifdef __linux__
+#define LINUX 0
+#else
+#define LINUX 1
#endif
#ifndef O_DIRECTORY
*
* On other Unix-like OSes, MSG_TRUNC has no effect in the flags
* argument. */
- char buffer[LINUX_DATAPATH ? 1 : 2048];
+ char buffer[LINUX ? 1 : 2048];
ssize_t n_bytes = recv(fd, buffer, sizeof buffer,
MSG_TRUNC | MSG_DONTWAIT);
if (n_bytes <= 0 || n_bytes >= rcvbuf) {
int dirfd;
int len;
- if (!LINUX_DATAPATH) {
+ if (LINUX) {
return ENAMETOOLONG;
}
}
}
#endif
-#if AF_PACKET && LINUX_DATAPATH
+#if __linux__
else if (ss.ss_family == AF_PACKET) {
struct sockaddr_ll sll;
}
-#ifdef LINUX_DATAPATH
+#ifdef __linux__
static void
put_fd_filename(struct ds *string, int fd)
{
: S_ISFIFO(s.st_mode) ? "FIFO"
: S_ISLNK(s.st_mode) ? "symbolic link"
: "unknown"));
-#ifdef LINUX_DATAPATH
+#ifdef __linux__
put_fd_filename(&string, fd);
#endif
}
/*
- * Copyright (c) 2011, 2013 Nicira, Inc.
+ * Copyright (c) 2011, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
int (*vd_del)(const char *vlan_dev);
};
-#ifdef LINUX_DATAPATH
+#ifdef __linux__
static const struct vlandev_class vlandev_linux_class;
#endif
static const struct vlandev_class vlandev_stub_class;
vlandev_get_class(void)
{
if (!vd_class) {
-#ifdef LINUX_DATAPATH
+#if __linux__
vd_class = &vlandev_linux_class;
#else
vd_class = &vlandev_stub_class;
\f
/* The Linux vlandev implementation. */
-#ifdef LINUX_DATAPATH
+#ifdef __linux__
#include "rtnetlink-link.h"
#include <linux/if_vlan.h>
#include <linux/sockios.h>
-/* Copyright (c) 2010, 2012, 2013 Nicira, Inc.
+/* Copyright (c) 2010, 2012, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/* #ifdefs make it a pain to maintain code: you have to try to build both ways.
* Thus, this file tries to compile as much of the code as possible regardless
- * of the target, by writing "if (LINUX_DATAPATH)" instead of "#ifdef
- * __linux__" where this is possible. */
-#ifdef LINUX_DATAPATH
+ * of the target, by writing "if (LINUX)" instead of "#ifdef __linux__" where
+ * this is possible. */
+#ifdef __linux__
+#define LINUX 1
#include <asm/param.h>
#else
-#define LINUX_DATAPATH 0
+#define LINUX 0
#endif
static void
static void
get_memory_stats(struct smap *stats)
{
- if (!LINUX_DATAPATH) {
+ if (!LINUX) {
unsigned int pagesize = get_page_size();
#ifdef _SC_PHYS_PAGES
long int phys_pages = sysconf(_SC_PHYS_PAGES);
static long long int cache_expiration = LLONG_MIN;
static long long int boot_time;
- ovs_assert(LINUX_DATAPATH);
+ ovs_assert(LINUX);
if (time_msec() >= cache_expiration) {
static const char stat_file[] = "/proc/stat";
static unsigned long long int
ticks_to_ms(unsigned long long int ticks)
{
- ovs_assert(LINUX_DATAPATH);
+ ovs_assert(LINUX);
#ifndef USER_HZ
#define USER_HZ 100
FILE *stream;
int n;
- ovs_assert(LINUX_DATAPATH);
+ ovs_assert(LINUX);
sprintf(file_name, "/proc/%lu/stat", (unsigned long int) pid);
stream = fopen(file_name, "r");
int crashes = 0;
FILE *stream;
- ovs_assert(LINUX_DATAPATH);
+ ovs_assert(LINUX);
sprintf(file_name, "/proc/%lu/cmdline", (unsigned long int) pid);
stream = fopen(file_name, "r");
{
struct raw_process_info child;
- ovs_assert(LINUX_DATAPATH);
+ ovs_assert(LINUX);
if (!get_raw_process_info(pid, &child)) {
return false;
}
key = xasprintf("process_%.*s",
(int) (extension - de->d_name), de->d_name);
if (!smap_get(stats, key)) {
- if (LINUX_DATAPATH && get_process_info(pid, &pinfo)) {
+ if (LINUX && get_process_info(pid, &pinfo)) {
smap_add_format(stats, key, "%lu,%lu,%lld,%d,%lld,%lld",
pinfo.vsz, pinfo.rss, pinfo.cputime,
pinfo.crashes, pinfo.booted, pinfo.uptime);