SourceForge has been redesigned. Learn more.
Close

#18 FreeBSD patches

Unstable_(example)
accepted
None
1
2014-04-04
2014-01-13
Anonymous
No

This patch addresses an issue with compiling on FreeBSD (8.4 and 9.2 at least):

In file included from ../../../owlib/src/include/ow.h:117,
from getopt.c:32:
/usr/include/signal.h:49: error: 'NSIG' undeclared here (not in a function)
In file included from ../../../owlib/src/include/ow.h:126,
from getopt.c:32:
/usr/include/unistd.h:554: error: expected declaration specifiers or '...' before 'fd_set'
/usr/include/unistd.h:554: error: expected declaration specifiers or '...' before 'fd_set'
/usr/include/unistd.h:554: error: expected declaration specifiers or '...' before 'fd_set'
/usr/include/unistd.h:573: error: expected declaration specifiers or '...' before 'u_long'
/usr/include/unistd.h:573: error: expected declaration specifiers or '...' before 'u_long'
*** Error code 1

The problem here is that ow.h defines __BSD_VISIBLE when sys/types.h is included, but not when sys/param.h is included, which confuses the FreeBSD internals.
Patch moves the def to above all includes.

Patch against 2.9p1 (CVS has same issue in ow.h).

1 Attachments

Discussion

  • Johan Ström

    Johan Ström - 2014-01-13

    (Oops, wasn't logged in. Also, another patch).

    This patch addresses a segfault issue when one tries to start too many OW** products on FreeBSD.
    Since the owlib and the apps relies heavily on SYSV semaphores, this becomes a choking point on FreeBSD which has a limited number of available ones, making sem_init fail.
    No error checking is present on sem_init, and sem_wait will be called with a bad value (0 or other) which causes segfault.

    This patch creates an my_sem_init wrapper which checks the error..
    You might want to adjust the implementation a bit, it currently reports failures with fprintf(stderr, instead of the FATAL_ERROR macro which is used by the other ones there.. The reason is that the FATAL_ERROR macro didn't actually output anything, even if I was running with --debug and --foreground..
    Also, might not want to exit() but fail cleanly somehow.

    Another question, why is FATAL_ERROR defined as a no-op if we are not compiled with debug? Fatal sounds like it should make some noise at least..

     
    Last edit: Johan Ström 2014-01-13
  • Paul Alfille

    Paul Alfille - 2014-01-19

    Thanks for the patches. I'll include and look at them in detail!

     
  • Paul Alfille

    Paul Alfille - 2014-04-04
    • status: open --> accepted
    • assigned_to: Paul Alfille
     

Anonymous
Anonymous

Cancel  Add attachments