Back to index

glibc  2.9
mach_traps.h
Go to the documentation of this file.
00001 /* Copyright (C) 1994,96,97,2002 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 /* Declare the few Mach system calls (except mach_msg, in <mach/message.h>).
00020    This does not include the kernel RPC shortcut calls (in <mach-shortcuts.h>).
00021 
00022    This file omits the MACH_IPC_COMPAT functions.  */
00023 
00024 #ifndef       _MACH_MACH_TRAPS_H
00025 
00026 #define _MACH_MACH_TRAPS_H_ 1
00027 
00028 #include <mach/port.h>
00029 #include <mach/message.h>   /* mach_msg_timeout_t */
00030 #include <mach/kern_return.h>
00031 
00032 /* Create and return a new receive right.  */
00033 extern mach_port_t mach_reply_port (void);
00034 extern mach_port_t __mach_reply_port (void);
00035 
00036 /* Return the thread control port for the calling thread.  */
00037 extern mach_port_t mach_thread_self (void);
00038 extern mach_port_t __mach_thread_self (void);
00039 
00040 /* Return the task control port for the calling task.
00041    The parens are needed to protect against the macro in <mach_init.h>.  */
00042 extern mach_port_t (mach_task_self) (void);
00043 extern mach_port_t (__mach_task_self) (void);
00044 
00045 /* Return the host information port for the host of the calling task.  */
00046 extern mach_port_t mach_host_self (void);
00047 extern mach_port_t __mach_host_self (void);
00048 
00049 /* Attempt to context switch the current thread off the processor.  Returns
00050    true if there are other threads that can be run and false if not.  */
00051 extern boolean_t swtch (void);
00052 extern boolean_t __swtch (void);
00053 
00054 /* Attempt to context switch the current thread off the processor.  Lower
00055    the thread's priority as much as possible.  The thread's priority will
00056    be restored when it runs again.  PRIORITY is currently unused.  Return
00057    true if there are other threads that can be run and false if not.  */
00058 extern boolean_t swtch_pri (int priority);
00059 extern boolean_t __swtch_pri (int priority);
00060 
00061 /* Attempt to context switch the current thread of the processor.  Try
00062    to run NEW_THREAD next, ignoring normal scheduling policies.  The
00063    OPTION value comes from <mach/thread_switch.h>.  If OPTION is
00064    SWITCH_OPTION_WAIT, then block the current thread for TIME
00065    milliseconds.  If OPTION is SWITCH_OPTION_DEPRESS, then block for
00066    TIME milliseconds and depress the thread's priority as done by
00067    swtch_pri.  If OPTION is SWITCH_OPTION_NONE, ignore TIME.  */
00068 kern_return_t thread_switch (mach_port_t new_thread,
00069                           int option, mach_msg_timeout_t option_time);
00070 kern_return_t __thread_switch (mach_port_t new_thread,
00071                           int option, mach_msg_timeout_t option_time);
00072 
00073 /* Block the current thread until the kernel (or device) event
00074    identified by EVENT occurs.  */
00075 kern_return_t evc_wait (unsigned int event);
00076 kern_return_t __evc_wait (unsigned int event);
00077 
00078 
00079 #endif /* mach/mach_traps.h */