---
name: "notcurses_fds"
section: "3"
platform: "linux"
package: "notcurses"
version: "3.0.17-3"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/notcurses_fds"
---

# notcurses\_fds(3)

dumping file descriptors and subprocesses to planes

## NAME

notcurses\_fds - dumping file descriptors and subprocesses to planes

## SYNOPSIS

**#include \<notcurses/notcurses.h\>**

-

  ```
  struct ncplane;
  struct ncfdplane;
  struct ncsubproc;
  typedef struct ncfdplane_options {
    void* curry; // parameter provided to callbacks
    bool follow; // keep reading after hitting end?
  } ncfdplane_options;
  typedef struct ncsubproc_options {
    void* curry; // parameter provided to callbacks
    uint64_t restart_period;  // restart after exit
  } ncsubproc_options;
  ```

**typedef int(*****ncfdplane\_callback)(struct ncfdplane*** *n***, const void\*** *buf***, size\_t** *s***, void\*** *curry***);**

**typedef int(*****ncfdplane\_done\_cb)(struct ncfdplane*** *n***, int** *fderrno***, void\*** *curry***);**

**struct ncfdplane\* ncfdplane\_create(struct ncplane\*** *n***, const ncfdplane\_options\*** *opts***, int** *fd***, ncfdplane\_callback** *cbfxn***, ncfdplane\_done\_cb** *donecbfxn***);**

**struct ncplane\* ncfdplane\_plane(struct ncfdplane\*** *n***);**

**int ncfdplane\_destroy(struct ncfdplane\*** *n***);**

**struct ncsubproc\* ncsubproc\_createv(struct ncplane\*** *n***, const ncsubproc\_options\*** *opts***, const char\*** *bin***, char\*** **const** *arg***\[\], ncfdplane\_callback** *cbfxn***, ncfdplane\_done\_cb** *donecbfxn***);**

**struct ncsubproc\* ncsubproc\_createvp(struct ncplane\*** *n***, const ncsubproc\_options\*** *opts***, const char\*** *bin***, char\*** **const** *arg***\[\], ncfdplane\_callback** *cbfxn***, ncfdplane\_done\_cb** *donecbfxn***);**

**struct ncsubproc\* ncsubproc\_createvpe(struct ncplane\*** *n***, const ncsubproc\_options\*** *opts***, const char\*** *bin***, char\*** **const** *arg***\[\], char\* const** *env***\[\],** **ncfdplane\_callback** *cbfxn***, ncfdplane\_done\_cb** *donecbfxn***);**

**struct ncplane\* ncsubproc\_plane(struct ncsubproc\*** *n***);**

**int ncsubproc\_destroy(struct ncsubproc\*** *n***);**

## DESCRIPTION

These widgets cause a file descriptor to be read until EOF, and written to a scrolling **ncplane**. The reading will take place in a notcurses-managed context (the particulars of this context are not defined, and should not be depended upon), which will invoke the provided callbacks with the data read. Essentially, they are simply portable interfaces to asynchronous reading, with **ncsubproc** also providing subprocess management.

If **ncsubproc\_destroy** is called before the subprocess has exited, it will be sent a SIGKILL. If **ncsubproc\_destroy** or **ncfdplane\_destroy** is called while a callback is being invoked, the destroy function will block until the callback is done being invoked. If a user callback returns non-0, the calling object will destroy itself. If a user callback calls the relevant destroy function itself, the thread will exit as if non-0 had been returned, and the **ncsubproc**'s resources will at that time be reclaimed.

It is essential that the destroy function be called once and only once, whether it is from within the thread's context, or external to that context.

## NOTES

**ncsubproc** makes use of pidfds and **[pidfd\_send\_signal(2)](/pidfd_send_signal/2.md)**, and thus makes reliable use of signals (it will never target a process other than the true subprocess).

## RETURN VALUES

## SEE ALSO

**[pidfd\_open(2)](/pidfd_open/2.md)**, **[notcurses(3)](/notcurses/3.md)**, **[notcurses\_plane(3)](/notcurses_plane/3.md)**

## AUTHORS

nick black ⟨nickblack@linux.com⟩\\c.
