Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/*
2
 * Project: S.Ha.R.K.
3
 *
4
 * Coordinators:
5
 *   Giorgio Buttazzo    <giorgio@sssup.it>
6
 *   Paolo Gai           <pj@gandalf.sssup.it>
7
 *
8
 * Authors     :
9
 *   Paolo Gai           <pj@gandalf.sssup.it>
10
 *   Massimiliano Giorgi <massy@gandalf.sssup.it>
11
 *   Luca Abeni          <luca@gandalf.sssup.it>
12
 *   (see the web pages for full authors list)
13
 *
14
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
15
 *
16
 * http://www.sssup.it
17
 * http://retis.sssup.it
18
 * http://shark.sssup.it
19
 */
20
 
21
/**
22
 ------------
23
 CVS :        $Id: mqueue.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
24
 
25
 File:        $File$
26
 Revision:    $Revision: 1.1.1.1 $
27
 Last update: $Date: 2002-03-29 14:12:51 $
28
 ------------
29
 
30
 POSIX message queues:
31
 
32
 - mq names have not a correspondence into the File System.
33
 - a message queue can only be opened with the O_RDWR flag
34
   (there is only a process!!!)
35
 
36
**/
37
 
38
/*
39
 * Copyright (C) 2000 Paolo Gai
40
 *
41
 * This program is free software; you can redistribute it and/or modify
42
 * it under the terms of the GNU General Public License as published by
43
 * the Free Software Foundation; either version 2 of the License, or
44
 * (at your option) any later version.
45
 *
46
 * This program is distributed in the hope that it will be useful,
47
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
48
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
49
 * GNU General Public License for more details.
50
 *
51
 * You should have received a copy of the GNU General Public License
52
 * along with this program; if not, write to the Free Software
53
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
54
 *
55
 */
56
 
57
#ifndef __MQUEUE_H__
58
#define __MQUEUE_H__
59
 
60
#include <sys/types.h>
61
#include <fcntl.h>
62
#include <time.h>
63
#include <signal.h>
64
 
65
typedef int mqd_t;
66
 
67
struct mq_attr {
68
  long mq_flags;        /* Message queue flags */
69
  long mq_maxmsg;       /* maximum number of messages */
70
  long mq_msgsize;      /* Maximum message size */
71
  long mq_curmsgs;      /* Number of messages currently queued */
72
};
73
 
74
// non-standard defaults limits used into mq_open when no mqstat is defined
75
#define MQ_DEFAULT_MAXMSG   10
76
#define MQ_DEFAULT_MSGSIZE 128
77
 
78
 
79
// defined into the POSIX Standard, 15.1.1
80
 
81
mqd_t mq_open(const char *name, int oflag, ...);
82
int mq_close(mqd_t mqdes);
83
int mq_unlink(const char *name);
84
int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len,
85
            unsigned int msg_prio);
86
ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len,
87
                   unsigned int *msg_prio);
88
int mq_notify(mqd_t mqdes, const struct sigevent *notification);
89
int mq_setattr(mqd_t mqdes, const struct mq_attr *mqstat,
90
               struct mq_attr *omqstat);
91
int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat);
92
 
93
#endif