/[cl-ipc]/cl-ipc/uffi.lisp
ViewVC logotype

Contents of /cl-ipc/uffi.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Fri Sep 16 14:41:59 2005 UTC (8 years, 7 months ago) by skamphausen
Branch: MAIN
CVS Tags: release-1-0, HEAD
Changes since 1.1: +3 -2 lines
added constant +ipc-no-wait-flag+
1 ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
2
3 ;;; $Header: /tiger/var/lib/cvsroots/cl-ipc/cl-ipc/uffi.lisp,v 1.2 2005/09/16 14:41:59 skamphausen Exp $
4 ;;; $Id: uffi.lisp,v 1.2 2005/09/16 14:41:59 skamphausen Exp $
5
6 ;;; Copyright (C) 2005 by
7 ;;; Dr. Edmund Weitz http://weitz.de
8 ;;; and
9 ;;; Stefan Kamphausen http://www.skamphausen.de
10 ;;; All rights reserved.
11
12 ;;; Redistribution and use in source and binary forms, with or without
13 ;;; modification, are permitted provided that the following conditions
14 ;;; are met:
15
16 ;;; * Redistributions of source code must retain the above copyright
17 ;;; notice, this list of conditions and the following disclaimer.
18
19 ;;; * Redistributions in binary form must reproduce the above
20 ;;; copyright notice, this list of conditions and the following
21 ;;; disclaimer in the documentation and/or other materials
22 ;;; provided with the distribution.
23
24 ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
25 ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
28 ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
30 ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32 ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33 ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
36 (in-package :cl-ipc)
37
38 (defconstant +ipc-create-flag+ #o00001000)
39 (defconstant +ipc-exclusive-flag+ #o00002000)
40 (defconstant +ipc-rmid+ 0)
41 (defconstant +ipc-no-wait-flag+ #o4000)
42
43 ;; def-struct from UFFI!
44 ;; #. is reader macro to eval at read time
45 (def-struct msg-struct
46 (mtype :long)
47 (text (:array :char #.+message-length+)))
48
49 (def-foreign-type msg-struct-pointer (* msg-struct))
50
51 (def-function ("msgget" msg-get)
52 ((key :int)
53 (flag :int))
54 :returning :int
55 :module :cl-ipc)
56
57 (def-function ("msgrcv" msg-receive)
58 ((id :int)
59 (msg msg-struct-pointer)
60 (msg-size :unsigned-int)
61 (msg-type :long)
62 (flag :int))
63 :returning :int
64 :module :cl-ipc)
65
66 (def-function ("msgctl" msg-control)
67 ((id :int)
68 (command :int)
69 (msqid_ds :pointer-void))
70 :returning :int
71 :module :cl-ipc)
72
73 (defun msg-close (id)
74 (ignore-errors
75 (msg-control id +ipc-rmid+ (make-null-pointer :void))))
76
77

  ViewVC Help
Powered by ViewVC 1.1.5