Changeset 5a18e04 in rtems


Ignore:
Timestamp:
May 28, 1996, 7:28:32 PM (24 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
7640525
Parents:
2b4683a
Message:

added initial set of api extension callouts

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/posix/headers/pthread.h

    r2b4683a r5a18e04  
    2222#endif
    2323
     24#include <rtems/posix/config.h>
     25#include <rtems/posix/threadsup.h>
     26
    2427/*
    2528 *  Data Structure used to manage a POSIX thread
     
    3437 
    3538EXTERN Objects_Information  _POSIX_Threads_Information;
     39
     40/*
     41 *  These are used to manage the user initialization tasks.
     42 */
     43 
     44EXTERN posix_initialization_tasks_table
     45                   *_POSIX_Threads_User_initialization_tasks;
     46EXTERN unsigned32   _POSIX_Threads_Number_of_initialization_tasks;
     47
    3648 
    3749/*
     
    4456 
    4557void _POSIX_Threads_Manager_initialization(
    46   unsigned32 maximum_pthreads
     58  unsigned32                        maximum_pthreads,
     59  unsigned32                        number_of_initialization_tasks,
     60  posix_initialization_tasks_table *user_tasks
    4761);
    4862 
  • c/src/exec/posix/headers/threadsup.h

    r2b4683a r5a18e04  
    2626  Chain_Control           Cancellation_Handlers;
    2727
    28 } POSIX_API_Thread_Support_Control;
     28} POSIX_API_Control;
    2929
    3030#endif
  • c/src/exec/posix/include/rtems/posix/pthread.h

    r2b4683a r5a18e04  
    2222#endif
    2323
     24#include <rtems/posix/config.h>
     25#include <rtems/posix/threadsup.h>
     26
    2427/*
    2528 *  Data Structure used to manage a POSIX thread
     
    3437 
    3538EXTERN Objects_Information  _POSIX_Threads_Information;
     39
     40/*
     41 *  These are used to manage the user initialization tasks.
     42 */
     43 
     44EXTERN posix_initialization_tasks_table
     45                   *_POSIX_Threads_User_initialization_tasks;
     46EXTERN unsigned32   _POSIX_Threads_Number_of_initialization_tasks;
     47
    3648 
    3749/*
     
    4456 
    4557void _POSIX_Threads_Manager_initialization(
    46   unsigned32 maximum_pthreads
     58  unsigned32                        maximum_pthreads,
     59  unsigned32                        number_of_initialization_tasks,
     60  posix_initialization_tasks_table *user_tasks
    4761);
    4862 
  • c/src/exec/posix/include/rtems/posix/threadsup.h

    r2b4683a r5a18e04  
    2626  Chain_Control           Cancellation_Handlers;
    2727
    28 } POSIX_API_Thread_Support_Control;
     28} POSIX_API_Control;
    2929
    3030#endif
  • c/src/exec/posix/src/pthread.c

    r2b4683a r5a18e04  
    88
    99#include <rtems/system.h>
     10#include <rtems/score/apiext.h>
    1011#include <rtems/score/stack.h>
    1112#include <rtems/score/thread.h>
     13#include <rtems/score/userext.h>
     14#include <rtems/score/wkspace.h>
    1215#include <rtems/posix/pthread.h>
     16#include <rtems/posix/config.h>
    1317
    1418/*PAGE
     
    3640/*PAGE
    3741 *
     42 *  _POSIX_Threads_Create_extension
     43 *
     44 *  XXX
     45 */
     46 
     47boolean _POSIX_Threads_Create_extension(
     48  Thread_Control *executing,
     49  Thread_Control *created
     50)
     51{
     52  POSIX_API_Control *api;
     53 
     54  api = _Workspace_Allocate( sizeof( POSIX_API_Control ) );
     55 
     56  if ( !api )
     57    return FALSE;
     58 
     59  created->API_Extensions[ THREAD_API_POSIX ] = api;
     60 
     61  /* XXX something should go here */
     62
     63  return TRUE;
     64}
     65 
     66/*PAGE
     67 *
     68 *  _POSIX_Threads_Delete_extension
     69 *
     70 *  XXX
     71 */
     72 
     73User_extensions_routine _POSIX_Threads_Delete_extension(
     74  Thread_Control *executing,
     75  Thread_Control *deleted
     76)
     77{
     78  (void) _Workspace_Free( deleted->API_Extensions[ THREAD_API_POSIX ] );
     79 
     80  deleted->API_Extensions[ THREAD_API_POSIX ] = NULL;
     81}
     82
     83/*PAGE
     84 *
     85 *  _POSIX_Threads_Initialize_user_tasks
     86 *
     87 *  This routine creates and starts all configured user
     88 *  initialzation threads.
     89 *
     90 *  Input parameters: NONE
     91 *
     92 *  Output parameters:  NONE
     93 */
     94 
     95void _POSIX_Threads_Initialize_user_tasks( void )
     96{
     97  unsigned32                        index;
     98  unsigned32                        maximum;
     99  posix_initialization_tasks_table *user_tasks;
     100 
     101  /*
     102   *  NOTE:  This is slightly different from the Ada implementation.
     103   */
     104 
     105  user_tasks = _POSIX_Threads_User_initialization_tasks;
     106  maximum    = _POSIX_Threads_Number_of_initialization_tasks;
     107 
     108  for ( index=0 ; index < maximum ; index++ ) {
     109    ;
     110  }
     111}
     112
     113API_extensions_Control _POSIX_Threads_API_extensions = {
     114  { NULL, NULL },
     115  NULL,                                     /* predriver */
     116  _POSIX_Threads_Initialize_user_tasks,     /* postdriver */
     117  NULL,                                     /* post switch */
     118};
     119 
     120User_extensions_Control _POSIX_Threads_User_extensions = {
     121  { NULL, NULL },
     122  { _POSIX_Threads_Create_extension,          /* create */
     123    NULL,                                     /* start */
     124    NULL,                                     /* restart */
     125    _POSIX_Threads_Delete_extension,          /* delete */
     126    NULL,                                     /* switch */
     127    NULL,                                     /* begin */
     128    NULL,                                     /* exitted */
     129    NULL                                      /* fatal */
     130  }
     131};
     132 
     133
     134/*PAGE
     135 *
    38136 *  _POSIX_Threads_Manager_initialization
    39137 *
     
    47145 
    48146void _POSIX_Threads_Manager_initialization(
    49   unsigned32 maximum_pthreads
    50 )
    51 {
     147  unsigned32                        maximum_pthreads,
     148  unsigned32                        number_of_initialization_tasks,
     149  posix_initialization_tasks_table *user_tasks
     150 
     151)
     152{
     153  _POSIX_Threads_Number_of_initialization_tasks =
     154                                                 number_of_initialization_tasks;
     155  _POSIX_Threads_User_initialization_tasks = user_tasks;
     156
     157  if ( user_tasks == NULL || number_of_initialization_tasks == 0 )
     158    _Internal_error_Occurred( INTERNAL_ERROR_POSIX_API, TRUE, EINVAL );
     159
    52160  _Objects_Initialize_information(
    53161    &_POSIX_Threads_Information,
     
    60168    TRUE
    61169  );
     170
     171  /* XXX add api extensions */
    62172}
    63173
     
    403513)
    404514{
    405   return POSIX_NOT_IMPLEMENTED();
     515  const pthread_attr_t  *local_attr;
     516
     517  local_attr = (attr) ? attr : &_POSIX_Threads_Default_attributes;
     518
     519  if ( !local_attr->is_initialized )
     520    return EINVAL;
     521
     522  /*
     523   *  Core Thread Initialize insures we get the minimum amount of
     524   *  stack space.
     525   */
     526
     527#if 0
     528  int contentionscope;
     529  int inheritsched;
     530  int schedpolicy;
     531  struct sched_param schedparam;
     532
     533#if defined(_POSIX_THREAD_CPUTIME)
     534  int  cputime_clock_allowed;  /* see time.h */
     535#endif
     536  int  detachstate;
     537#endif
    406538}
    407539
  • cpukit/posix/include/rtems/posix/pthread.h

    r2b4683a r5a18e04  
    2222#endif
    2323
     24#include <rtems/posix/config.h>
     25#include <rtems/posix/threadsup.h>
     26
    2427/*
    2528 *  Data Structure used to manage a POSIX thread
     
    3437 
    3538EXTERN Objects_Information  _POSIX_Threads_Information;
     39
     40/*
     41 *  These are used to manage the user initialization tasks.
     42 */
     43 
     44EXTERN posix_initialization_tasks_table
     45                   *_POSIX_Threads_User_initialization_tasks;
     46EXTERN unsigned32   _POSIX_Threads_Number_of_initialization_tasks;
     47
    3648 
    3749/*
     
    4456 
    4557void _POSIX_Threads_Manager_initialization(
    46   unsigned32 maximum_pthreads
     58  unsigned32                        maximum_pthreads,
     59  unsigned32                        number_of_initialization_tasks,
     60  posix_initialization_tasks_table *user_tasks
    4761);
    4862 
  • cpukit/posix/include/rtems/posix/threadsup.h

    r2b4683a r5a18e04  
    2626  Chain_Control           Cancellation_Handlers;
    2727
    28 } POSIX_API_Thread_Support_Control;
     28} POSIX_API_Control;
    2929
    3030#endif
  • cpukit/posix/src/pthread.c

    r2b4683a r5a18e04  
    88
    99#include <rtems/system.h>
     10#include <rtems/score/apiext.h>
    1011#include <rtems/score/stack.h>
    1112#include <rtems/score/thread.h>
     13#include <rtems/score/userext.h>
     14#include <rtems/score/wkspace.h>
    1215#include <rtems/posix/pthread.h>
     16#include <rtems/posix/config.h>
    1317
    1418/*PAGE
     
    3640/*PAGE
    3741 *
     42 *  _POSIX_Threads_Create_extension
     43 *
     44 *  XXX
     45 */
     46 
     47boolean _POSIX_Threads_Create_extension(
     48  Thread_Control *executing,
     49  Thread_Control *created
     50)
     51{
     52  POSIX_API_Control *api;
     53 
     54  api = _Workspace_Allocate( sizeof( POSIX_API_Control ) );
     55 
     56  if ( !api )
     57    return FALSE;
     58 
     59  created->API_Extensions[ THREAD_API_POSIX ] = api;
     60 
     61  /* XXX something should go here */
     62
     63  return TRUE;
     64}
     65 
     66/*PAGE
     67 *
     68 *  _POSIX_Threads_Delete_extension
     69 *
     70 *  XXX
     71 */
     72 
     73User_extensions_routine _POSIX_Threads_Delete_extension(
     74  Thread_Control *executing,
     75  Thread_Control *deleted
     76)
     77{
     78  (void) _Workspace_Free( deleted->API_Extensions[ THREAD_API_POSIX ] );
     79 
     80  deleted->API_Extensions[ THREAD_API_POSIX ] = NULL;
     81}
     82
     83/*PAGE
     84 *
     85 *  _POSIX_Threads_Initialize_user_tasks
     86 *
     87 *  This routine creates and starts all configured user
     88 *  initialzation threads.
     89 *
     90 *  Input parameters: NONE
     91 *
     92 *  Output parameters:  NONE
     93 */
     94 
     95void _POSIX_Threads_Initialize_user_tasks( void )
     96{
     97  unsigned32                        index;
     98  unsigned32                        maximum;
     99  posix_initialization_tasks_table *user_tasks;
     100 
     101  /*
     102   *  NOTE:  This is slightly different from the Ada implementation.
     103   */
     104 
     105  user_tasks = _POSIX_Threads_User_initialization_tasks;
     106  maximum    = _POSIX_Threads_Number_of_initialization_tasks;
     107 
     108  for ( index=0 ; index < maximum ; index++ ) {
     109    ;
     110  }
     111}
     112
     113API_extensions_Control _POSIX_Threads_API_extensions = {
     114  { NULL, NULL },
     115  NULL,                                     /* predriver */
     116  _POSIX_Threads_Initialize_user_tasks,     /* postdriver */
     117  NULL,                                     /* post switch */
     118};
     119 
     120User_extensions_Control _POSIX_Threads_User_extensions = {
     121  { NULL, NULL },
     122  { _POSIX_Threads_Create_extension,          /* create */
     123    NULL,                                     /* start */
     124    NULL,                                     /* restart */
     125    _POSIX_Threads_Delete_extension,          /* delete */
     126    NULL,                                     /* switch */
     127    NULL,                                     /* begin */
     128    NULL,                                     /* exitted */
     129    NULL                                      /* fatal */
     130  }
     131};
     132 
     133
     134/*PAGE
     135 *
    38136 *  _POSIX_Threads_Manager_initialization
    39137 *
     
    47145 
    48146void _POSIX_Threads_Manager_initialization(
    49   unsigned32 maximum_pthreads
    50 )
    51 {
     147  unsigned32                        maximum_pthreads,
     148  unsigned32                        number_of_initialization_tasks,
     149  posix_initialization_tasks_table *user_tasks
     150 
     151)
     152{
     153  _POSIX_Threads_Number_of_initialization_tasks =
     154                                                 number_of_initialization_tasks;
     155  _POSIX_Threads_User_initialization_tasks = user_tasks;
     156
     157  if ( user_tasks == NULL || number_of_initialization_tasks == 0 )
     158    _Internal_error_Occurred( INTERNAL_ERROR_POSIX_API, TRUE, EINVAL );
     159
    52160  _Objects_Initialize_information(
    53161    &_POSIX_Threads_Information,
     
    60168    TRUE
    61169  );
     170
     171  /* XXX add api extensions */
    62172}
    63173
     
    403513)
    404514{
    405   return POSIX_NOT_IMPLEMENTED();
     515  const pthread_attr_t  *local_attr;
     516
     517  local_attr = (attr) ? attr : &_POSIX_Threads_Default_attributes;
     518
     519  if ( !local_attr->is_initialized )
     520    return EINVAL;
     521
     522  /*
     523   *  Core Thread Initialize insures we get the minimum amount of
     524   *  stack space.
     525   */
     526
     527#if 0
     528  int contentionscope;
     529  int inheritsched;
     530  int schedpolicy;
     531  struct sched_param schedparam;
     532
     533#if defined(_POSIX_THREAD_CPUTIME)
     534  int  cputime_clock_allowed;  /* see time.h */
     535#endif
     536  int  detachstate;
     537#endif
    406538}
    407539
Note: See TracChangeset for help on using the changeset viewer.