Back to index

glibc  2.9
mach_init.h
Go to the documentation of this file.
00001 /* Declarations and macros for the basic Mach things set at startup.
00002    Copyright (C) 1993, 1994, 1997 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_INIT_H
00021 
00022 #define       _MACH_INIT_H  1
00023 
00024 #include <mach/mach_types.h>
00025 
00026 /* Return the current task's task port.  */
00027 extern mach_port_t __mach_task_self (void);
00028 extern mach_port_t mach_task_self (void);
00029 
00030 /* This cache is initialized at startup.  */
00031 extern mach_port_t __mach_task_self_;
00032 #define __mach_task_self()  (__mach_task_self_ + 0)     /* Not an lvalue.  */
00033 #define mach_task_self()    (__mach_task_self ())
00034 
00035 /* Kernel page size.  */
00036 extern vm_size_t __vm_page_size;
00037 extern vm_size_t vm_page_size;
00038 
00039 /* Round the address X up to a page boundary.  */
00040 #define round_page(x)       \
00041   ((((vm_offset_t) (x) + __vm_page_size - 1) / __vm_page_size) * \
00042    __vm_page_size)
00043 
00044 /* Truncate the address X down to a page boundary.  */
00045 #define trunc_page(x)       \
00046   ((((vm_offset_t) (x)) / __vm_page_size) * __vm_page_size)
00047 
00048 #endif /* mach_init.h */