Ignore:
Timestamp:
02/05/07 04:51:27 (18 years ago)
Author:
psmith
Message:

Corrections to fcntl and O_NONBLOCK definitions for linux

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified branches/home/psmith/restructure/src/io/fd-helper.lisp

    r15 r69  
    3333(defconstant +cmd-get-flags+ 3)
    3434(defconstant +cmd-set-flags+ 4)
    35 (defconstant +arg-nonblock+ #x0004)
     35
     36#+(or darwin macosx freebsd)
     37(defconstant +arg-nonblock+ #x4)
     38
     39#+linux
     40(defconstant +arg-nonblock+ #x800)
    3641
    3742(defcfun ("close" %close) :int
     
    4146  (fd :int)
    4247  (cmd :int)
     48#+(or darwin macosx freebsd)
    4349  (arg :int))
     50#+linux
     51  (arg :long))
    4452
    4553(defcfun ("read" %read) :long
     
    6169  (%memset ptr 0 size))
    6270
     71(defun get-fd-flags(unix-fd)
     72  (%fcntl unix-fd +cmd-get-flags+ 0))
    6373
    6474(defun set-fd-nonblocking (unix-fd)
    6575  "Set UNIX-FD to non-blocking mode (O_NONBLOCK)."
    66   (%fcntl unix-fd +cmd-set-flags+ +arg-nonblock+))
     76  (let* ((flags (get-fd-flags unix-fd))
     77         (new-flags (logior flags +arg-nonblock+)))
     78    (format t "set-fd-nonblocking :fd ~A :old-flags 0x~X 0x~X~%" unix-fd flags new-flags)
     79    (%fcntl unix-fd +cmd-set-flags+ new-flags)))
    6780
    6881
Note: See TracChangeset for help on using the changeset viewer.