Opened 9 years ago

Closed 9 years ago

#6705 closed bug (fixed)

O_BINARY and O_TEXT have no effect and no value, should be removed from <fcntl.h> header

Reported by: scottmc Owned by: scottmc
Priority: normal Milestone: R1
Component: - General Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: yes Platform: All

Description

Having O_BINARY and O_TEXT defined in Haiku causes issues when ports detect their presence but then don't work as expected. Investigate whether removing them will cause any build breakage.

Attachments (1)

O_BINARY.diff (4.1 KB) - added by scottmc 9 years ago.

Download all attachments as: .zip

Change History (11)

Changed 9 years ago by scottmc

Attachment: O_BINARY.diff added

comment:1 Changed 9 years ago by scottmc

I got Haiku to build after removing O_TEXT and O_BINARY, only things that needed to be patched so far was gawk and Serial and Parallel Transports, none of which would appear to be showstoppers.

comment:2 Changed 9 years ago by stippi

Has a Patch: set

comment:3 Changed 9 years ago by stippi

Patch looks fine to me. Theoretically, one could only comment the defines in the header, perhaps with a comment that they are unsupported on Haiku as of yet. But not having them there makes that obvious, too, of course.

comment:4 Changed 9 years ago by scottmc

The patch to gawk was just a quick and dirty one to get Haiku to build. I'm going to try building it from the full gawk source to see if I can put together a cleaner patch for it that can then be upstreamed. The other parts should be ok for applying after a bit of testing.

comment:5 Changed 9 years ago by korli

What annoys me is: O_BINARY should be the default anyway, so why the need for removing it? O_BINARY could be defined to zero.

I would have expected O_TEXT use to be problematic.

comment:6 Changed 9 years ago by axeld

In any case, neither O_BINARY, nor O_TEXT is part of the POSIX specification.

comment:7 in reply to:  5 ; Changed 9 years ago by scottmc

Replying to korli:

What annoys me is: O_BINARY should be the default anyway, so why the need for removing it? O_BINARY could be defined to zero.

I would have expected O_TEXT use to be problematic.

At least in gnulib lib if O_BINARY isn't defined they define it to be 0 and then create an inline function handle cases where they are trying to make use of it: http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/binary-io.h;h=5451fd48f4d61be96319d87655a9213b85a7d3b6;hb=HEAD

comment:8 in reply to:  7 Changed 9 years ago by bonefish

Replying to scottmc:

At least in gnulib lib if O_BINARY isn't defined they define it to be 0 and then create an inline function handle cases where they are trying to make use of it: http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/binary-io.h;h=5451fd48f4d61be96319d87655a9213b85a7d3b6;hb=HEAD

GNU/Linux (at least OpenSuse) doesn't define O_BINARY, not even with _GNU_SOURCE defined, so I've no clue why gnulib would define it (after all their mission is to make other systems more GNUish). At any rate, since it's neither in POSIX nor in GNU/Linux, from a porting point of view it should be totally safe to omit it.

comment:9 Changed 9 years ago by korli

If it wasn't defined in BeOS headers, that's fine to have definitions removed.

comment:10 Changed 9 years ago by scottmc

Resolution: fixed
Status: newclosed

Applied modified patch in hrev38962.

Note: See TracTickets for help on using tickets.