Back to index

glibc  2.9
mach.h
Go to the documentation of this file.
00001 /* Standard header for all Mach programs.
00002    Copyright (C) 1993,94,96,97,2002 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef       _MACH_H
00021 
00022 #define       _MACH_H       1
00023 
00024 /* We must include this before using __need_FILE with <stdio.h> below.  */
00025 #include <features.h>
00026 
00027 
00028 /* Get the basic types used by Mach.  */
00029 #include <mach/mach_types.h>
00030 
00031 /* This declares the basic variables and macros everything needs.  */
00032 #include <mach_init.h>
00033 
00034 /* This declares all the real system call functions.  */
00035 #include <mach/mach_traps.h>
00036 
00037 /* These are MiG-generated headers for the kernel interfaces commonly used.  */
00038 #include <mach/mach_interface.h> /* From <mach/mach.defs>.  */
00039 #include <mach/mach_port.h>
00040 #include <mach/mach_host.h>
00041 
00042 /* For the kernel RPCs which have system call shortcut versions,
00043    the MiG-generated header in fact declares `CALL_rpc' rather than `CALL'.
00044    This file declares the simple `CALL' functions.  */
00045 #include <mach-shortcuts.h>
00046 
00047 
00048 /* Receive RPC request messages on RCV_NAME and pass them to DEMUX, which
00049    decodes them and produces reply messages.  MAX_SIZE is the maximum size
00050    (in bytes) of the request and reply buffers.  */
00051 extern mach_msg_return_t
00052 __mach_msg_server (boolean_t (*__demux) (mach_msg_header_t *__request,
00053                                     mach_msg_header_t *__reply),
00054                  mach_msg_size_t __max_size,
00055                  mach_port_t __rcv_name),
00056 mach_msg_server (boolean_t (*__demux) (mach_msg_header_t *__request,
00057                                    mach_msg_header_t *__reply),
00058                mach_msg_size_t __max_size,
00059                mach_port_t __rcv_name);
00060 
00061 /* Just like `mach_msg_server', but the OPTION and TIMEOUT parameters are
00062    passed on to `mach_msg'.  */
00063 extern mach_msg_return_t
00064 __mach_msg_server_timeout (boolean_t (*__demux) (mach_msg_header_t *__request,
00065                                            mach_msg_header_t *__reply),
00066                         mach_msg_size_t __max_size,
00067                         mach_port_t __rcv_name,
00068                         mach_msg_option_t __option,
00069                         mach_msg_timeout_t __timeout),
00070 mach_msg_server_timeout (boolean_t (*__demux) (mach_msg_header_t *__request,
00071                                           mach_msg_header_t *__reply),
00072                       mach_msg_size_t __max_size,
00073                       mach_port_t __rcv_name,
00074                       mach_msg_option_t __option,
00075                       mach_msg_timeout_t __timeout);
00076 
00077 
00078 /* Deallocate all port rights and out-of-line memory in MSG. */
00079 extern void
00080 __mach_msg_destroy (mach_msg_header_t *msg),
00081 mach_msg_destroy (mach_msg_header_t *msg);
00082 
00083 
00084 #define __need_FILE
00085 #include <stdio.h>
00086 
00087 /* Open a stream on a Mach device.  */
00088 extern FILE *mach_open_devstream (mach_port_t device_port, const char *mode);
00089 
00090 /* Give THREAD a stack and set it to run at PC when resumed.
00091    If *STACK_SIZE is nonzero, that size of stack is allocated.
00092    If *STACK_BASE is nonzero, that stack location is used.
00093    If STACK_BASE is not null it is filled in with the chosen stack base.
00094    If STACK_SIZE is not null it is filled in with the chosen stack size.
00095    Regardless, an extra page of red zone is allocated off the end; this
00096    is not included in *STACK_SIZE.  */
00097 kern_return_t __mach_setup_thread (task_t task, thread_t thread, void *pc,
00098                                vm_address_t *stack_base,
00099                                vm_size_t *stack_size);
00100 kern_return_t mach_setup_thread (task_t task, thread_t thread, void *pc,
00101                              vm_address_t *stack_base,
00102                              vm_size_t *stack_size);
00103 
00104 
00105 #endif /* mach.h */