Changeset 1131
- Timestamp:
- Feb 1, 2004, 12:53:27 AM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/lib/sys/filehandles.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1130 r1131 63 63 *******************************************************************************/ 64 64 static int __libc_fhMoreHandles(unsigned cMin); 65 static int __libc_fhAllocate(int fh, unsigned fFlags, int cb, PLIBCFHOPS pOps, PLIBCFH *ppFH, int *pfh, int fOwnSem); 65 66 66 67 … … 197 198 * Allocate handle and initialize handle. 198 199 */ 199 rc = __libc_ FHAllocate(i, fLibc, sizeof(LIBCFH), NULL, NULL, NULL);200 rc = __libc_fhAllocate(i, fLibc, sizeof(LIBCFH), NULL, NULL, NULL, 1); 200 201 if (rc) 201 202 { … … 422 423 * @param ppFH Where to store the allocated file handle struct pointer. (NULL allowed) 423 424 * @param pfh Where to store the number of the filehandle allocated. 425 * @param fOwnSem Set if we should not take or release the semaphore. 424 426 * @remark The preallocated handles make this function somewhat big and messy. 425 427 */ 426 int __libc_FHAllocate(int fh, unsigned fFlags, int cb, PLIBCFHOPS pOps, PLIBCFH *ppFH, int *pfh)428 static int __libc_fhAllocate(int fh, unsigned fFlags, int cb, PLIBCFHOPS pOps, PLIBCFH *ppFH, int *pfh, int fOwnSem) 427 429 { 428 430 PLIBCFH pFH; … … 445 447 * Now take the lock. 446 448 */ 447 if ( _fmutex_request(&gmtx, 0))449 if (!fOwnSem && _fmutex_request(&gmtx, 0)) 448 450 return -1; 449 451 … … 582 584 *pfh = fh; 583 585 584 _fmutex_release(&gmtx); 586 if (!fOwnSem) 587 _fmutex_release(&gmtx); 585 588 return rc; 586 589 } 590 591 /** 592 * Allocates a file handle. 593 * 594 * @returns 0 on success. 595 * @returns OS/2 error code and errno set to the corresponding error number. 596 * @param fh Number of the filehandle to allocate. 597 * Will fail if the handle is in use. 598 * Use -1 for any handle. 599 * @param fFlags Initial flags. 600 * @param cb Size of the file handle. 601 * Must not be less than the mandatory size (sizeof(LIBCFH)). 602 * @param pOps Value of the pOps field, NULL not allowed. 603 * @param ppFH Where to store the allocated file handle struct pointer. (NULL allowed) 604 * @param pfh Where to store the number of the filehandle allocated. 605 * @remark The preallocated handles make this function somewhat big and messy. 606 */ 607 int __libc_FHAllocate(int fh, unsigned fFlags, int cb, PLIBCFHOPS pOps, PLIBCFH *ppFH, int *pfh) 608 { 609 return __libc_fhAllocate(fh, fFlags, cb, pOps, ppFH, pfh, 0); 610 } 611 587 612 588 613 /** … … 749 774 * Allocate a new handle for this filehandle. 750 775 */ 751 rc = __libc_ FHAllocate(fh, fLibc, sizeof(LIBCFH), NULL, &pFH, NULL);776 rc = __libc_fhAllocate(fh, fLibc, sizeof(LIBCFH), NULL, &pFH, NULL, 1); 752 777 if (rc) 753 778 pFH = NULL; -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.