Changeset 2545646 in rtems
- Timestamp:
- Nov 22, 1999, 4:12:19 PM (21 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- cb3c1718
- Parents:
- 94f81bbd
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/posix/src/semopen.c
r94f81bbd r2545646 18 18 19 19 /*PAGE 20 * 21 * sem_open 22 * 23 * Opens a named semaphore. Used in conjunction with the sem_close 24 * and sem_unlink commands. 20 25 * 21 26 * 11.2.3 Initialize/Open a Named Semaphore, P1003.1b-1993, p.221 … … 40 45 POSIX_Semaphore_Control *the_semaphore; 41 46 Objects_Locations location; 42 47 48 _Thread_Disable_dispatch(); 43 49 44 50 if ( oflag & O_CREAT ) { … … 61 67 62 68 /* 63 * Unless we are willing to create name -> ID translation failure is64 * an error.69 * Unless provided a valid name that did not already exist 70 * and we are willing to create then it is an error. 65 71 */ 66 72 67 if ( status == EINVAL ) { 68 if ( !(oflag & O_CREAT) ) { 69 set_errno_and_return_minus_one_cast( ENOENT, sem_t * ); 70 } 73 if ( !( status == ENOENT && (oflag & O_CREAT) ) ) { 74 _Thread_Enable_dispatch(); 75 set_errno_and_return_minus_one_cast( status, sem_t * ); 71 76 } 72 73 77 } else { 74 78 … … 78 82 79 83 if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) { 84 _Thread_Enable_dispatch(); 80 85 set_errno_and_return_minus_one_cast( EEXIST, sem_t * ); 81 86 } … … 83 88 the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location ); 84 89 the_semaphore->open_count += 1; 90 _Thread_Enable_dispatch(); 91 _Thread_Enable_dispatch(); 85 92 return (sem_t *)&the_semaphore->Object.id; 86 93 … … 92 99 */ 93 100 94 status = 101 status =_POSIX_Semaphore_Create_support( 95 102 name, 96 103 FALSE, /* not shared across processes */ … … 103 110 */ 104 111 112 _Thread_Enable_dispatch(); 113 105 114 if ( status == -1 ) 106 115 return SEM_FAILED; … … 108 117 return (sem_t *) &the_semaphore->Object.id; 109 118 } 119 120 -
cpukit/posix/src/semopen.c
r94f81bbd r2545646 18 18 19 19 /*PAGE 20 * 21 * sem_open 22 * 23 * Opens a named semaphore. Used in conjunction with the sem_close 24 * and sem_unlink commands. 20 25 * 21 26 * 11.2.3 Initialize/Open a Named Semaphore, P1003.1b-1993, p.221 … … 40 45 POSIX_Semaphore_Control *the_semaphore; 41 46 Objects_Locations location; 42 47 48 _Thread_Disable_dispatch(); 43 49 44 50 if ( oflag & O_CREAT ) { … … 61 67 62 68 /* 63 * Unless we are willing to create name -> ID translation failure is64 * an error.69 * Unless provided a valid name that did not already exist 70 * and we are willing to create then it is an error. 65 71 */ 66 72 67 if ( status == EINVAL ) { 68 if ( !(oflag & O_CREAT) ) { 69 set_errno_and_return_minus_one_cast( ENOENT, sem_t * ); 70 } 73 if ( !( status == ENOENT && (oflag & O_CREAT) ) ) { 74 _Thread_Enable_dispatch(); 75 set_errno_and_return_minus_one_cast( status, sem_t * ); 71 76 } 72 73 77 } else { 74 78 … … 78 82 79 83 if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) { 84 _Thread_Enable_dispatch(); 80 85 set_errno_and_return_minus_one_cast( EEXIST, sem_t * ); 81 86 } … … 83 88 the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location ); 84 89 the_semaphore->open_count += 1; 90 _Thread_Enable_dispatch(); 91 _Thread_Enable_dispatch(); 85 92 return (sem_t *)&the_semaphore->Object.id; 86 93 … … 92 99 */ 93 100 94 status = 101 status =_POSIX_Semaphore_Create_support( 95 102 name, 96 103 FALSE, /* not shared across processes */ … … 103 110 */ 104 111 112 _Thread_Enable_dispatch(); 113 105 114 if ( status == -1 ) 106 115 return SEM_FAILED; … … 108 117 return (sem_t *) &the_semaphore->Object.id; 109 118 } 119 120
Note: See TracChangeset
for help on using the changeset viewer.