Opened 14 years ago

Closed 14 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:
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 14 years ago.

Download all attachments as: .zip

Change History (11)

by scottmc, 14 years ago

Attachment: O_BINARY.diff added

comment:1 by scottmc, 14 years ago

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 by stippi, 14 years ago

patch: 01

comment:3 by stippi, 14 years ago

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 by scottmc, 14 years ago

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 by korli, 14 years ago

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 by axeld, 14 years ago

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

in reply to:  5 ; comment:7 by scottmc, 14 years ago

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

in reply to:  7 comment:8 by bonefish, 14 years ago

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 by korli, 14 years ago

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

comment:10 by scottmc, 14 years ago

Resolution: fixed
Status: newclosed

Applied modified patch in hrev38962.

Note: See TracTickets for help on using tickets.