[Openmcl-devel] ioctl

Didier Verna didier at lrde.epita.fr
Wed Nov 10 22:07:40 UTC 2010

  Replying to myself...

I wrote:

> So it seems that #_ioctl expects something else than just winsize. I
> thought maybe :* winsize was needed, but this is not the case either.

So after eyeballing the ccl sources, I finally got to this, which seems
to work:

(format t "winsize: ~S~%"
  (rlet ((winsize :winsize))
    (let ((result (ccl::int-errno-call
		   (#_ioctl (ccl::stream-device *standard-output* :output)
			    #$TIOCGWINSZ :address winsize))))
      (if (zerop result)
	  (pref winsize :winsize.ws_col)
	(unless (= result #$ENOTTY)
	  (ccl::%strerror result))))))

Am I correct in assuming that :address is needed to specify the type of
the next argument because ioctl is a variadic function in C ? I would
just like confirmation that I'm doing things the right way now...


Resistance is futile. You will be jazzimilated.

Scientific site:   http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com

More information about the Openmcl-devel mailing list