From iolib-devel at common-lisp.net Sun Sep 23 18:32:31 2007 From: iolib-devel at common-lisp.net (IOLib) Date: Sun, 23 Sep 2007 18:32:31 -0000 Subject: [iolib-ticket] #1: Poll syscall has wrong prototype on FreeBSD Message-ID: <076.7367775ebc9c407c70e356e41cb0c336@common-lisp.net> #1: Poll syscall has wrong prototype on FreeBSD -----------------------------+---------------------------------------------- Reporter: john at fremlin.org | Owner: sionescu Type: enhancement | Status: new Priority: minor | Component: iolib-posix Version: 0.5.4 | Keywords: -----------------------------+---------------------------------------------- The proper definition should take the timeout as a pointer to a timespec #+freebsd (defsyscall "poll" :int "Scan for I/O activity on multiple file descriptors." (fds :pointer) (nfds nfds) (timeout :pointer)) Here is an example of using it #+freebsd (defun syscall-poll (fds nfds timeout) (cffi:with-foreign-object (ts 'iolib-posix:timespec) (cffi:with-foreign-slots ((iolib-posix:sec iolib-posix:nsec) ts iolib- posix:timespec) (multiple-value-bind (s frac) (floor (or timeout 0)) (setf iolib-posix:sec s) (setf iolib-posix:nsec (floor (* frac 1000000))))) (iolib-posix:poll fds nfds (if timeout ts (cffi:null-pointer))))) where the equivalent code on Linux is #+linux (defun syscall-poll (fds nfds timeout) (iolib-posix:poll fds nfds (if timeout (floor (* timeout 1000)) -1))) -- Ticket URL: IOLib a CommonLisp I/O library From iolib-devel at common-lisp.net Sun Sep 23 18:57:45 2007 From: iolib-devel at common-lisp.net (IOLib) Date: Sun, 23 Sep 2007 18:57:45 -0000 Subject: [iolib-ticket] Re: #1: Poll syscall has wrong prototype on FreeBSD In-Reply-To: <076.7367775ebc9c407c70e356e41cb0c336@common-lisp.net> References: <076.7367775ebc9c407c70e356e41cb0c336@common-lisp.net> Message-ID: <085.6266780794b1c54ad55cb4d1fdaec493@common-lisp.net> #1: Poll syscall has wrong prototype on FreeBSD -----------------------------+---------------------------------------------- Reporter: john at fremlin.org | Owner: sionescu Type: defect | Status: new Priority: minor | Component: iolib-posix Version: 0.5.4 | Resolution: Keywords: | -----------------------------+---------------------------------------------- Changes (by sionescu): * type: enhancement => defect Comment: What version of FreeBSD are you running ? On 6.2(which I'm using), the third parameter is an int: http://www.freebsd.org/cgi/man.cgi?query=poll&apropos=0&sektion=0&manpath=FreeBSD+6.2-stable&format=html -- Ticket URL: IOLib a CommonLisp I/O library