fix mkpty function declarations
This commit is contained in:
parent
a1e34376de
commit
2893caf8ab
3 changed files with 14 additions and 6 deletions
10
cli/main.c
10
cli/main.c
|
|
@ -1,6 +1,7 @@
|
||||||
#include "mkpty.h"
|
#include <stdio.h>
|
||||||
#include "sys/types.h"
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "mkpty.h"
|
||||||
|
|
||||||
// struct d_window {
|
// struct d_window {
|
||||||
// int ptmx; // fd
|
// int ptmx; // fd
|
||||||
|
|
@ -16,9 +17,14 @@ int main(int argc, char **argv) {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
switch (pid = forkmkpty()) {
|
switch (pid = forkmkpty()) {
|
||||||
case -1:
|
case -1:
|
||||||
|
perror("forkmkpty");
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
|
printf("fork: children\n");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
|
printf("fork: parent\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ int bindpty(const int fdty) {
|
||||||
* forkpty() function. It exists as a learning resource.
|
* forkpty() function. It exists as a learning resource.
|
||||||
* REF: https://sourceware.org/git/glibc.git -> ./login/forkpty.c
|
* REF: https://sourceware.org/git/glibc.git -> ./login/forkpty.c
|
||||||
*/
|
*/
|
||||||
pid_t forkmkpty() {
|
pid_t forkmkpty(void) {
|
||||||
int fdmx, fds;
|
int fdmx, fds;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
if (mkpty(&fdmx, &fds))
|
if (mkpty(&fdmx, &fds))
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,12 @@
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
/* Custom implementations of openpty() */
|
/* Custom implementation of glibc::openpty() */
|
||||||
int mkpty(int *fdmx, int *fds);
|
int mkpty(int *fdmx, int *fds);
|
||||||
/* Custom implementations of forkpty() */
|
/* Custom implementation of glibc::login_tty() */
|
||||||
pid_t forkmkpty();
|
int bindpty(const int fdty);
|
||||||
|
/* Custom implementation of glibc::forkpty() */
|
||||||
|
pid_t forkmkpty(void);
|
||||||
|
|
||||||
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);
|
int getptsxy(unsigned short *rows, unsigned short *cols, const int fds);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue