Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: include: Redo some includes for FreeBSD #15337

Merged
merged 2 commits into from May 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/common/SubProcess.h
Expand Up @@ -24,6 +24,10 @@
#include <iostream>
#include <include/assert.h>
#include <common/errno.h>
#if defined(__FreeBSD__)
#include <sys/types.h>
#include <signal.h>
#endif

/**
* SubProcess:
Expand Down
5 changes: 4 additions & 1 deletion src/common/event_socket.h
Expand Up @@ -17,8 +17,11 @@
#ifndef CEPH_COMMON_EVENT_SOCKET_H
#define CEPH_COMMON_EVENT_SOCKET_H

#include "include/event_type.h"
#include <unistd.h>
#if defined(__FreeBSD__)
#include <errno.h>
#endif
#include "include/event_type.h"

class EventSocket {
int socket;
Expand Down
7 changes: 5 additions & 2 deletions src/common/io_priority.cc
Expand Up @@ -12,14 +12,17 @@
*
*/

#include "io_priority.h"

#include <unistd.h>
#if defined(__FreeBSD__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any problem making it similar ? I mean putting an #ifdef, which is similar to the other checks (linux)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joscollin
I've been using #if defined() for all my submissions.
This will allow me an easy grep to find all typical FreeBSD stuff.
And in the whole code there is a mismatch of all the possible forms.

#include <errno.h>
#endif
#ifdef __linux__
#include <sys/syscall.h> /* For SYS_xxx definitions */
#endif
#include <algorithm>

#include "io_priority.h"

pid_t ceph_gettid(void)
{
#ifdef __linux__
Expand Down
8 changes: 7 additions & 1 deletion src/common/ipaddr.cc
@@ -1,9 +1,15 @@
#include "include/ipaddr.h"

#include <arpa/inet.h>
#include <ifaddrs.h>
#include <stdlib.h>
#include <string.h>
#if defined(__FreeBSD__)
#include <sys/types.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just noticed that this is newly added. But It is fine, if it is necessary in FreeBSD.

#include <sys/socket.h>
#include <netinet/in.h>
#endif

#include "include/ipaddr.h"

static void netmask_ipv4(const struct in_addr *addr,
unsigned int prefix_len,
Expand Down
3 changes: 3 additions & 0 deletions src/common/module.c
Expand Up @@ -15,6 +15,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined(__FreeBSD__)
#include <sys/wait.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just noticed that this is newly added. But It is fine, if it is necessary in FreeBSD.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joscollin
I'm not quite sure why these would be newly added.
The older version I have does have this include.
It even works without the #if

#endif

/*
* TODO: Switch to libkmod when we abandon older platforms. The APIs
Expand Down
1 change: 1 addition & 0 deletions src/erasure-code/isa/ErasureCodePluginIsa.cc
Expand Up @@ -25,6 +25,7 @@

// -----------------------------------------------------------------------------
#include "ceph_ver.h"
#include "include/buffer.h"
#include "ErasureCodePluginIsa.h"
#include "ErasureCodeIsa.h"
// -----------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/test/test_ipaddr.cc
Expand Up @@ -4,6 +4,7 @@
#if defined(__FreeBSD__)
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#endif
#include <arpa/inet.h>
#include <ifaddrs.h>
Expand Down