Back to index

glibc  2.9
mig_support.h
Go to the documentation of this file.
00001 /* Copyright (C) 1993,94,97,99,2001,2007 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 /* Useful declarations and support functions for MiG-generated stubs.  */
00020 
00021 #ifndef       _MACH_MIG_SUPPORT_H
00022 
00023 #define       _MACH_MIG_SUPPORT_H  1
00024 
00025 #include <mach/std_types.h>
00026 #include <mach/message.h>
00027 #include <sys/types.h>
00028 #include <string.h>
00029 
00030 #ifndef __USE_GNU
00031 /* The only problem that has come up so far is __stpncpy being undeclared
00032    below because <string.h> doesn't declare it without __USE_GNU.  We could
00033    work around that problem by just adding the declaration there, or by
00034    eliding the inline functions in the absence of __USE_GNU.  But either of
00035    these would result in unoptimized calls (because no inline version of
00036    __stpncpy will have been defined), and there may be other niggling
00037    problems lurking.  Instead we simply insist on _GNU_SOURCE for
00038    compiling mig output; anyway, that better reflects the fact that mig
00039    output requires nonstandard special support code not found elsewhere.  */
00040 # error mig stubs must be compiled with -D_GNU_SOURCE
00041 #endif
00042 
00043 /* MiG initialization.  */
00044 extern void __mig_init (void *__first);
00045 extern void mig_init (void *__first);
00046 
00047 /* Shorthand functions for vm_allocate and vm_deallocate on
00048    mach_task_self () (and with ANYWHERE=1).  */
00049 extern void __mig_allocate (vm_address_t *__addr_p, vm_size_t __size);
00050 extern void mig_allocate (vm_address_t *__addr_p, vm_size_t __size);
00051 extern void __mig_deallocate (vm_address_t __addr, vm_size_t __size);
00052 extern void mig_deallocate (vm_address_t __addr, vm_size_t __size);
00053 
00054 /* Reply-port management support functions.  */
00055 extern void __mig_dealloc_reply_port (mach_port_t);
00056 extern void mig_dealloc_reply_port (mach_port_t);
00057 extern mach_port_t __mig_get_reply_port (void);
00058 extern mach_port_t mig_get_reply_port (void);
00059 extern void __mig_put_reply_port (mach_port_t);
00060 extern void mig_put_reply_port (mach_port_t);
00061 
00062 extern void __mig_reply_setup (const mach_msg_header_t *__request,
00063                             mach_msg_header_t *__reply);
00064 extern void mig_reply_setup (const mach_msg_header_t *__request,
00065                           mach_msg_header_t *__reply);
00066 
00067 /* Idiocy support function.  */
00068 extern vm_size_t mig_strncpy (char *__dst, const char *__src, vm_size_t __len);
00069 extern vm_size_t __mig_strncpy (char *__dst, const char *__src, vm_size_t);
00070 __extern_inline vm_size_t
00071 __mig_strncpy (char *__dst, const char *__src, vm_size_t __len)
00072 {
00073   return __stpncpy (__dst, __src, __len) - __dst;
00074 }
00075 __extern_inline vm_size_t
00076 mig_strncpy (char *__dst, const char *__src, vm_size_t __len)
00077 {
00078   return __mig_strncpy (__dst, __src, __len);
00079 }
00080 
00081 
00082 
00083 #endif /* mach/mig_support.h */