Skip to content

listen does not allow specifying a negative backlog #2264

Closed
@asomers

Description

@asomers

The listen function, in C, takes a "backlog" argument as an int. It normally must be positive. However, it may be ngative:

  • On FreeBSD, since version 2.2, to use the maximum value
  • On Linux, as an undocumented feature, to use a default value, at least according to @devnexen .

But when listen was added to Nix in change f85e9bf , the backlog argument's type was specified as usize, which precludes negative values. It also will rollover at i32::MAX_VALUE with unpredictable consequences.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions