<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <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 class="moz-cite-prefix">On 24/08/2023 14:41, Guillaume Nodet
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CAA66TpoVSohGmQ-dAw4AeEtcjYOQx+h0L4wPfQtggUD-84sddA@mail.gmail.com">
      
      <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" moz-do-not-send="true" class="moz-txt-link-freetext">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" moz-do-not-send="true" class="moz-txt-link-freetext">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" moz-do-not-send="true" class="moz-txt-link-freetext">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" moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/fusesource/jansi/blob/master/src/main/native/jansi.c#L64-L76</a></div>
            <div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">
              <div dir="ltr">
                <div>
                  <div dir="ltr">
                    <div><br>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>