]> sourceware.org Git - glibc.git/blame - mach/msg.c
Thu Jan 25 21:10:39 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
[glibc.git] / mach / msg.c
CommitLineData
28f540f4
RM
1/*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989, 1995 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26#include <mach/port.h>
27#include <mach/message.h>
28
29mach_msg_return_t
30__mach_msg (mach_msg_header_t *msg,
31 mach_msg_option_t option,
32 mach_msg_size_t send_size,
33 mach_msg_size_t rcv_size,
34 mach_port_t rcv_name,
35 mach_msg_timeout_t timeout,
36 mach_port_t notify)
37{
38 mach_msg_return_t ret;
39
40 /* Consider the following cases:
41 1. Errors in pseudo-receive (eg, MACH_SEND_INTERRUPTED
42 plus special bits).
43 2. Use of MACH_SEND_INTERRUPT/MACH_RCV_INTERRUPT options.
44 3. RPC calls with interruptions in one/both halves.
45 */
46
47 ret = __mach_msg_trap (msg, option, send_size,
48 rcv_size, rcv_name, timeout, notify);
49 if (ret == MACH_MSG_SUCCESS)
50 return MACH_MSG_SUCCESS;
51
52 if (!(option & MACH_SEND_INTERRUPT))
53 while (ret == MACH_SEND_INTERRUPTED)
54 ret = __mach_msg_trap (msg, option, send_size,
55 rcv_size, rcv_name, timeout, notify);
56
57 if (!(option & MACH_RCV_INTERRUPT))
58 while (ret == MACH_RCV_INTERRUPTED)
59 ret = __mach_msg_trap (msg, option & ~MACH_SEND_MSG,
60 0, rcv_size, rcv_name, timeout, notify);
61
62 return ret;
63}
64weak_alias (__mach_msg, mach_msg)
65
66mach_msg_return_t
67__mach_msg_send (mach_msg_header_t *msg)
68{
69 return __mach_msg (msg, MACH_SEND_MSG,
70 msg->msgh_size, 0, MACH_PORT_NULL,
71 MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
72}
73weak_alias (__mach_msg_send, mach_msg_send)
74
75mach_msg_return_t
76__mach_msg_receive (mach_msg_header_t *msg)
77{
78 return __mach_msg (msg, MACH_RCV_MSG,
79 0, msg->msgh_size, msg->msgh_local_port,
80 MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
81}
82weak_alias (__mach_msg_receive, mach_msg_receive)
This page took 0.044172 seconds and 5 git commands to generate.