diff --git a/libc/Makefile b/libc/Makefile index f50b5a85..950cecfc 100644 --- a/libc/Makefile +++ b/libc/Makefile @@ -120,8 +120,6 @@ stdio/fsetdefaultbuf.o \ stdio/fsetdefaultbuf_unlocked.o \ stdio/fseterr.o \ stdio/fseterr_unlocked.o \ -stdio/fsetlocking.o \ -stdio/fsetlocking_unlocked.o \ stdio/fshutdown.o \ stdio/ftell.o \ stdio/ftello.o \ diff --git a/libc/include/FILE.h b/libc/include/FILE.h index f289b35d..17f6a41b 100644 --- a/libc/include/FILE.h +++ b/libc/include/FILE.h @@ -58,12 +58,11 @@ typedef struct FILE FILE; #define _FILE_BUFFER_MODE_SET (1<<1) #define _FILE_LAST_WRITE (1<<2) #define _FILE_LAST_READ (1<<3) -#define _FILE_AUTO_LOCK (1<<4) -#define _FILE_BUFFER_OWNED (1<<5) -#define _FILE_STATUS_ERROR (1<<6) -#define _FILE_STATUS_EOF (1<<7) -#define _FILE_READABLE (1<<8) -#define _FILE_WRITABLE (1<<9) +#define _FILE_BUFFER_OWNED (1<<4) +#define _FILE_STATUS_ERROR (1<<5) +#define _FILE_STATUS_EOF (1<<6) +#define _FILE_READABLE (1<<7) +#define _FILE_WRITABLE (1<<8) #define _FILE_MAX_PUSHBACK 8 diff --git a/libc/include/stdio.h b/libc/include/stdio.h index 5de67bf1..91f4ec53 100644 --- a/libc/include/stdio.h +++ b/libc/include/stdio.h @@ -321,8 +321,6 @@ void fpurge_unlocked(FILE* fp); #define fpending __fpending size_t fpending_unlocked(FILE* fp); #define flushlbf _flushlbf -#define fsetlocking __fsetlocking -int fsetlocking_unlocked(FILE* fp, int type); #endif /* The Sortix backends for *printf and *scanf. */ diff --git a/libc/include/stdio_ext.h b/libc/include/stdio_ext.h index 57ada8f4..ee4ce365 100644 --- a/libc/include/stdio_ext.h +++ b/libc/include/stdio_ext.h @@ -1,6 +1,6 @@ /******************************************************************************* - Copyright(C) Jonas 'Sortie' Termansen 2012. + Copyright(C) Jonas 'Sortie' Termansen 2012, 2014. This file is part of the Sortix C Library. @@ -29,17 +29,6 @@ #include -enum -{ - FSETLOCKING_QUERY = 0, - FSETLOCKING_INTERNAL, - FSETLOCKING_BYCALLER, -}; - -#define FSETLOCKING_QUERY FSETLOCKING_QUERY -#define FSETLOCKING_INTERNAL FSETLOCKING_INTERNAL -#define FSETLOCKING_BYCALLER FSETLOCKING_BYCALLER - __BEGIN_DECLS size_t __fbufsize(FILE* fp); @@ -51,7 +40,6 @@ int __flbf(FILE* fp); void __fpurge(FILE* fp); size_t __fpending(FILE* fp); void _flushlbf(void); -int __fsetlocking(FILE* fp, int type); __END_DECLS diff --git a/libc/stdio/fresetfile.cpp b/libc/stdio/fresetfile.cpp index 4da2f918..9a339484 100644 --- a/libc/stdio/fresetfile.cpp +++ b/libc/stdio/fresetfile.cpp @@ -38,7 +38,7 @@ extern "C" void fresetfile(FILE* fp) int kept_flags = fp->flags & (_FILE_REGISTERED | 0); memset(fp, 0, sizeof(*fp)); fp->file_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; - fp->flags = kept_flags | _FILE_AUTO_LOCK; + fp->flags = kept_flags; fp->buffer_mode = -1; fp->free_user = free_user; fp->free_func = free_func; diff --git a/libc/stdio/fsetlocking.cpp b/libc/stdio/fsetlocking.cpp deleted file mode 100644 index f29bea95..00000000 --- a/libc/stdio/fsetlocking.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - - Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013. - - This file is part of the Sortix C Library. - - The Sortix C Library is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - The Sortix C Library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with the Sortix C Library. If not, see . - - stdio/fsetlocking.cpp - Sets the desired locking semantics on a FILE. - -*******************************************************************************/ - -#include - -extern "C" int fsetlocking(FILE* fp, int type) -{ - flockfile(fp); - int ret = fsetlocking_unlocked(fp, type); - funlockfile(fp); - return ret; -} diff --git a/libc/stdio/fsetlocking_unlocked.cpp b/libc/stdio/fsetlocking_unlocked.cpp deleted file mode 100644 index 75e5074d..00000000 --- a/libc/stdio/fsetlocking_unlocked.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - - Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2013. - - This file is part of the Sortix C Library. - - The Sortix C Library is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - The Sortix C Library is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with the Sortix C Library. If not, see . - - stdio/fsetlocking_unlocked.cpp - Sets the desired locking semantics on a FILE. - -*******************************************************************************/ - -#include - -// TODO: What is this? This looks like something I ought to support! -extern "C" int fsetlocking_unlocked(FILE* fp, int type) -{ - switch ( type ) - { - case FSETLOCKING_INTERNAL: fp->flags |= _FILE_AUTO_LOCK; - case FSETLOCKING_BYCALLER: fp->flags &= ~_FILE_AUTO_LOCK; - } - return (fp->flags & _FILE_AUTO_LOCK) ? FSETLOCKING_INTERNAL - : FSETLOCKING_BYCALLER; -}