svn commit: r285356 - in head/sys: compat/cloudabi kern sys
Konstantin Belousov
kostikbel at gmail.com
Fri Jul 10 11:10:56 UTC 2015
On Fri, Jul 10, 2015 at 11:01:31AM +0000, Mateusz Guzik wrote:
> Author: mjg
> Date: Fri Jul 10 11:01:30 2015
> New Revision: 285356
> URL: https://svnweb.freebsd.org/changeset/base/285356
>
> Log:
> fd: split kern_dup flags argument into actual flags and a mode
>
> Tidy up the code inside to switch on the mode.
> + MPASS(mode < FDDUP_LASTMODE);
Since you started the FDDUP_ modes enum from 1, this assert does not fully
validate the mode. Am I wrong ?
> +/* Operation types for kern_dup(). */
> +enum {
> + FDDUP_NORMAL = 0x01, /* dup() behavior. */
> + FDDUP_FCNTL, /* fcntl()-style errors. */
> + FDDUP_FIXED, /* Force fixed allocation. */
> + FDDUP_MUSTREPLACE, /* Target must exist. */
> + FDDUP_LASTMODE,
> +};
> +
> /* Flags for kern_dup(). */
> -#define FDDUP_FIXED 0x1 /* Force fixed allocation. */
> -#define FDDUP_FCNTL 0x2 /* fcntl()-style errors. */
> -#define FDDUP_CLOEXEC 0x4 /* Atomically set FD_CLOEXEC. */
> -#define FDDUP_MUSTREPLACE 0x8 /* Target must exist. */
> +#define FDDUP_CLOEXEC 0x1 /* Atomically set FD_CLOEXEC. */
Consider using different prefixes for mode/flags ?
More information about the svn-src-all
mailing list