Remove __fsetlocking(3).

This commit is contained in:
Jonas 'Sortie' Termansen 2014-08-06 09:23:57 +02:00
parent 35708fa900
commit 3778dae725
7 changed files with 7 additions and 94 deletions

View File

@ -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 \

View File

@ -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

View File

@ -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. */

View File

@ -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 <stdio.h>
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

View File

@ -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;

View File

@ -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 <http://www.gnu.org/licenses/>.
stdio/fsetlocking.cpp
Sets the desired locking semantics on a FILE.
*******************************************************************************/
#include <stdio.h>
extern "C" int fsetlocking(FILE* fp, int type)
{
flockfile(fp);
int ret = fsetlocking_unlocked(fp, type);
funlockfile(fp);
return ret;
}

View File

@ -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 <http://www.gnu.org/licenses/>.
stdio/fsetlocking_unlocked.cpp
Sets the desired locking semantics on a FILE.
*******************************************************************************/
#include <stdio.h>
// 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;
}