From 51f1dacdfa30025a17f819b559b6120b6d5665e6 Mon Sep 17 00:00:00 2001 From: Olaf Barthel Date: Wed, 25 Aug 2004 15:27:28 +0000 Subject: [PATCH] c.lib 1.173 (25.8.2004) - The header file was missing the C++ 'extern "C" { .. }' declarations. - Added a new function __get_default_file() which allows direct access to the low level file handle/socket descriptor associated with a file descriptor. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14716 87f5fb63-7c3d-0410-a384-fd976d0f7a62 --- library/GNUmakefile.68k | 4 +- library/GNUmakefile.os4 | 4 +- library/amiga.lib_rev.h | 10 ++--- library/amiga.lib_rev.rev | 2 +- library/c.lib_rev.h | 10 ++--- library/c.lib_rev.rev | 2 +- library/changes | 10 +++++ library/debug.lib_rev.h | 10 ++--- library/debug.lib_rev.rev | 2 +- library/fcntl_get_default_file.c | 69 ++++++++++++++++++++++++++++++++ library/include/assert.h | 14 ++++++- library/include/dos.h | 14 ++++++- library/include/stdio.h | 4 +- library/m.lib_rev.h | 10 ++--- library/m.lib_rev.rev | 2 +- library/m881.lib_rev.h | 10 ++--- library/m881.lib_rev.rev | 2 +- library/net.lib_rev.h | 10 ++--- library/net.lib_rev.rev | 2 +- library/releasenotes | 20 +++------ library/smakefile | 5 ++- library/stack.lib_rev.h | 10 ++--- library/stack.lib_rev.rev | 2 +- library/unix.lib_rev.h | 10 ++--- library/unix.lib_rev.rev | 2 +- 25 files changed, 170 insertions(+), 70 deletions(-) create mode 100644 library/fcntl_get_default_file.c diff --git a/library/GNUmakefile.68k b/library/GNUmakefile.68k index 6e5843c..ebab325 100644 --- a/library/GNUmakefile.68k +++ b/library/GNUmakefile.68k @@ -1,5 +1,5 @@ # -# $Id: GNUmakefile.68k,v 1.7 2004-08-23 13:47:32 obarthel Exp $ +# $Id: GNUmakefile.68k,v 1.8 2004-08-25 15:27:27 obarthel Exp $ # # :ts=8 # @@ -144,6 +144,7 @@ C_LIB = \ fcntl_open.o \ fcntl_read.o \ fcntl_write.o \ + fcntl_get_default_file.o \ libgen_basename.o \ libgen_dirname.o \ locale_data.o \ @@ -395,6 +396,7 @@ UNIX_LIB = \ fcntl_creat.o \ fcntl_fcntl.o \ fcntl_open.o \ + fcntl_get_default_file.o \ mount_convertinfo.o \ mount_statfs.o \ stat_chmod.o \ diff --git a/library/GNUmakefile.os4 b/library/GNUmakefile.os4 index 1e892de..45bd26a 100644 --- a/library/GNUmakefile.os4 +++ b/library/GNUmakefile.os4 @@ -1,5 +1,5 @@ # -# $Id: GNUmakefile.os4,v 1.5 2004-08-16 09:33:11 obarthel Exp $ +# $Id: GNUmakefile.os4,v 1.6 2004-08-25 15:27:27 obarthel Exp $ # # :ts=8 # @@ -138,6 +138,7 @@ C_LIB = \ fcntl_open.o \ fcntl_read.o \ fcntl_write.o \ + fcntl_get_default_file.o \ libgen_basename.o \ libgen_dirname.o \ locale_data.o \ @@ -387,6 +388,7 @@ UNIX_LIB = \ fcntl_creat.o \ fcntl_fcntl.o \ fcntl_open.o \ + fcntl_get_default_file.o \ mount_convertinfo.o \ mount_statfs.o \ stat_chmod.o \ diff --git a/library/amiga.lib_rev.h b/library/amiga.lib_rev.h index 3e7f384..d95999d 100644 --- a/library/amiga.lib_rev.h +++ b/library/amiga.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 172 -#define DATE "21.8.2004" -#define VERS "amiga.lib 1.172" -#define VSTRING "amiga.lib 1.172 (21.8.2004)\r\n" -#define VERSTAG "\0$VER: amiga.lib 1.172 (21.8.2004)" +#define REVISION 173 +#define DATE "25.8.2004" +#define VERS "amiga.lib 1.173" +#define VSTRING "amiga.lib 1.173 (25.8.2004)\r\n" +#define VERSTAG "\0$VER: amiga.lib 1.173 (25.8.2004)" diff --git a/library/amiga.lib_rev.rev b/library/amiga.lib_rev.rev index 730a054..c4597e5 100644 --- a/library/amiga.lib_rev.rev +++ b/library/amiga.lib_rev.rev @@ -1 +1 @@ -172 +173 diff --git a/library/c.lib_rev.h b/library/c.lib_rev.h index 8fcf3e9..89679b0 100644 --- a/library/c.lib_rev.h +++ b/library/c.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 172 -#define DATE "21.8.2004" -#define VERS "c.lib 1.172" -#define VSTRING "c.lib 1.172 (21.8.2004)\r\n" -#define VERSTAG "\0$VER: c.lib 1.172 (21.8.2004)" +#define REVISION 173 +#define DATE "25.8.2004" +#define VERS "c.lib 1.173" +#define VSTRING "c.lib 1.173 (25.8.2004)\r\n" +#define VERSTAG "\0$VER: c.lib 1.173 (25.8.2004)" diff --git a/library/c.lib_rev.rev b/library/c.lib_rev.rev index 730a054..c4597e5 100644 --- a/library/c.lib_rev.rev +++ b/library/c.lib_rev.rev @@ -1 +1 @@ -172 +173 diff --git a/library/changes b/library/changes index 015530b..8157507 100644 --- a/library/changes +++ b/library/changes @@ -1,3 +1,13 @@ +c.lib 1.173 (25.8.2004) + +- The header file was missing the C++ 'extern "C" { .. }' + declarations. + +- Added a new function __get_default_file() which allows direct access + to the low level file handle/socket descriptor associated with a + file descriptor. + + c.lib 1.172 (21.8.2004) - acos() now returns 0 for a domain error. diff --git a/library/debug.lib_rev.h b/library/debug.lib_rev.h index 9a59ea3..57ab992 100644 --- a/library/debug.lib_rev.h +++ b/library/debug.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 172 -#define DATE "21.8.2004" -#define VERS "debug.lib 1.172" -#define VSTRING "debug.lib 1.172 (21.8.2004)\r\n" -#define VERSTAG "\0$VER: debug.lib 1.172 (21.8.2004)" +#define REVISION 173 +#define DATE "25.8.2004" +#define VERS "debug.lib 1.173" +#define VSTRING "debug.lib 1.173 (25.8.2004)\r\n" +#define VERSTAG "\0$VER: debug.lib 1.173 (25.8.2004)" diff --git a/library/debug.lib_rev.rev b/library/debug.lib_rev.rev index 730a054..c4597e5 100644 --- a/library/debug.lib_rev.rev +++ b/library/debug.lib_rev.rev @@ -1 +1 @@ -172 +173 diff --git a/library/fcntl_get_default_file.c b/library/fcntl_get_default_file.c new file mode 100644 index 0000000..65e8758 --- /dev/null +++ b/library/fcntl_get_default_file.c @@ -0,0 +1,69 @@ +/* + * $Id: fcntl_get_default_file.c,v 1.1 2004-08-25 15:27:27 obarthel Exp $ + * + * :ts=4 + * + * Portable ISO 'C' (1994) runtime library for the Amiga computer + * Copyright (c) 2002-2004 by Olaf Barthel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Neither the name of Olaf Barthel nor the names of contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _FCNTL_HEADERS_H +#include "fcntl_headers.h" +#endif /* _FCNTL_HEADERS_H */ + +/****************************************************************************/ + +/* The following is not part of the ISO 'C' (1994) standard. */ + +/****************************************************************************/ + +int +__get_default_file(int file_descriptor,long * file_ptr) +{ + struct fd * fd; + int result = -1; + + assert( file_descriptor >= 0 && file_descriptor < __num_fd ); + assert( __fd[file_descriptor] != NULL ); + assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) ); + assert( file_ptr != NULL ); + + fd = __get_file_descriptor(file_descriptor); + if(fd == NULL) + { + errno = EBADF; + goto out; + } + + (*file_ptr) = (long)fd->fd_DefaultFile; + + result = 0; + + out: + + return(result); +} diff --git a/library/include/assert.h b/library/include/assert.h index 56c372c..173267c 100644 --- a/library/include/assert.h +++ b/library/include/assert.h @@ -1,5 +1,5 @@ /* - * $Id: assert.h,v 1.1.1.1 2004-07-26 16:32:49 obarthel Exp $ + * $Id: assert.h,v 1.2 2004-08-25 15:27:28 obarthel Exp $ * * :ts=4 * @@ -36,6 +36,12 @@ /****************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/****************************************************************************/ + #ifndef assert /****************************************************************************/ @@ -67,4 +73,10 @@ extern void __assertion_failure(const char *file_name,int line_number,const char /****************************************************************************/ +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/****************************************************************************/ + #endif /* _ASSERT_H */ diff --git a/library/include/dos.h b/library/include/dos.h index 2629c32..35197c8 100644 --- a/library/include/dos.h +++ b/library/include/dos.h @@ -1,5 +1,5 @@ /* - * $Id: dos.h,v 1.2 2004-08-07 09:15:33 obarthel Exp $ + * $Id: dos.h,v 1.3 2004-08-25 15:27:28 obarthel Exp $ * * :ts=4 * @@ -112,6 +112,18 @@ extern void __set_a4(unsigned long value); /****************************************************************************/ +/* + * Obtain the low level 'file' handle or socket ID bound to a file + * descriptor. This function returns 0 for success and non-zero + * otherwise (if, for example, the file descriptor value you + * provided is not valid; errno will be set to the appropriate + * error code, too). Put a pointer to the file handle variable you + * want to be filled in into the second parameter to this function. + */ +extern int __get_default_file(int file_descriptor,long * file_ptr); + +/****************************************************************************/ + /* * This will be set to TRUE if the current program was launched from * the internet superserver ('inetd') or an equivalent facility. diff --git a/library/include/stdio.h b/library/include/stdio.h index 7b40ec8..f7de983 100644 --- a/library/include/stdio.h +++ b/library/include/stdio.h @@ -1,5 +1,5 @@ /* - * $Id: stdio.h,v 1.2 2004-08-07 09:15:33 obarthel Exp $ + * $Id: stdio.h,v 1.3 2004-08-25 15:27:28 obarthel Exp $ * * :ts=4 * @@ -62,7 +62,7 @@ extern "C" { * correspond to a real limitation for this 'C' runtime library and is * included solely for ISO 'C' (1994) compliance. */ -#define FOPEN_MAX 8 +#define FOPEN_MAX 64 /****************************************************************************/ diff --git a/library/m.lib_rev.h b/library/m.lib_rev.h index 62d39e9..3fdd4f7 100644 --- a/library/m.lib_rev.h +++ b/library/m.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 172 -#define DATE "21.8.2004" -#define VERS "m.lib 1.172" -#define VSTRING "m.lib 1.172 (21.8.2004)\r\n" -#define VERSTAG "\0$VER: m.lib 1.172 (21.8.2004)" +#define REVISION 173 +#define DATE "25.8.2004" +#define VERS "m.lib 1.173" +#define VSTRING "m.lib 1.173 (25.8.2004)\r\n" +#define VERSTAG "\0$VER: m.lib 1.173 (25.8.2004)" diff --git a/library/m.lib_rev.rev b/library/m.lib_rev.rev index 730a054..c4597e5 100644 --- a/library/m.lib_rev.rev +++ b/library/m.lib_rev.rev @@ -1 +1 @@ -172 +173 diff --git a/library/m881.lib_rev.h b/library/m881.lib_rev.h index dd44538..48a1c0d 100644 --- a/library/m881.lib_rev.h +++ b/library/m881.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 172 -#define DATE "21.8.2004" -#define VERS "m881.lib 1.172" -#define VSTRING "m881.lib 1.172 (21.8.2004)\r\n" -#define VERSTAG "\0$VER: m881.lib 1.172 (21.8.2004)" +#define REVISION 173 +#define DATE "25.8.2004" +#define VERS "m881.lib 1.173" +#define VSTRING "m881.lib 1.173 (25.8.2004)\r\n" +#define VERSTAG "\0$VER: m881.lib 1.173 (25.8.2004)" diff --git a/library/m881.lib_rev.rev b/library/m881.lib_rev.rev index 730a054..c4597e5 100644 --- a/library/m881.lib_rev.rev +++ b/library/m881.lib_rev.rev @@ -1 +1 @@ -172 +173 diff --git a/library/net.lib_rev.h b/library/net.lib_rev.h index 4eec714..838f711 100644 --- a/library/net.lib_rev.h +++ b/library/net.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 172 -#define DATE "21.8.2004" -#define VERS "net.lib 1.172" -#define VSTRING "net.lib 1.172 (21.8.2004)\r\n" -#define VERSTAG "\0$VER: net.lib 1.172 (21.8.2004)" +#define REVISION 173 +#define DATE "25.8.2004" +#define VERS "net.lib 1.173" +#define VSTRING "net.lib 1.173 (25.8.2004)\r\n" +#define VERSTAG "\0$VER: net.lib 1.173 (25.8.2004)" diff --git a/library/net.lib_rev.rev b/library/net.lib_rev.rev index 730a054..c4597e5 100644 --- a/library/net.lib_rev.rev +++ b/library/net.lib_rev.rev @@ -1 +1 @@ -172 +173 diff --git a/library/releasenotes b/library/releasenotes index 9248488..9e9e643 100644 --- a/library/releasenotes +++ b/library/releasenotes @@ -1,15 +1,7 @@ -c.lib 1.172 (21.8.2004) +c.lib 1.173 (25.8.2004) -- Changed the values which the acos(), asin(), atan2(), fmod() - and sqrt() functions return when they find that their parameters - are invalid. - -- The atan2() function failed to perform a correct parameter check. - - -c.lib 1.171 (16.8.2004) - -- Added hypot() - -- vfprintf/vfscanf now support the %lld/%llu (64 bit integer) format - by default +- You can now retrieve the low level file handle or socket descriptor + that is associated with a file descriptor, as used by this runtime + library. The new function is called "__get_default_file()", and the + function prototype and documentation can be found in the + header file. diff --git a/library/smakefile b/library/smakefile index d9034bc..d610aa8 100644 --- a/library/smakefile +++ b/library/smakefile @@ -1,5 +1,5 @@ # -# $Id: smakefile,v 1.6 2004-08-16 09:33:12 obarthel Exp $ +# $Id: smakefile,v 1.7 2004-08-25 15:27:27 obarthel Exp $ # # :ts=8 # @@ -163,7 +163,8 @@ FCNTL_OBJ = \ fcntl_lseek.o \ fcntl_open.o \ fcntl_read.o \ - fcntl_write.o + fcntl_write.o \ + fcntl_get_default_file.o LIBGEN_OBJ = \ libgen_basename.o \ diff --git a/library/stack.lib_rev.h b/library/stack.lib_rev.h index c14d349..e45abe6 100644 --- a/library/stack.lib_rev.h +++ b/library/stack.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 172 -#define DATE "21.8.2004" -#define VERS "stack.lib 1.172" -#define VSTRING "stack.lib 1.172 (21.8.2004)\r\n" -#define VERSTAG "\0$VER: stack.lib 1.172 (21.8.2004)" +#define REVISION 173 +#define DATE "25.8.2004" +#define VERS "stack.lib 1.173" +#define VSTRING "stack.lib 1.173 (25.8.2004)\r\n" +#define VERSTAG "\0$VER: stack.lib 1.173 (25.8.2004)" diff --git a/library/stack.lib_rev.rev b/library/stack.lib_rev.rev index 730a054..c4597e5 100644 --- a/library/stack.lib_rev.rev +++ b/library/stack.lib_rev.rev @@ -1 +1 @@ -172 +173 diff --git a/library/unix.lib_rev.h b/library/unix.lib_rev.h index bef4051..33c9149 100644 --- a/library/unix.lib_rev.h +++ b/library/unix.lib_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 172 -#define DATE "21.8.2004" -#define VERS "unix.lib 1.172" -#define VSTRING "unix.lib 1.172 (21.8.2004)\r\n" -#define VERSTAG "\0$VER: unix.lib 1.172 (21.8.2004)" +#define REVISION 173 +#define DATE "25.8.2004" +#define VERS "unix.lib 1.173" +#define VSTRING "unix.lib 1.173 (25.8.2004)\r\n" +#define VERSTAG "\0$VER: unix.lib 1.173 (25.8.2004)" diff --git a/library/unix.lib_rev.rev b/library/unix.lib_rev.rev index 730a054..c4597e5 100644 --- a/library/unix.lib_rev.rev +++ b/library/unix.lib_rev.rev @@ -1 +1 @@ -172 +173