Changeset 9334


Ignore:
Timestamp:
Apr 30, 2008, 4:18:27 PM (11 years ago)
Author:
andreas
Message:

Implementation of pipe() for Windows.

Location:
branches/win64
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/win64/level-1/linux-files.lisp

    r9324 r9334  
    864864;;; I believe that the Darwin/FreeBSD syscall infterface is rather ... odd.
    865865;;; Use libc's interface.
     866#-windows-target
    866867(defun pipe ()
    867868  ;;  (rlet ((filedes (:array :int 2)))
     
    880881        (%errno-disp errno)))))
    881882
     883#+windows-target
     884(defun pipe ()
     885  (%stack-block ((filedes 8))
     886    (syscall syscalls::pipe filedes)
     887    (values (paref filedes (:array :int)  0) (paref filedes (:array :int)  1))))
    882888
    883889
     
    918924     (values nil nil close-in-parent close-on-error))
    919925    (null
    920      (let* ((fd (fd-open "/dev/null" (case direction
     926     (let* ((null-device #+windows-target "nul" #-windows-target "/dev/null")
     927            (fd (fd-open null-device (case direction
    921928                                       (:input #$O_RDONLY)
    922929                                       (:output #$O_WRONLY)
    923930                                       (t #$O_RDWR)))))
    924931       (if (< fd 0)
    925          (signal-file-error fd "/dev/null"))
     932         (signal-file-error fd null-device))
    926933       (values fd nil (cons fd close-in-parent) (cons fd close-on-error))))
    927934    ((eql :stream)
  • branches/win64/library/x86-win64-syscalls.lisp

    r9317 r9334  
    4040(define-syscall (logior platform-os-windows platform-cpu-x86 platform-word-size-64)  syscalls::closedir 11 (:address)
    4141                :signed-fullword)
     42(define-syscall (logior platform-os-windows platform-cpu-x86 platform-word-size-64)  syscalls::pipe 12 (:address) :signed-fullword )
     43
    4244#+notdefinedyet
    4345(progn
     
    100102(define-syscall (logior platform-os-windows platform-cpu-x86 platform-word-size-64)  syscalls::rmdir 17 (:address) :signed-fullword )
    101103(define-syscall (logior platform-os-windows platform-cpu-x86 platform-word-size-64)  syscalls::dup 41 (:unsigned-fullword) :signed-fullword )
    102 (define-syscall (logior platform-os-windows platform-cpu-x86 platform-word-size-64)  syscalls::pipe 42 (:address) :signed-fullword )
    103104(define-syscall (logior platform-os-windows platform-cpu-x86 platform-word-size-64)  syscalls::times 100 (:address) :unsigned-fullword )
    104105
  • branches/win64/lisp-kernel/windows-calls.c

    r9320 r9334  
    131131{
    132132  WSYSCALL_RETURN(_wclosedir(dir));
     133}
     134
     135__int64
     136windows_pipe(int fd[2])
     137{
     138  HANDLE input, output;
     139  SECURITY_ATTRIBUTES sa;
     140
     141  sa.nLength= sizeof(SECURITY_ATTRIBUTES);
     142  sa.lpSecurityDescriptor = NULL;
     143  sa.bInheritHandle = TRUE;
     144
     145  if (!CreatePipe(&input, &output, &sa, 0))
     146    {
     147      wperror("CreatePipe");
     148      return -1;
     149    }
     150  fd[0] = _open_osfhandle((intptr_t)input, 0);
     151  fd[1] = _open_osfhandle((intptr_t)output, 0);
     152  return 0;
    133153}
    134154
     
    146166  windows_opendir,
    147167  windows_readdir,
    148   windows_closedir
     168  windows_closedir,
     169  windows_pipe
    149170};
    150171
Note: See TracChangeset for help on using the changeset viewer.