Libptytty is a small library that offers pseudo-TTY management in an OS-independent way. It was created out of frustration over the many differences of PTY/TTY handling in different operating systems for use inside "rxvt-unicode". It also offers session database support (utmp and optional wtmp/lastlog updates for login shells) and supports forking a proxy process after startup and dropping privileges in the calling process. It offers C++ and C-only APIs.