<div dir="ltr">Awesome, that works perfectly, thx a ton !</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le jeu. 24 août 2023 à 15:53, Maurizio Cimadamore <<a href="mailto:maurizio.cimadamore@oracle.com">maurizio.cimadamore@oracle.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div>
<p>Hi,<br>
Ioctl is a variadic function - see manpage:</p>
<p><br>
</p>
<p>```<br>
int ioctl(int fd, unsigned long request, ...);<br>
```</p>
<p>As such, you need to use a Linker.Option.firstVariadicArg when
linking, to denote how many variadic arguments your function
descriptor contains (I believe in your case you have 4 variadic
arguments, so the first variadic index should be 2?)</p>
<p>Cheers<br>
Maurizio<br>
</p>
<p><br>
</p>
<div>On 24/08/2023 14:41, Guillaume Nodet
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Hi everybody</div>
<div><br>
</div>
I've been trying to port the JLine library to JEP 442 and
earlier previews (nice work, I'm eagerly waiting for its GA
release) every once in a while, but I'm stuck on a call for
which I can't find my way around.
<div><br>
<div>The call is the ioctl function [1] which has untyped
parameters, but whatever I've been feeding it crashes the
JVM. I've been successfully using this method with JNA [2]
and a plain small JNI library [3], and after having
spent countless hours, I must admit I can't find what's
happening....</div>
<div><br>
</div>
<div>Here's a very small reproducer:</div>
<div> <a href="https://github.com/gnodet/jep442-ioctl" target="_blank">https://github.com/gnodet/jep442-ioctl</a></div>
<div><br>
</div>
<div>Any suggestions?<br clear="all">
<div><br>
</div>
<div>Cheers,</div>
<div>Guillaume Nodet</div>
<div><br>
</div>
<div>[1] <a href="http://man7.org/linux/man-pages/man4/tty_ioctl.4.html" target="_blank">http://man7.org/linux/man-pages/man4/tty_ioctl.4.html</a></div>
<div>[2] <a href="https://github.com/jline/jline3/blob/master/terminal-jna/src/main/java/org/jline/terminal/impl/jna/linux/CLibrary.java#L34" target="_blank">https://github.com/jline/jline3/blob/master/terminal-jna/src/main/java/org/jline/terminal/impl/jna/linux/CLibrary.java#L34</a></div>
<div>[3] <a href="https://github.com/fusesource/jansi/blob/master/src/main/native/jansi.c#L64-L76" target="_blank">https://github.com/fusesource/jansi/blob/master/src/main/native/jansi.c#L64-L76</a></div>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><font color="#999999">------------------------<br>Guillaume Nodet<br></font><div><br></div></div></div></div></div>