Ticket #134: diff
File diff, 9.4 KB (added by Chris Johns, on 12/03/06 at 13:31:13) |
---|
-
c/src/exec/sapi/src/Makefile.am
? c/src/exec/sapi/changes-joel RCS file: /usr1/CVS/rtems/c/src/exec/sapi/src/Makefile.am,v retrieving revision 1.5 diff -u -r1.5 Makefile.am
4 4 5 5 AUTOMAKE_OPTIONS = foreign 1.4 6 6 7 C_FILES = debug.c entrytable.c extension.c fatal.c exinit.c io.c itronapi.c \ 8 posixapi.c rtemsapi.c 7 EXTENSION_FILES = extension.c extensioncreate.c extensiondelete.c \ 8 extensionident.c 9 C_FILES = debug.c entrytable.c $(EXTENSION_FILES) fatal.c exinit.c io.c \ 10 itronapi.c posixapi.c rtemsapi.c 9 11 C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o) 10 12 11 13 OBJS = $(C_O_FILES) -
c/src/exec/sapi/src/extension.c
RCS file: /usr1/CVS/rtems/c/src/exec/sapi/src/extension.c,v retrieving revision 1.13 diff -u -r1.13 extension.c
2 2 * Extension Manager 3 3 * 4 4 * 5 * COPYRIGHT (c) 1989- 1999.5 * COPYRIGHT (c) 1989-2002. 6 6 * On-Line Applications Research Corporation (OAR). 7 7 * 8 8 * The license and distribution terms for this file may be … … 44 44 RTEMS_MAXIMUM_NAME_LENGTH, 45 45 FALSE 46 46 ); 47 }48 49 /*PAGE50 *51 * rtems_extension_create52 *53 * This directive creates a extension and performs some initialization.54 *55 * Input parameters:56 * name - extension name57 * extension_table - pointer to extension set information58 * id - pointer to extension id59 *60 * Output parameters:61 * id - extension id62 * RTEMS_SUCCESSFUL - if successful63 * error code - if unsuccessful64 */65 66 rtems_status_code rtems_extension_create(67 rtems_name name,68 rtems_extensions_table *extension_table,69 Objects_Id *id70 )71 {72 Extension_Control *the_extension;73 74 if ( !rtems_is_name_valid( name ) )75 return RTEMS_INVALID_NAME;76 77 _Thread_Disable_dispatch(); /* to prevent deletion */78 79 the_extension = _Extension_Allocate();80 81 if ( !the_extension ) {82 _Thread_Enable_dispatch();83 return RTEMS_TOO_MANY;84 }85 86 _User_extensions_Add_set( &the_extension->Extension, extension_table );87 88 _Objects_Open( &_Extension_Information, &the_extension->Object, &name );89 90 *id = the_extension->Object.id;91 _Thread_Enable_dispatch();92 return RTEMS_SUCCESSFUL;93 }94 95 /*PAGE96 *97 * rtems_extension_ident98 *99 * This directive returns the system ID associated with100 * the extension name.101 *102 * Input parameters:103 * name - user defined message queue name104 * id - pointer to extension id105 *106 * Output parameters:107 * *id - message queue id108 * RTEMS_SUCCESSFUL - if successful109 * error code - if unsuccessful110 */111 112 rtems_status_code rtems_extension_ident(113 rtems_name name,114 Objects_Id *id115 )116 {117 Objects_Name_to_id_errors status;118 119 status = _Objects_Name_to_id(120 &_Extension_Information,121 &name,122 OBJECTS_SEARCH_LOCAL_NODE,123 id124 );125 126 return _Status_Object_name_errors_to_status[ status ];127 }128 129 /*PAGE130 *131 * rtems_extension_delete132 *133 * This directive allows a thread to delete a extension.134 *135 * Input parameters:136 * id - extension id137 *138 * Output parameters:139 * RTEMS_SUCCESSFUL - if successful140 * error code - if unsuccessful141 */142 143 rtems_status_code rtems_extension_delete(144 Objects_Id id145 )146 {147 Extension_Control *the_extension;148 Objects_Locations location;149 150 the_extension = _Extension_Get( id, &location );151 switch ( location ) {152 case OBJECTS_ERROR:153 case OBJECTS_REMOTE: /* should never return this */154 return RTEMS_INVALID_ID;155 case OBJECTS_LOCAL:156 _User_extensions_Remove_set( &the_extension->Extension );157 _Objects_Close( &_Extension_Information, &the_extension->Object );158 _Extension_Free( the_extension );159 _Thread_Enable_dispatch();160 return RTEMS_SUCCESSFUL;161 }162 163 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */164 47 } -
new file extensioncreate.c
RCS file: extensioncreate.c diff -N extensioncreate.c
- + 1 /* 2 * Extension Manager -- rtems_extension_create 3 * 4 * 5 * COPYRIGHT (c) 1989-2002. 6 * On-Line Applications Research Corporation (OAR). 7 * 8 * The license and distribution terms for this file may be 9 * found in the file LICENSE in this distribution or at 10 * http://www.OARcorp.com/rtems/license.html. 11 * 12 * $Id: extension.c,v 1.13 1999/11/17 17:50:29 joel Exp $ 13 */ 14 15 #include <rtems/system.h> 16 #include <rtems/rtems/support.h> 17 #include <rtems/score/object.h> 18 #include <rtems/score/thread.h> 19 #include <rtems/extension.h> 20 21 /*PAGE 22 * 23 * rtems_extension_create 24 * 25 * This directive creates a extension and performs some initialization. 26 * 27 * Input parameters: 28 * name - extension name 29 * extension_table - pointer to extension set information 30 * id - pointer to extension id 31 * 32 * Output parameters: 33 * id - extension id 34 * RTEMS_SUCCESSFUL - if successful 35 * error code - if unsuccessful 36 */ 37 38 rtems_status_code rtems_extension_create( 39 rtems_name name, 40 rtems_extensions_table *extension_table, 41 Objects_Id *id 42 ) 43 { 44 Extension_Control *the_extension; 45 46 if ( !rtems_is_name_valid( name ) ) 47 return RTEMS_INVALID_NAME; 48 49 _Thread_Disable_dispatch(); /* to prevent deletion */ 50 51 the_extension = _Extension_Allocate(); 52 53 if ( !the_extension ) { 54 _Thread_Enable_dispatch(); 55 return RTEMS_TOO_MANY; 56 } 57 58 _User_extensions_Add_set( &the_extension->Extension, extension_table ); 59 60 _Objects_Open( &_Extension_Information, &the_extension->Object, &name ); 61 62 *id = the_extension->Object.id; 63 _Thread_Enable_dispatch(); 64 return RTEMS_SUCCESSFUL; 65 } -
new file extensiondelete.c
RCS file: extensiondelete.c diff -N extensiondelete.c
- + 1 /* 2 * Extension Manager -- rtems_extension_delete 3 * 4 * 5 * COPYRIGHT (c) 1989-2002. 6 * On-Line Applications Research Corporation (OAR). 7 * 8 * The license and distribution terms for this file may be 9 * found in the file LICENSE in this distribution or at 10 * http://www.OARcorp.com/rtems/license.html. 11 * 12 * $Id: extension.c,v 1.13 1999/11/17 17:50:29 joel Exp $ 13 */ 14 15 #include <rtems/system.h> 16 #include <rtems/rtems/support.h> 17 #include <rtems/score/object.h> 18 #include <rtems/score/thread.h> 19 #include <rtems/extension.h> 20 21 /*PAGE 22 * 23 * rtems_extension_delete 24 * 25 * This directive allows a thread to delete a extension. 26 * 27 * Input parameters: 28 * id - extension id 29 * 30 * Output parameters: 31 * RTEMS_SUCCESSFUL - if successful 32 * error code - if unsuccessful 33 */ 34 35 rtems_status_code rtems_extension_delete( 36 Objects_Id id 37 ) 38 { 39 Extension_Control *the_extension; 40 Objects_Locations location; 41 42 the_extension = _Extension_Get( id, &location ); 43 switch ( location ) { 44 case OBJECTS_ERROR: 45 case OBJECTS_REMOTE: /* should never return this */ 46 return RTEMS_INVALID_ID; 47 case OBJECTS_LOCAL: 48 _User_extensions_Remove_set( &the_extension->Extension ); 49 _Objects_Close( &_Extension_Information, &the_extension->Object ); 50 _Extension_Free( the_extension ); 51 _Thread_Enable_dispatch(); 52 return RTEMS_SUCCESSFUL; 53 } 54 55 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 56 } -
new file extensionident.c
RCS file: extensionident.c diff -N extensionident.c
- + 1 /* 2 * Extension Manager -- rtems_extension_ident 3 * 4 * 5 * COPYRIGHT (c) 1989-2002. 6 * On-Line Applications Research Corporation (OAR). 7 * 8 * The license and distribution terms for this file may be 9 * found in the file LICENSE in this distribution or at 10 * http://www.OARcorp.com/rtems/license.html. 11 * 12 * $Id: extension.c,v 1.13 1999/11/17 17:50:29 joel Exp $ 13 */ 14 15 #include <rtems/system.h> 16 #include <rtems/rtems/support.h> 17 #include <rtems/score/object.h> 18 #include <rtems/score/thread.h> 19 #include <rtems/extension.h> 20 21 /*PAGE 22 * 23 * rtems_extension_ident 24 * 25 * This directive returns the system ID associated with 26 * the extension name. 27 * 28 * Input parameters: 29 * name - user defined message queue name 30 * id - pointer to extension id 31 * 32 * Output parameters: 33 * *id - message queue id 34 * RTEMS_SUCCESSFUL - if successful 35 * error code - if unsuccessful 36 */ 37 38 rtems_status_code rtems_extension_ident( 39 rtems_name name, 40 Objects_Id *id 41 ) 42 { 43 Objects_Name_to_id_errors status; 44 45 status = _Objects_Name_to_id( 46 &_Extension_Information, 47 &name, 48 OBJECTS_SEARCH_LOCAL_NODE, 49 id 50 ); 51 52 return _Status_Object_name_errors_to_status[ status ]; 53 }