mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 03:08:31 +00:00
Refactor some code
- Write tests for cthreads - Fix bugs in pe2.com tool - Fix ASAN issue with GetDosEnviron() - Consolidate the cthread header files - Some code size optimizations for MODE= - Attempted to squash a tls linker warning - Attempted to get futexes working on FreeBSD
This commit is contained in:
parent
909e54510d
commit
425ff5dff0
61 changed files with 529 additions and 382 deletions
|
@ -21,11 +21,15 @@
|
|||
|
||||
/**
|
||||
* Returns file descriptor associated with stream.
|
||||
*
|
||||
* @param f is file stream object pointer
|
||||
* @return fd on success or -1 w/ errno;
|
||||
* @threadsafe
|
||||
*/
|
||||
int fileno_unlocked(FILE *f) {
|
||||
if (f->fd != -1) {
|
||||
return f->fd;
|
||||
} else {
|
||||
return ebadf();
|
||||
}
|
||||
int fileno(FILE *f) {
|
||||
int rc;
|
||||
flockfile(f);
|
||||
rc = fileno_unlocked(f);
|
||||
funlockfile(f);
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue