limb 0.2.0

2024-01-09

term_ensurefg(3)
limb manual
term_ensurefg(3)

NAME

term_ensurefg - ensure current process is in the foreground job if needed

SYNOPSIS

#include <limb/term.h>
int term_ensurefg(int fd)

DESCRIPTION

The term_ensurefg() function will make sure the current process is in the foreground process group of its controlling terminal, which must be referred to by fd.

Note

To do so, the SIGTTOU signal will be ignored during the execution of the function (so it doesn't get send and blocks the process whilst setting the terminal foreground process group) then restored to its original handling state.

RETURN VALUE

The term_ensurefg() function returns 1 on success, otherwise it returns 0 and sets errno to indicate the error.

ERRORS

The term_ensurefg() function may fail and set errno for any of the errors described for tcsetpgrp(3) except EINVAL and EPERM.

limb 0.1.0
2023-07-24
term_ensurefg(3)