tcgetpgrp(3)

tcgetpgrp3

Get foreground process group id

Usage

#include <unistd.h>

pid_t

tcgetpgrp(int fildes);

Library

Standard C Library (libc, -lc)

Overview

The tcgetpgrp() function returns the value of the process group ID of the foreground process group associated with the terminal device. If there is no foreground process group, tcgetpgrp() returns an invalid process ID.

Errors

If an error occurs, tcgetpgrp() returns -1 and the global variable errno is set to indicate the error, as follows:

[EBADF]

The fildes argument is not a valid file descriptor.

[ENOTTY]

The calling process does not have a controlling terminal or the underlying terminal device represented by fildes is not the controlling terminal.

Legacy synopsis

#include <sys/types.h> #include <unistd.h>

The include file ⟨sys/types.h⟩ is necessary.

Releases

163 releases since Mac OS X 10.0; the text changed 2 times.

  1. 10.0–10.1.5
  2. 10.2–10.4.11
  3. 10.5–26.5

Standards

The tcgetpgrp() function is expected to be compliant with the IEEE Std 1003.1-1988 (“POSIX.1”) specification.

From Libc 1752.120.2 in macOS 26.5. Parsed by carta from the page's mdoc source.