summaryrefslogtreecommitdiff
path: root/proc/stubs.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1994-07-01 15:05:14 +0000
committerMichael I. Bushnell <mib@gnu.org>1994-07-01 15:05:14 +0000
commitdfb70c3bcf182f5a0483425611481b78e02b7ad4 (patch)
tree6e15ac4e8372a0f45985ee72101a5eba026f7a88 /proc/stubs.c
parent17b09532f978e5aa8e319dbbd0676aabf846e09f (diff)
entered into RCS
Diffstat (limited to 'proc/stubs.c')
-rw-r--r--proc/stubs.c136
1 files changed, 59 insertions, 77 deletions
diff --git a/proc/stubs.c b/proc/stubs.c
index 960c0d72..947eaccc 100644
--- a/proc/stubs.c
+++ b/proc/stubs.c
@@ -15,30 +15,16 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-/* Standard MiG goop */
-#define EXPORT_BOOLEAN
-#include <mach/boolean.h>
-#include <mach/kern_return.h>
-#include <mach/message.h>
-#include <mach/notify.h>
-#include <mach/mach_types.h>
-#include <mach/mig_errors.h>
-#include <mach/mig_support.h>
-#include <mach/msg_type.h>
-#include <mach/std_types.h>
-#define msgh_request_port msgh_remote_port
-#define msgh_reply_port msgh_local_port
-
-
-#include "proc.h"
#include <cthreads.h>
#include <stdlib.h>
#include <hurd/hurd_types.h>
+#include <mach/message.h>
+#include <string.h>
+#include "proc.h"
-#ifndef __i386__
-#error This code is i386 dependent
-#else
+/* From hurd/msg.defs: */
+#define RPCID_SIG_POST 23000
struct msg_spec
{
@@ -67,75 +53,71 @@ send_signal (mach_port_t msgport,
{
error_t err;
- /* Copied from MiG generated source for msgUser.c */
- typedef struct {
- mach_msg_header_t Head;
- mach_msg_type_t signalType;
- int signal;
- mach_msg_type_t refportType;
- mach_port_t refport;
- } Request;
-
- union {
- Request In;
- } Mess;
-
- register Request *InP = &Mess.In;
-
-
- static const mach_msg_type_t signalType = {
- /* msgt_name = */ 2,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- static const mach_msg_type_t refportType = {
- /* msgt_name = */ 19,
- /* msgt_size = */ 32,
- /* msgt_number = */ 1,
- /* msgt_inline = */ TRUE,
- /* msgt_longform = */ FALSE,
- /* msgt_deallocate = */ FALSE,
- /* msgt_unused = */ 0
- };
-
- InP->signalType = signalType;
-
- InP->signal = signal;
-
- InP->refportType = refportType;
-
- InP->refport = refport;
+ static struct
+ {
+ mach_msg_header_t head;
+ mach_msg_type_t signaltype;
+ int signal;
+ mach_msg_type_t refporttype;
+ mach_port_t refport;
+ }
+ message =
+ {
+ {
+ /* Message header: */
+ (MACH_MSGH_BITS_COMPLEX
+ | MACH_MSGH_BITS (MACH_MSG_TYPE_COPY_SEND,
+ MACH_MSG_TYPE_MAKE_SEND_ONCE)), /* msgh_bits */
+ sizeof message, /* msgh_size */
+ 0, /* msgh_remote_port */
+ MACH_PORT_NULL, /* msgh_local_port */
+ 0, /* msgh_seqno */
+ RPCID_SIG_POST, /* msgh_id */
+ },
+ {
+ /* Type descriptor for signo */
+ MACH_MSG_TYPE_INTEGER_32, /* msgt_name */
+ 32, /* msgt_size */
+ 1, /* msgt_number */
+ 1, /* msgt_inline */
+ 0, /* msgt_longform */
+ 0, /* msgt_deallocate */
+ 0, /* msgt_unused */
+ },
+ /* Signal number */
+ 0,
+ {
+ /* Type descriptor for refport */
+ MACH_MSG_TYPE_COPY_SEND, /* msgt_name */
+ 32, /* msgt_size */
+ 1, /* msgt_number */
+ 1, /* msgt_unline */
+ 0, /* msgt_longform */
+ 0, /* msgt_deallocate */
+ 0, /* msgt_unused */
+ },
+ /* Reference port */
+ MACH_PORT_NULL,
+ };
- InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX|
- MACH_MSGH_BITS(19, 21);
- /* msgh_size passed as argument */
- InP->Head.msgh_request_port = msgport;
- InP->Head.msgh_reply_port = MACH_PORT_NULL;
- InP->Head.msgh_seqno = 0;
- InP->Head.msgh_id = 23000;
- /* From here on down is new code (and the point of this exercise. */
+ message.head.msgh_remote_port = msgport;
+ message.signal = signal;
+ message.refport = refport;
- err = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_SEND_TIMEOUT, 40, 0,
+ err = mach_msg((mach_msg_header_t *)&message,
+ MACH_SEND_MSG|MACH_SEND_TIMEOUT, sizeof message, 0,
MACH_PORT_NULL, 0, MACH_PORT_NULL);
if (err == MACH_SEND_TIMEOUT)
{
struct msg_spec *msg_spec = malloc (sizeof (struct msg_spec));
- msg_spec->len = 40;
- msg_spec->contents = malloc (40);
- bcopy (&InP->Head, msg_spec->contents, 40);
+ msg_spec->len = sizeof message;
+ msg_spec->contents = malloc (sizeof message);
+ bcopy (&message, msg_spec->contents, sizeof message);
cthread_detach (cthread_fork ((cthread_fn_t) blocking_message_send,
msg_spec));
}
}
-
-
-#endif /* __i386__ */