Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JLine 3 on Linux(MIPS) with jna run LinuxNativePty.getSize receive ioctl error[25] #687

Closed
wuluer-cn opened this issue Jul 27, 2021 · 1 comment

Comments

@wuluer-cn
Copy link

wuluer-cn commented Jul 27, 2021

We have a MIPS plantform with Red Hat Enterprise Linux Server release 7.4 , use JLine 3.14.0 and jna 5.3.1。
When we execute command, receive flowing error:

com.sun.jna.LastErrorException: [25] 对设备不适当的 ioctl 操作
	at com.sun.jna.Native.invokeVoid(Native Method) ~[jna-5.3.1.jar:5.3.1 (b0)]
	at com.sun.jna.Function.invoke(Function.java:415) ~[jna-5.3.1.jar:5.3.1 (b0)]
	at com.sun.jna.Function.invoke(Function.java:361) ~[jna-5.3.1.jar:5.3.1 (b0)]
	at com.sun.jna.Library$Handler.invoke(Library.java:265) ~[jna-5.3.1.jar:5.3.1 (b0)]
	at com.sun.proxy.$Proxy19.ioctl(Unknown Source) ~[?:?]
	at org.jline.terminal.impl.jna.linux.LinuxNativePty.getSize(LinuxNativePty.java:95) ~[jline-3.14.0.jar:?]
	at org.jline.terminal.impl.AbstractPosixTerminal.getSize(AbstractPosixTerminal.java:60) ~[jline-3.14.0.jar:?]
	at org.jline.terminal.Terminal.getBufferSize(Terminal.java:216) ~[jline-3.14.0.jar:?]
	at org.jline.reader.impl.LineReaderImpl.doDisplay(LineReaderImpl.java:741) ~[jline-3.14.0.jar:?]
	at org.jline.reader.impl.LineReaderImpl.<init>(LineReaderImpl.java:298) ~[jline-3.14.0.jar:?]
	at org.jline.reader.LineReaderBuilder.build(LineReaderBuilder.java:115) ~[jline-3.14.0.jar:?]

According the ERROR,we found that in MIPS, the TIOCGWINSZ is 0x40087468.
In Jline code the org.jline.terminal.impl.jna.linux.CLibrary.TIOCGWINSZ value is 0x00005413.
They have same Linux OS, but the TIOCGWINSZ values are diffrent.
So, can JLine support MIPS plantform?
Or define a getSize API on jna, use TIOCGWINSZ in native code, so can plantform independent.

Environment:
Red Hat Enterprise Linux Server release 7.4
Linux version 4.19.90-1.nk7_5.18.mips64el

@wuluer-cn wuluer-cn changed the title JLine 3 in MIPS with jna LinuxNativePty.getSize receive ioctl error[25] JLine 3 on Linux(MIPS) with jna run LinuxNativePty.getSize receive ioctl error[25] Jul 27, 2021
@gnodet
Copy link
Member

gnodet commented Oct 14, 2021

The https://github.com/rust-lang/libc project contains values for a bunch of platform, so we could reuse those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants