[LTP] [PATCH] fcntl.2: F_OFD_XXX needs flock64

Cyril Hrubis chrubis@suse.cz
Wed Aug 17 15:19:20 CEST 2016


Hi!
> > Hmm, I do not think that this is a good idea. The usuall way how to
> > handle missing constants are fallback definitions such as:
> > 
> > #ifndef F_OFD_FOO
> > # define F_OFD_FOO xyz
> > #endif
> > 
> > This wouldn't do much.
> > 
> > Also these should be only disable on 32bit if __USE_FILE_OFFSET64 is
> > not
> > defined. But you likely meant that here.
> > 
> 
> That's the usual way, but in this case we wouldn't have a fallback
> constant. You'd just get an error about F_OFD_* being undefined at
> build time, which I think is what we'd want here. It's better to fail
> to compile than to build a binary that passes a bogus struct into the
> kernel.

You probably misunderstand what I was trying to say. If you look at the
sources out there (for instance at https://codesearch.debian.net/) most
of it has fallback definitions for F_OFD_* constants included in its own
header files since these flags are relatively new. Not defining these
would not accomplish anything.

One option would be to define them to something invalid such as INT_MAX
so that it's rejected by kernel on runtime. But I do not think this is
very good idea either.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list