Subversion Repositories shark

Rev

Rev 80 | Details | Compare with Previous | 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
 ------------
80 pj 23
 CVS :        $Id: mqueue.h,v 1.2 2003-03-13 13:41:04 pj Exp $
2 pj 24
 
25
 File:        $File$
80 pj 26
 Revision:    $Revision: 1.2 $
27
 Last update: $Date: 2003-03-13 13:41:04 $
2 pj 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>
1689 fabio 64
#include <arch/sys/cdefs.h>
2 pj 65
 
80 pj 66
__BEGIN_DECLS
67
 
2 pj 68
typedef int mqd_t;
69
 
70
struct mq_attr {
71
  long mq_flags;        /* Message queue flags */
72
  long mq_maxmsg;       /* maximum number of messages */
73
  long mq_msgsize;      /* Maximum message size */
74
  long mq_curmsgs;      /* Number of messages currently queued */
75
};
76
 
77
// non-standard defaults limits used into mq_open when no mqstat is defined
78
#define MQ_DEFAULT_MAXMSG   10
79
#define MQ_DEFAULT_MSGSIZE 128
80
 
81
 
82
// defined into the POSIX Standard, 15.1.1
83
 
84
mqd_t mq_open(const char *name, int oflag, ...);
85
int mq_close(mqd_t mqdes);
86
int mq_unlink(const char *name);
87
int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len,
88
            unsigned int msg_prio);
89
ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len,
90
                   unsigned int *msg_prio);
91
int mq_notify(mqd_t mqdes, const struct sigevent *notification);
92
int mq_setattr(mqd_t mqdes, const struct mq_attr *mqstat,
93
               struct mq_attr *omqstat);
94
int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat);
95
 
80 pj 96
__END_DECLS
2 pj 97
#endif