From: reinholj@Informatik.TU-Muenchen.DE (Joerg Reinhold)
Subject: Help: task_create() , mach_msg()
Date: Fri, 20 Aug 1993 06:51:10 GMT [thread overview]
Message-ID: <1993Aug20.065110.23758@Informatik.TU-Muenchen.DE> (raw)
Hello,
I'm new with mach and I want program with the mach functions and message calls,
not with the unix-server calls. Our machines have no Name-Server, only sometimes !
My first problem is to create a mach-task out if another mach-task.
And the I want to send a message to the new task and back.
Have you ever made it or seen a piece of code ?
Or is there a book with examples on it ?
Please help, Thank You
Joerg Reinhold
reinholj@Informatik.TU-Muenchen.DE
Closer description:
I have read most of the Kernel-Principles and Server-Writers-Guide out of
our /pub/comp/os/mach/mach3/doc/osf and had a look into the Interface -Documents
from the OSF.
I haven't found any example about my problems: task_create , mach_msg.
After studying the source code of the cthread-library I created a new thread
in the calling task. But creating a task:
/* create the new task: child_task */
task_create (mach_task_self(), &child_task)
/* within the new task a thread */
thread_create (child_task, &child_thread)
/* for setting processor-registers */
/* especially programcounter and stackpointer */
thread_get_state (child_thread, ...
/* new memory for the stack in the new task */
vm_allocate (child_task, ...
/* this memory, you can't access in the old (parent) task */
/* the same amount of memory in the parent task */
vm_allocate (mach_task_self(), ...
/* set stack values */
/* and write it to the stack memory of the child */
vm_write (child_task, ...
/* free the memory of the parent */
vm_deallocate (...
thread_set_state (child_thread, ...
thread_resume (child_thread)
Everything is done correctly, the parent task runs, but the child task hangs
(doesn't start). Doing nearly the same code for creating a thread in the parent
task (no problems with stack access) the parent thread and the child thread
run happily. Everything used in my code, I have seen in the cthreads -library
source code. I haven't found anything about this in the OSF-paper ! or I'm
unable to read documents ?
The second problem, I have, is mach_msg.
For example I allocate a new port: mach_port_allocate , and I get a receive right
to this port. But how gets the sender notice of this port and a send right to it.
I tried to create a send right and the I want to transfer it to the sender
(known by its task_port or thread_port).
But couldn't even create a send right. The Kernel-Principles say something about
mach_msg is the way. But the Kernel-Interface don't help me, so I take a look
at the mach/message.h file, it is better, but it also doesn't work.
I haven't found any example.
Looking all the kernel sources and ! understand it !, to do such fundamental
things like creating a task and communicate, couldn't be the purpose of a "new"
operating system.
Where are the docs with examples ? or the other way round
Where are the examples with documentation ?
Thank's for reading and a little help (hint)
Joerg Reinhold
reinholj@Informatik.TU-Muenchen.DE
reply other threads:[~1993-08-20 6:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox