/[hurd]/hurd/libthreads/mig_support.c
ViewVC logotype

Diff of /hurd/libthreads/mig_support.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by mib, Thu Nov 18 20:57:46 1993 UTC revision 1.4 by roland, Mon May 27 02:50:10 2002 UTC
# Line 1  Line 1 
1  /*  /*
2   * Mach Operating System   * Mach Operating System
3   * Copyright (c) 1991,1990,1989 Carnegie Mellon University   * Copyright (c) 1993-1989 Carnegie Mellon University
4   * All Rights Reserved.   * All Rights Reserved.
5   *   *
6   * Permission to use, copy, modify and distribute this software and its   * Permission to use, copy, modify and distribute this software and its
7   * documentation is hereby granted, provided that both the copyright   * documentation is hereby granted, provided that both the copyright
8   * notice and this permission notice appear in all copies of the   * notice and this permission notice appear in all copies of the
9   * software, derivative works or modified versions, and any portions   * software, derivative works or modified versions, and any portions
10   * thereof, and that both notices appear in supporting documentation.   * thereof, and that both notices appear in supporting documentation.
11   *   *
12   * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"   * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13   * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR   * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14   * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.   * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15   *   *
16   * Carnegie Mellon requests users of this software to return to   * Carnegie Mellon requests users of this software to return to
17   *   *
18   *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU   *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
19   *  School of Computer Science   *  School of Computer Science
20   *  Carnegie Mellon University   *  Carnegie Mellon University
21   *  Pittsburgh PA 15213-3890   *  Pittsburgh PA 15213-3890
22   *   *
23   * any improvements or extensions that they make and grant Carnegie Mellon   * any improvements or extensions that they make and grant Carnegie Mellon
24   * the rights to redistribute these changes.   * the rights to redistribute these changes.
25   */   */
26  /*  /*
27   * HISTORY   * HISTORY
28     * 26-Feb-94  Johannes Helander (jvh) at Helsinki University of Technology
29     *      Added mach_put_reply_port. mig_dealloc_reply_port now takes the
30     *      port as an argument.
31     *
32   * $Log$   * $Log$
33   * Revision 1.3  1993/11/18 20:57:46  mib   * Revision 1.4  2002/05/27 02:50:10  roland
34   * entered into RCS   * 2002-05-26  Roland McGrath  <roland@frob.com>
35     *
36     *      Changes merged from CMU MK83a version:
37     *      * cthreads.h, options.h: Various cleanups.
38     *      * call.c, cthread_data.c, sync.c, mig_support.c: Likewise.
39     *      * i386/cthreads.h, i386/thread.c, i386/lock.s: Likewise.
40     *      * cthread_internals.h: Add decls for internal functions.
41     *      (struct cproc): Use vm_offset_t for stack_base and stack_size members.
42     *      Use natural_t for context member.
43     *      * cprocs.c: Use prototypes for all defns.
44     *      * cthreads.c: Likewise.
45     *      (cthread_exit): Cast any_t to integer_t before int.
46     *
47     * Revision 2.8  93/01/24  13:27:14  danner
48     *      Corrrected include of mach/mach.h to mach.h
49     *      [93/01/16            mrt]
50     *
51     * Revision 2.7  93/01/14  18:05:37  danner
52     *      Converted file to ANSI C.
53     *      Made argument to mig_init a void * for compatibility with
54     *      mig_init in libmach.
55     *      [92/12/18            pds]
56   *   *
57   * Revision 2.6  91/05/14  17:57:41  mrt   * Revision 2.6  91/05/14  17:57:41  mrt
58   *      Correcting copyright   *      Correcting copyright
59   *   *
60   * Revision 2.5  91/02/14  14:20:30  mrt   * Revision 2.5  91/02/14  14:20:30  mrt
61   *      Added new Mach copyright   *      Added new Mach copyright
62   *      [91/02/13  12:41:26  mrt]   *      [91/02/13  12:41:26  mrt]
63   *   *
64   * Revision 2.4  90/08/07  14:31:41  rpd   * Revision 2.4  90/08/07  14:31:41  rpd
65   *      Removed RCS keyword nonsense.   *      Removed RCS keyword nonsense.
66   *   *
67   * Revision 2.3  90/08/07  14:27:48  rpd   * Revision 2.3  90/08/07  14:27:48  rpd
68   *      When we recycle the global reply port by giving it to the first   *      When we recycle the global reply port by giving it to the first
69   *      cthread, clear the global reply port.  This will take care of   *      cthread, clear the global reply port.  This will take care of
70   *      someone accidently calling this twice.   *      someone accidently calling this twice.
71   *      [90/08/07            rwd]   *      [90/08/07            rwd]
72   *   *
73   * Revision 2.2  90/06/02  15:14:04  rpd   * Revision 2.2  90/06/02  15:14:04  rpd
74   *      Converted to new IPC.   *      Converted to new IPC.
75   *      [90/03/20  20:56:50  rpd]   *      [90/03/20  20:56:50  rpd]
76   *   *
77   * Revision 2.1  89/08/03  17:09:50  rwd   * Revision 2.1  89/08/03  17:09:50  rwd
78   * Created.   * Created.
79   *   *
80   * 18-Jan-89  David Golub (dbg) at Carnegie-Mellon University   * 18-Jan-89  David Golub (dbg) at Carnegie-Mellon University
81   *      Replaced task_data() by thread_reply().   *      Replaced task_data() by thread_reply().
82   *   *
# Line 78  Line 103 
103   */   */
104    
105    
106  #include <mach/mach.h>  #include <mach.h>
107    #include <mach/mig_support.h>
108    #include <mach/mach_traps.h>
109  #include <cthreads.h>  #include <cthreads.h>
110  #include "cthread_internals.h"  #include "cthread_internals.h"
111    
# Line 91  private mach_port_t mig_reply_port = MAC Line 118  private mach_port_t mig_reply_port = MAC
118   * called and again with initial cproc at end of cthread_init.   * called and again with initial cproc at end of cthread_init.
119   */   */
120  void  void
121  mig_init(initial)  mig_init(register void *initial)
         register cproc_t initial;  
122  {  {
123          if (initial == NO_CPROC) {          if (initial == NO_CPROC) {
124                  /* called from mach_init before cthread_init,                  /* called from mach_init before cthread_init,
# Line 104  mig_init(initial) Line 130  mig_init(initial)
130                  /* recycle global reply port as this cthread's reply port */                  /* recycle global reply port as this cthread's reply port */
131    
132                  multithreaded = TRUE;                  multithreaded = TRUE;
133                  initial->reply_port = mig_reply_port;                  ((cproc_t) initial)->reply_port = mig_reply_port;
134                  mig_reply_port = MACH_PORT_NULL;                  mig_reply_port = MACH_PORT_NULL;
135          }          }
136  }  }
137    
 void  
 __mig_init (initial)  
      register cproc_t initial;  
 {  
   mig_init (initial);  
 }  
   
138  /*  /*
139   * Called by mig interface code whenever a reply port is needed.   * Called by mig interface code whenever a reply port is needed.
140   */   */
141  mach_port_t  mach_port_t
142  mig_get_reply_port()  mig_get_reply_port(void)
143  {  {
144          register mach_port_t reply_port;          register mach_port_t reply_port;
145    
# Line 140  mig_get_reply_port() Line 159  mig_get_reply_port()
159          return reply_port;          return reply_port;
160  }  }
161    
 mach_port_t  
 __mig_get_reply_port()  
 {  
   return mig_get_reply_port();  
 }  
   
162  /*  /*
163   * Called by mig interface code after a timeout on the reply port.   * Called by mig interface code after a timeout on the reply port.
164   * May also be called by user.   * May also be called by user.
165   */   */
166    /*ARGSUSED*/
167  void  void
168  mig_dealloc_reply_port()  mig_dealloc_reply_port(mach_port_t p)
169  {  {
170          register mach_port_t reply_port;          register mach_port_t reply_port;
171    
# Line 172  mig_dealloc_reply_port() Line 186  mig_dealloc_reply_port()
186                                    MACH_PORT_RIGHT_RECEIVE, -1);                                    MACH_PORT_RIGHT_RECEIVE, -1);
187  }  }
188    
189    /*
190     *  Called by mig interfaces when done with a port.
191     *  Used to provide the same interface as needed when a custom
192     *  allocator is used.
193     */
194    
195    /*ARGSUSED*/
196    void
197    mig_put_reply_port(mach_port_t port)
198    {
199            /* Do nothing */
200    }
201    
202    void
203    __mig_init(register void *initial)
204    {
205      mig_init (initial);
206    }
207    
208    mach_port_t
209    __mig_get_reply_port(void)
210    {
211      return mig_get_reply_port();
212    }
213    
214    void
215    __mig_dealloc_reply_port(mach_port_t p)
216    {
217      mig_dealloc_reply_port(p);
218    }
219    
220    void
221    __mig_put_reply_port(mach_port_t port)
222    {
223      mig_put_reply_port(port);
224    }
225    
226  void  void
227  __mig_dealloc_reply_port ()  __mig_dealloc_reply_port (void)
228  {  {
229    mig_dealloc_reply_port ();    mig_dealloc_reply_port ();
230  }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26