linux-user: Implement ioctl cmd TIOCGPTPEER
With glibc 2.27 the openpty function prefers the TIOCGPTPEER ioctl. Signed-off-by: Andreas Schwab <schwab@suse.de> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <mvmbmhdosb9.fsf_-_@suse.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
f0fa817675
commit
2b74f621f1
@ -187,6 +187,8 @@ struct target_termios {
|
|||||||
/* Get Pty Number (of pty-mux device) */
|
/* Get Pty Number (of pty-mux device) */
|
||||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T', 0x31, int)
|
#define TARGET_TIOCSPTLCK TARGET_IOW('T', 0x31, int)
|
||||||
/* Lock/unlock Pty */
|
/* Lock/unlock Pty */
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41)
|
||||||
|
/* Safely open the slave */
|
||||||
|
|
||||||
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
||||||
#define TARGET_FIOCLEX 0x5451
|
#define TARGET_FIOCLEX 0x5451
|
||||||
|
@ -245,6 +245,7 @@ struct target_termios {
|
|||||||
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
|
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
|
||||||
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
||||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
|
||||||
|
|
||||||
#define TARGET_TIOCSERCONFIG 0x5453
|
#define TARGET_TIOCSERCONFIG 0x5453
|
||||||
#define TARGET_TIOCSERGWILD 0x5454
|
#define TARGET_TIOCSERGWILD 0x5454
|
||||||
|
@ -185,6 +185,7 @@ struct target_termios {
|
|||||||
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
|
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
|
||||||
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
||||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
|
||||||
|
|
||||||
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
||||||
#define TARGET_FIOCLEX 0x5451
|
#define TARGET_FIOCLEX 0x5451
|
||||||
|
@ -182,6 +182,7 @@ struct target_termios {
|
|||||||
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
|
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
|
||||||
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
||||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
|
||||||
|
|
||||||
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
||||||
#define TARGET_FIOCLEX 0x5451
|
#define TARGET_FIOCLEX 0x5451
|
||||||
|
@ -186,6 +186,8 @@ struct target_termios {
|
|||||||
/* Get Pty Number (of pty-mux device) */
|
/* Get Pty Number (of pty-mux device) */
|
||||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T', 0x31, int)
|
#define TARGET_TIOCSPTLCK TARGET_IOW('T', 0x31, int)
|
||||||
/* Lock/unlock Pty */
|
/* Lock/unlock Pty */
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41)
|
||||||
|
/* Safely open the slave */
|
||||||
|
|
||||||
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
||||||
#define TARGET_FIOCLEX 0x5451
|
#define TARGET_FIOCLEX 0x5451
|
||||||
|
@ -195,6 +195,7 @@ struct target_termios {
|
|||||||
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
|
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
|
||||||
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
||||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
|
||||||
|
|
||||||
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
||||||
#define TARGET_FIOCLEX 0x5451
|
#define TARGET_FIOCLEX 0x5451
|
||||||
|
@ -40,6 +40,9 @@
|
|||||||
IOCTL(TIOCSETD, IOC_W, MK_PTR(TYPE_INT))
|
IOCTL(TIOCSETD, IOC_W, MK_PTR(TYPE_INT))
|
||||||
IOCTL(TIOCGPTN, IOC_R, MK_PTR(TYPE_INT))
|
IOCTL(TIOCGPTN, IOC_R, MK_PTR(TYPE_INT))
|
||||||
IOCTL(TIOCSPTLCK, IOC_W, MK_PTR(TYPE_INT))
|
IOCTL(TIOCSPTLCK, IOC_W, MK_PTR(TYPE_INT))
|
||||||
|
#ifdef TIOCGPTPEER
|
||||||
|
IOCTL_SPECIAL(TIOCGPTPEER, 0, do_ioctl_tiocgptpeer, TYPE_INT)
|
||||||
|
#endif
|
||||||
IOCTL(FIOCLEX, 0, TYPE_NULL)
|
IOCTL(FIOCLEX, 0, TYPE_NULL)
|
||||||
IOCTL(FIONCLEX, 0, TYPE_NULL)
|
IOCTL(FIONCLEX, 0, TYPE_NULL)
|
||||||
IOCTL(FIOASYNC, IOC_W, MK_PTR(TYPE_INT))
|
IOCTL(FIOASYNC, IOC_W, MK_PTR(TYPE_INT))
|
||||||
|
@ -196,6 +196,7 @@ struct target_termios {
|
|||||||
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
|
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
|
||||||
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
||||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
|
||||||
|
|
||||||
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
||||||
#define TARGET_FIOCLEX 0x5451
|
#define TARGET_FIOCLEX 0x5451
|
||||||
|
@ -182,6 +182,7 @@ struct target_termios {
|
|||||||
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
|
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
|
||||||
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
||||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
|
||||||
|
|
||||||
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
||||||
#define TARGET_FIOCLEX 0x5451
|
#define TARGET_FIOCLEX 0x5451
|
||||||
|
@ -233,6 +233,7 @@ struct target_termios {
|
|||||||
#define TARGET_TIOCGPKT TARGET_IOR('T', 0x38, int)
|
#define TARGET_TIOCGPKT TARGET_IOR('T', 0x38, int)
|
||||||
#define TARGET_TIOCGPTLCK TARGET_IOR('T', 0x39, int)
|
#define TARGET_TIOCGPTLCK TARGET_IOR('T', 0x39, int)
|
||||||
#define TARGET_TIOCGEXCL TARGET_IOR('T', 0x40, int)
|
#define TARGET_TIOCGEXCL TARGET_IOR('T', 0x40, int)
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41)
|
||||||
|
|
||||||
/* I hope the range from 0x5480 on is free ... */
|
/* I hope the range from 0x5480 on is free ... */
|
||||||
#define TARGET_TIOCSCTTY 0x5480 /* become controlling tty */
|
#define TARGET_TIOCSCTTY 0x5480 /* become controlling tty */
|
||||||
|
@ -187,6 +187,8 @@ struct target_termios {
|
|||||||
/* Get Pty Number (of pty-mux device) */
|
/* Get Pty Number (of pty-mux device) */
|
||||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T', 0x31, int)
|
#define TARGET_TIOCSPTLCK TARGET_IOW('T', 0x31, int)
|
||||||
/* Lock/unlock Pty */
|
/* Lock/unlock Pty */
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41)
|
||||||
|
/* Safely open the slave */
|
||||||
|
|
||||||
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
||||||
#define TARGET_FIOCLEX 0x5451
|
#define TARGET_FIOCLEX 0x5451
|
||||||
|
@ -245,6 +245,8 @@ struct target_termios3 {
|
|||||||
#define TARGET_TIOCGPTN TARGET_IOR('T', 0x30, unsigned int)
|
#define TARGET_TIOCGPTN TARGET_IOR('T', 0x30, unsigned int)
|
||||||
/* Lock/unlock Pty */
|
/* Lock/unlock Pty */
|
||||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T', 0x31, int)
|
#define TARGET_TIOCSPTLCK TARGET_IOW('T', 0x31, int)
|
||||||
|
/* Safely open the slave */
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41)
|
||||||
/* Get primary device node of /dev/console */
|
/* Get primary device node of /dev/console */
|
||||||
#define TARGET_TIOCGDEV TARGET_IOR('T', 0x32, unsigned int)
|
#define TARGET_TIOCGDEV TARGET_IOR('T', 0x32, unsigned int)
|
||||||
#define TARGET_TCGETX 0x5432 /* SYS5 TCGETX compatibility */
|
#define TARGET_TCGETX 0x5432 /* SYS5 TCGETX compatibility */
|
||||||
|
@ -219,6 +219,7 @@ struct target_termios {
|
|||||||
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
|
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
|
||||||
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
||||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
|
||||||
|
|
||||||
#define TARGET_TIOCSERCONFIG 0x5453
|
#define TARGET_TIOCSERCONFIG 0x5453
|
||||||
#define TARGET_TIOCSERGWILD 0x5454
|
#define TARGET_TIOCSERGWILD 0x5454
|
||||||
|
@ -252,6 +252,7 @@ struct target_ktermios {
|
|||||||
#define TARGET_TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
#define TARGET_TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
||||||
#define TARGET_TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
|
#define TARGET_TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
|
||||||
#define TARGET_TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
|
#define TARGET_TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
|
||||||
|
|
||||||
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
||||||
#define TARGET_FIOCLEX 0x5451
|
#define TARGET_FIOCLEX 0x5451
|
||||||
|
@ -250,6 +250,7 @@ ID of FD */
|
|||||||
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-m
|
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-m
|
||||||
ux device) */
|
ux device) */
|
||||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
|
||||||
|
|
||||||
|
|
||||||
#define TARGET_TIOCSERCONFIG TARGET_IO('T', 83) /* 0x5453 */
|
#define TARGET_TIOCSERCONFIG TARGET_IO('T', 83) /* 0x5453 */
|
||||||
|
@ -245,6 +245,7 @@ struct target_termios {
|
|||||||
/* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */
|
/* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */
|
||||||
#define TARGET_TIOCGPTN TARGET_IOR('t', 134, unsigned int) /* Get Pty Number */
|
#define TARGET_TIOCGPTN TARGET_IOR('t', 134, unsigned int) /* Get Pty Number */
|
||||||
#define TARGET_TIOCSPTLCK TARGET_IOW('t', 135, int) /* Lock/unlock PTY */
|
#define TARGET_TIOCSPTLCK TARGET_IOW('t', 135, int) /* Lock/unlock PTY */
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('t', 137) /* Safely open the slave */
|
||||||
|
|
||||||
/* Little f */
|
/* Little f */
|
||||||
#define TARGET_FIOCLEX TARGET_IO('f', 1)
|
#define TARGET_FIOCLEX TARGET_IO('f', 1)
|
||||||
|
@ -245,6 +245,7 @@ struct target_termios {
|
|||||||
/* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */
|
/* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */
|
||||||
#define TARGET_TIOCGPTN TARGET_IOR('t', 134, unsigned int) /* Get Pty Number */
|
#define TARGET_TIOCGPTN TARGET_IOR('t', 134, unsigned int) /* Get Pty Number */
|
||||||
#define TARGET_TIOCSPTLCK TARGET_IOW('t', 135, int) /* Lock/unlock PTY */
|
#define TARGET_TIOCSPTLCK TARGET_IOW('t', 135, int) /* Lock/unlock PTY */
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('t', 137) /* Safely open the slave */
|
||||||
|
|
||||||
/* Little f */
|
/* Little f */
|
||||||
#define TARGET_FIOCLEX TARGET_IO('f', 1)
|
#define TARGET_FIOCLEX TARGET_IO('f', 1)
|
||||||
|
@ -5636,6 +5636,15 @@ static abi_long do_ioctl_kdsigaccept(const IOCTLEntry *ie, uint8_t *buf_temp,
|
|||||||
return get_errno(safe_ioctl(fd, ie->host_cmd, sig));
|
return get_errno(safe_ioctl(fd, ie->host_cmd, sig));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TIOCGPTPEER
|
||||||
|
static abi_long do_ioctl_tiocgptpeer(const IOCTLEntry *ie, uint8_t *buf_temp,
|
||||||
|
int fd, int cmd, abi_long arg)
|
||||||
|
{
|
||||||
|
int flags = target_to_host_bitmask(arg, fcntl_flags_tbl);
|
||||||
|
return get_errno(safe_ioctl(fd, ie->host_cmd, flags));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static IOCTLEntry ioctl_entries[] = {
|
static IOCTLEntry ioctl_entries[] = {
|
||||||
#define IOCTL(cmd, access, ...) \
|
#define IOCTL(cmd, access, ...) \
|
||||||
{ TARGET_ ## cmd, cmd, #cmd, access, 0, { __VA_ARGS__ } },
|
{ TARGET_ ## cmd, cmd, #cmd, access, 0, { __VA_ARGS__ } },
|
||||||
|
@ -242,6 +242,7 @@ struct target_termios2 {
|
|||||||
#define TARGET_TIOCGPKT TARGET_IOR('T', 0x38, int)
|
#define TARGET_TIOCGPKT TARGET_IOR('T', 0x38, int)
|
||||||
#define TARGET_TIOCGPTLCK TARGET_IOR('T', 0x39, int)
|
#define TARGET_TIOCGPTLCK TARGET_IOR('T', 0x39, int)
|
||||||
#define TARGET_TIOCGEXCL TARGET_IOR('T', 0x40, int)
|
#define TARGET_TIOCGEXCL TARGET_IOR('T', 0x40, int)
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41)
|
||||||
|
|
||||||
#define TARGET_FIONCLEX 0x5450
|
#define TARGET_FIONCLEX 0x5450
|
||||||
#define TARGET_FIOCLEX 0x5451
|
#define TARGET_FIOCLEX 0x5451
|
||||||
|
@ -215,6 +215,7 @@ struct target_termios {
|
|||||||
#define TARGET_TCSETSF2 TARGET_IOW('T',0x2D, struct termios2)
|
#define TARGET_TCSETSF2 TARGET_IOW('T',0x2D, struct termios2)
|
||||||
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
||||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
||||||
|
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
|
||||||
|
|
||||||
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
|
||||||
#define TARGET_FIOCLEX 0x5451
|
#define TARGET_FIOCLEX 0x5451
|
||||||
|
Loading…
Reference in New Issue
Block a user