Abdulaziz Ghuloum wrote:

If you want something like pipe(2) or socketpair(2), it should be easy.

Eduardo Cavazos wrote:

I put something like this in my "ikarus-runtime.c":

ikptr
ikrt_pipe (ikpcb* pcb){
  int fd[2];
  if(pipe(fd)==0){
    ......
  } else {
    return ik_errno_to_code();
  }
}

I'm guessing in the '...' space I should allocate and return a bytevector? Er... can you help me out on that part. :-) I see a few places where bytevectors are allocated in that file, but each instance seems a little different.

This seems to work:

ikptr
ikrt_pipe (ikpcb* pcb){
  int fd[2];
  if(pipe(fd)==0){
    ikptr v = ikrt_make_vector1( 8 , pcb );
    ref( v , off_vector_data+0*wordsize ) = fix( fd[0] );
    ref( v , off_vector_data+1*wordsize ) = fix( fd[1] );
    return v;
  } else {
    return ik_errno_to_code();
  }
}

Ikarus Scheme version 0.0.4-rc1+ (revision 1854, build 2009-09-15)
Copyright (c) 2006-2009 Abdulaziz Ghuloum

> (posix-pipe)
#(3 4)
> (posix-pipe)
#(5 6)
> (posix-pipe)
#(7 8)
>

Aziz, would you recommend something different?

Ed

Reply via email to