% limb manual
% term_ensurefg(3)
% limb 0.1.0
% 2023-07-24
# NAME
term\_ensurefg - ensure current process is in the foreground job if needed
# SYNOPSIS
#include <limb/term.h>
```pre hl
int term_ensurefg(int <em>fd</em>)
```
# 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*.