Welcome to little lamb

Code » limb » master » tree

[master] / src / doc / djbunix.h / coe.3.md

% limb manual
% coe(3)
% limb 0.1.0
% 2023-07-24

# NAME

coe, uncoe - ensure a file descriptor is/isn't close-on-exec
ndelay_on, ndelay_off - ensure a file descriptor is/isn't in blocking mode

# SYNOPSIS

    #include <limb/djbunix.h>

```pre hl
int coe(int <em>fd</em>)
int uncoe(int <em>fd</em>)

int ndelay_on(int <em>fd</em>)
int ndelay_off(int <em>fd</em>)
```

# DESCRIPTION

The `coe`() function ensures the file descriptor `fd` has the *O_CLOEXEC* flag
set, setting it if needed.

The `uncoe`() function ensures the file descriptor `fd` has the *O_CLOEXEC* flag
clear, clearing it if needed.

The `ndelay_on`() function ensures the file descriptor `fd` has the *O_NONBLOCK*
flag set, setting it if needed.

The `ndelay_off`() function ensures the file descriptor `fd` has the
*O_NONBLOCK* flag clear, clearing it if needed.

# RETURN VALUE

On success, these functions return a value other than -1. Otherwise, they
return -1 and set `errno` to indicate the error.

# ERRORS

These functions may fail and set `errno` for any of the errors specified for
[fcntl](3) (with either *F_GETFL* or *F_SETFL*).