创建伪终端时如何获取主端口名称?我知道我可以ptsname()
用来获取从端口名称,但是主端口呢?
int fdm, fds;
char slave_port_name[256];
int open_res = openpty(&fdm, &fds, slave_port_name, NULL, NULL);
system("ls -l /dev/");
printf("Master Port Name: %s, file descriptor: %d\n", ??? How to get master portname?, fdm);
printf("Slave Port Name: %s, file descriptor: %d\n", slave_port_name, fds);