X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=examples%2Ffile-socket.cl;h=2caa37a1703e6e2bdd5a2eb58cea161585ba8249;hb=9d071d3a1c2b8bbd91261908a424ea74472a3bb5;hp=f5a3b6d0ec350a64cef975df08af5bb42620eb20;hpb=372a1d77cc7663b0f5fe1c4dbabfb51cbd1fa560;p=uffi.git diff --git a/examples/file-socket.cl b/examples/file-socket.cl index f5a3b6d..2caa37a 100644 --- a/examples/file-socket.cl +++ b/examples/file-socket.cl @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Jul 2002 ;;;; -;;;; $Id: file-socket.cl,v 1.1 2002/07/31 20:59:06 kevin Exp $ +;;;; $Id: file-socket.cl,v 1.2 2002/08/02 14:39:11 kevin Exp $ ;;;; ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -18,6 +18,10 @@ (in-package :cl-user) +;; Values for linux +(uffi:def-constant PF_UNIX 1) +(uffi:def-constant SOCK_STREAM 1) + (uffi:def-function ("socket" c-socket) ((family :int) (type :int) @@ -30,3 +34,9 @@ (addr-len :int)) :returning :int) +(defun connect-to-file-socket (filename) + (let ((socket (c-socket PF_UNIX SOCK_STREAM 0))) + (if (plusp socket) + (let ((stream (c-connect socket filename (length filename)))) + stream) + (error "Unable to create socket"))))