Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#11 Building under OS/2

closed
nobody
None
5
2003-11-02
2003-03-19
Yuri Dario
No

Hi,

here are the patches needed to build Bogofilter under OS/2.
Only real differences are the lack of fcntl(), so there is an emulation code based on native API, and optind must be reset to 0 (instead of 1) to make getopt() to work again (should be the same on other platforms).
Also unlocking the databases before closing is working better (see below).

All tests are ok except for t.lock2: here I see that instances are in an eternal loop, because it is quite hard to lock the two databases; I have an SMP system, and it happens that one process can lock only one db, because the other one is locked by another process.
I think database locking must be made atomical, e.g. using a single file to gain the lock.

I hope to see this patch added to cvs code.

TIA,

Yuri Dario

Discussion

  • Yuri Dario
    Yuri Dario
    2003-03-19

    OS/2 patch file

     
  • Yuri Dario
    Yuri Dario
    2003-03-19

    OS/2 handling for CRLF sequence

     
  • Yuri Dario
    Yuri Dario
    2003-03-29

    fix for passthrough memory mode

     
  • David Relson
    David Relson
    2003-04-01

    Logged In: YES
    user_id=30510

    Yuri,

    We're considering including your patches, though it probably
    won't be on this release cycle. I suggest subscribing to
    the bogofilter-dev list if you're really going to use
    bogofilter - after all you _are_ pioneering another O.S.

    David

     
  • Logged In: YES
    user_id=2788

    Well, some comments:

    1. the file must not be unlocked before the BerkeleyDB cache
    has been flushed. If you do that, you're heading for
    corruption (which is the likely reason for t.lock2 failure).
    If (for some reason) the file must be explicitly unlocked
    before closing it, then it _MUST_ be synched with
    BerkeleyDB's sync method (we have our db_flush() wrapper
    function) before unlocking -- unless DB_NOSYNC is used, that is.

    2. We don't use C++/C99-style // comments, but only
    C89-style /* */ comments. // choke some C compilers unless
    special options are given.

    3. We should not introduce OS-specific comments into regular
    files, but encapsulate the portability code (such as the EMX
    locking code) in separate files, such as a generic_lock.c or
    something. We'll have to define our own API for the locking
    function, and then the locking function itself may switch
    behaviour between OS/2 EMX and POSIX.

    4a. GNU libc (Linux's most common libc) documents on the
    topic of "optind": "The initial value of this variable is
    `1'." FreeBSD documents "The variable opterr and optind are
    both initialized to 1. The optind variable may be set to
    another value before a set of calls to getopt() in order to
    skip over more or less argv entries." With GNU libc, the
    default of opterr is 1.

    4b. setting opterr to 0 defeats printing error messages and
    changes behaviour. This is inacceptable.

    4c. 4a and 4b also apply to Solaris 8.

    5. what is fopen("rt") supposed to do? ANSI-C doesn't seem
    to document the t. If it means "text mode", then ANSI-C
    already specifies "r" means "text mode" and "rb" means
    "binary mode".

    6. ignoring CR should not happen in fgetsl() -- fgets()
    doesn't do that either. If we need a function that ignores
    CR, then it needs to wrap around fgetsl() instead.

    7. I suggest that the _fsetmode EMX stuff moves into a
    separate function emx_init() or something, and a
    os_spec_init() function that calls it.

     
  • Logged In: YES
    user_id=2788

    Can this tracker item be closed? If so, set it to "Closed".

    It will go to deleted unless a followup is received within a fortnight.

     
    • status: open --> pending
     
  • Yuri Dario
    Yuri Dario
    2003-11-02

    • status: pending --> closed