Flags as a system call API design pattern
Flags as a system call API design pattern
Posted Feb 13, 2014 14:35 UTC (Thu) by kugel (subscriber, #70540)In reply to: Flags as a system call API design pattern by paulj
Parent article: Flags as a system call API design pattern
Optional flags (those that you would like to be ignored if unknown or unsupport for whatever reason) should can be handled in user space, for example by retrying the syscall without the flag, without adding more measures into syscall interface.
Posted Feb 13, 2014 15:08 UTC (Thu)
by paulj (subscriber, #341)
[Link]
Generally, to be able to introduce new mandatory flags, while allowing optional flags, you need either to distinguish between mandatory flags and optional in the API in some way, or you need some other way to allow the application to feature-test at runtime (but what if it forgets to do this, and then gets run on an old kernel?).
Otherwise, you need to rely on being able to find an API useage-specific hack that happens to work, as was done for open/O_TMPFILE, by also setting some other unrelated flags that *would* together cause an error on older kernels. ;) These kind of API-specific hacks might not always be available.
Flags as a system call API design pattern