reformat and refactor mkpty.*

This commit is contained in:
Emile Clark-Boman 2025-09-09 21:03:40 +10:00
parent 2893caf8ab
commit d04f14c038
2 changed files with 46 additions and 36 deletions

View file

@ -1,16 +1,30 @@
#ifndef DORNE_MKPTY_H
#define DORNE_MKPTY_H
#include <errno.h>
#include <limits.h>
#include <sys/types.h>
#include <unistd.h>
#ifdef PATH_MAX
#define TTYNAME_MAX PATH_MAX
#else
#define TTYNAME_MAX 512
#endif /* PATH_MAX */
#define BIND(fdsrc, fddst) \
while (dup2(fdsrc, fddst) == -1 && errno == EBUSY) \
;
/* Custom implementation of glibc::openpty() */
int mkpty(int *fdmx, int *fds);
/* Custom implementation of glibc::login_tty() */
int bindpty(const int fdty);
void bindpty(const int fdty);
/* Custom implementation of glibc::forkpty() */
pid_t forkmkpty(void);
pid_t forkmkpty(int *fdmx);
int setptsxy(const unsigned short rows, const unsigned short cols, const int fds);
int setptsxy(const unsigned short rows, const unsigned short cols,
const int fds);
int getptsxy(unsigned short *rows, unsigned short *cols, const int fds);
#endif /* DORNE_MKPTY_H */