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

FreeBSD port of 4.2.2 kamailio, small issues #24

Closed
opsec opened this issue Jan 11, 2015 · 9 comments
Closed

FreeBSD port of 4.2.2 kamailio, small issues #24

opsec opened this issue Jan 11, 2015 · 9 comments

Comments

@opsec
Copy link

opsec commented Jan 11, 2015

FYI, in

https://lists.freebsd.org/pipermail/svn-ports-all/2015-January/082830.html

you can see the changes required to get kamailio 4.2.2 build as
the freebsd port. Can you integrate those changes upstream ?

@miconda
Copy link
Member

miconda commented Jan 11, 2015

Thanks for pointing out.

A clarification - that kind of define check was in two places, see next. The patch you refer to is updating on the second condition. The first one should stay?

#if defined (__OS_darwin) || defined (__OS_freebsd)
#include <sys/param.h>
#include <sys/sysctl.h>
#else
#include <unistd.h>
#endif

int get_num_cpus() {
    int count = 0;

#if defined (__OS_darwin) || defined (__OS_freebsd)
    int nm[2];
    size_t len;

@opsec
Copy link
Author

opsec commented Jan 11, 2015

I only build-tested it, and only with the one condition removed.

@miconda
Copy link
Member

miconda commented Jan 11, 2015

The code was more or less found on various places on the net, here is a link I found searching now:

It is a bit old, indeed, but shows that bsd was using the same way as mac os x. I didn't have a *BSD at hand to try, though. Maybe the GNU extension with _SC_NPROCESSORS_ONLN got into *BSD, but wonder if the includes are not different, as for Linux.

@opsec
Copy link
Author

opsec commented Jan 11, 2015

The second suggestion in the stackoverflow link says to use boost.
As kamailio already uses boost (?), that might be more portable ?

@miconda
Copy link
Member

miconda commented Jan 11, 2015

Kamailio is written in C and don't want to mix it here.

@opsec
Copy link
Author

opsec commented Jan 11, 2015

Then the sysctl with HW_NCPU will do, as will the sysconf() call.

@miconda
Copy link
Member

miconda commented Jan 11, 2015

I tried to figure out if we need to adjust the condition for included files or let it as it is:

#if defined (__OS_darwin) || defined (__OS_freebsd)

A 'man sysconf' on darwin shows that it needs:

#include <unistd.h>

No *BSD around, but I guess it will be the same, therefore I think the guard for the includes needs to be updated as well. Would you have a possibility to test that it compiles?

@opsec
Copy link
Author

opsec commented Jan 11, 2015

Same on FreeBSD: man sysconf says it needs unistd.h. So you can disable the __OS_freebsd in
both cases.

@miconda
Copy link
Member

miconda commented Jan 13, 2015

Commits pushed to master and 4.2 branches.

@miconda miconda closed this as completed Jan 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants