[Ecls-list] si:file-stream-fd && gray:stream-file-descriptor

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Sat Mar 20 23:17:16 UTC 2010


Matthew, this is more or less what you said before, but the examples I have
been working at here in my laptop they all work without segfaults.

faa.lisp:

(ffi::clines "#include <fcntl.h>")

(defun make-stream (filename)
  (let ((f (namestring filename)))
    (ffi:c-inline (f) (:object) :object "
{
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
cl_object file = #0;
int fd = open(file->base_string.self, O_RDONLY, mode);
printf(\";; File descriptor %d for %s\", fd, file->base_string.self);
@(return) = ecl_make_stream_from_fd(file, fd, smm_input,
                                            8, 0, @:default);
}"
                  :one-liner nil)))

(format t "~%;; File descriptor is ~D"
        (si::file-stream-fd (make-stream "~/.profile")))

> (compile-file "faa" :load t)

[...]
;; File descriptor 9 for /Users/jjgarcia/.profile
;; File descriptor is 9


On Sun, Mar 21, 2010 at 12:01 AM, Matthew Mondor
<mm_lists at pulsar-zone.net>wrote:

> Hi again,
>
> The debugger enters because of a segmentation fault when using the
> functions SI:FILE-STREAM-FD or GRAY:STREAM-FILE-DESCRIPTOR on a stream
> previously created using ecl_make_stream_from_fd() (which is otherwise
> working fine).
>
> Thanks,
> --
> Matt
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Ecls-list mailing list
> Ecls-list at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ecls-list
>



-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://tream.dreamhosters.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20100321/c832878f/attachment.html>


More information about the ecl-devel mailing list