1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- Moved the data declarations out of math_data.c, stat_data.c,

socket_data.c, dirent_data.c and stdio_data.c and into the
  code that initializes them.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14868 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-03-09 10:48:59 +00:00
parent 0fad53e56e
commit cc8a8e42c0
15 changed files with 147 additions and 346 deletions

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.68k,v 1.37 2005-03-07 16:56:35 obarthel Exp $
# $Id: GNUmakefile.68k,v 1.38 2005-03-09 10:48:58 obarthel Exp $
#
# :ts=8
#
@ -139,7 +139,6 @@ C_LIB = \
ctype_tolower.o \
ctype_toupper.o \
dirent_closedir.o \
dirent_data.o \
dirent_opendir.o \
dirent_readdir.o \
dirent_rewinddir.o \
@ -177,7 +176,6 @@ C_LIB = \
signal_sigsetmask.o \
stat_chmod.o \
stat_convertfileinfo.o \
stat_data.o \
stat_fchmod.o \
stat_fstat.o \
stat_lstat.o \
@ -187,7 +185,6 @@ C_LIB = \
stat_umask.o \
stdio_asprintf.o \
stdio_clearerr.o \
stdio_data.o \
stdio_dropiobreadbuffer.o \
stdio_duplicate_fd.o \
stdio_examine_fh.o \
@ -444,7 +441,6 @@ C_LIB = \
UNIX_LIB = \
unix.lib_rev.o \
dirent_closedir.o \
dirent_data.o \
dirent_rewinddir.o \
dirent_opendir.o \
dirent_readdir.o \
@ -504,7 +500,6 @@ MATH_LIB = \
math_ceil.o \
math_cos.o \
math_cosh.o \
math_data.o \
math_exp.o \
math_fabs.o \
math_floor.o \
@ -599,7 +594,6 @@ NET_LIB = \
socket_accept.o \
socket_bind.o \
socket_connect.o \
socket_data.o \
socket_gethostbyaddr.o \
socket_gethostbyname.o \
socket_gethostid.o \

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.os4,v 1.36 2005-03-07 11:16:43 obarthel Exp $
# $Id: GNUmakefile.os4,v 1.37 2005-03-09 10:48:58 obarthel Exp $
#
# :ts=8
#
@ -138,7 +138,6 @@ C_LIB = \
ctype_tolower.o \
ctype_toupper.o \
dirent_closedir.o \
dirent_data.o \
dirent_opendir.o \
dirent_readdir.o \
dirent_rewinddir.o \
@ -176,7 +175,6 @@ C_LIB = \
signal_sigsetmask.o \
stat_chmod.o \
stat_convertfileinfo.o \
stat_data.o \
stat_fchmod.o \
stat_fstat.o \
stat_lstat.o \
@ -186,7 +184,6 @@ C_LIB = \
stat_umask.o \
stdio_asprintf.o \
stdio_clearerr.o \
stdio_data.o \
stdio_dropiobreadbuffer.o \
stdio_duplicate_fd.o \
stdio_examine_fh.o \
@ -444,7 +441,6 @@ C_LIB = \
UNIX_LIB = \
unix.lib_rev.o \
dirent_closedir.o \
dirent_data.o \
dirent_rewinddir.o \
dirent_opendir.o \
dirent_readdir.o \
@ -505,7 +501,6 @@ MATH_LIB = \
math_ceil.o \
math_cos.o \
math_cosh.o \
math_data.o \
math_exp.o \
math_fabs.o \
math_floor.o \
@ -561,7 +556,6 @@ NET_LIB = \
socket_accept.o \
socket_bind.o \
socket_connect.o \
socket_data.o \
socket_gethostbyaddr.o \
socket_gethostbyname.o \
socket_gethostid.o \

View File

@ -33,6 +33,10 @@
- Moved the CPU/FPU type tests into the respective linker
libraries.
- Moved the data declarations out of math_data.c, stat_data.c,
socket_data.c, dirent_data.c and stdio_data.c and into the
code that initializes them.
c.lib 1.189 (5.3.2005)

View File

@ -1,5 +1,5 @@
/*
* $Id: dirent_closedir.c,v 1.7 2005-02-27 21:58:21 obarthel Exp $
* $Id: dirent_closedir.c,v 1.8 2005-03-09 10:48:59 obarthel Exp $
*
* :ts=4
*
@ -47,6 +47,93 @@
/****************************************************************************/
/* Directories being scanned whose locks need to be freed when shutting down. */
struct MinList NOCOMMON __directory_list;
/****************************************************************************/
#if defined(__THREAD_SAFE)
/****************************************************************************/
static struct SignalSemaphore * dirent_lock;
/****************************************************************************/
void
__dirent_lock(void)
{
if(dirent_lock != NULL)
ObtainSemaphore(dirent_lock);
}
/****************************************************************************/
void
__dirent_unlock(void)
{
if(dirent_lock != NULL)
ReleaseSemaphore(dirent_lock);
}
/****************************************************************************/
#endif /* __THREAD_SAFE */
/****************************************************************************/
CLIB_CONSTRUCTOR(__dirent_init)
{
BOOL success = FALSE;
ENTER();
NewList((struct List *)&__directory_list);
#if defined(__THREAD_SAFE)
{
dirent_lock = __create_semaphore();
if(dirent_lock == NULL)
goto out;
}
#endif /* __THREAD_SAFE */
success = TRUE;
out:
RETURN(success);
if(success)
CONSTRUCTOR_SUCCEED();
else
CONSTRUCTOR_FAIL();
}
/****************************************************************************/
CLIB_DESTRUCTOR(__dirent_exit)
{
ENTER();
if(__directory_list.mlh_Head != NULL)
{
while(NOT IsListEmpty((struct List *)&__directory_list))
closedir((DIR *)__directory_list.mlh_Head);
}
#if defined(__THREAD_SAFE)
{
__delete_semaphore(dirent_lock);
dirent_lock = NULL;
}
#endif /* __THREAD_SAFE */
LEAVE();
}
/****************************************************************************/
int
closedir(DIR * directory_pointer)
{

View File

@ -1,123 +0,0 @@
/*
* $Id: dirent_data.c,v 1.8 2005-03-03 14:20:55 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* 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 _DIRENT_HEADERS_H
#include "dirent_headers.h"
#endif /* _DIRENT_HEADERS_H */
/****************************************************************************/
/* Directories being scanned whose locks need to be freed when shutting down. */
struct MinList NOCOMMON __directory_list;
/****************************************************************************/
#if defined(__THREAD_SAFE)
/****************************************************************************/
static struct SignalSemaphore * dirent_lock;
/****************************************************************************/
void
__dirent_lock(void)
{
if(dirent_lock != NULL)
ObtainSemaphore(dirent_lock);
}
/****************************************************************************/
void
__dirent_unlock(void)
{
if(dirent_lock != NULL)
ReleaseSemaphore(dirent_lock);
}
/****************************************************************************/
#endif /* __THREAD_SAFE */
/****************************************************************************/
CLIB_CONSTRUCTOR(__dirent_init)
{
BOOL success = FALSE;
ENTER();
NewList((struct List *)&__directory_list);
#if defined(__THREAD_SAFE)
{
dirent_lock = __create_semaphore();
if(dirent_lock == NULL)
goto out;
}
#endif /* __THREAD_SAFE */
success = TRUE;
out:
RETURN(success);
if(success)
CONSTRUCTOR_SUCCEED();
else
CONSTRUCTOR_FAIL();
}
/****************************************************************************/
CLIB_DESTRUCTOR(__dirent_exit)
{
ENTER();
if(__directory_list.mlh_Head != NULL)
{
while(NOT IsListEmpty((struct List *)&__directory_list))
closedir((DIR *)__directory_list.mlh_Head);
}
#if defined(__THREAD_SAFE)
{
__delete_semaphore(dirent_lock);
dirent_lock = NULL;
}
#endif /* __THREAD_SAFE */
LEAVE();
}

View File

@ -1,50 +0,0 @@
/*
* $Id: math_data.c,v 1.4 2005-02-03 16:56:15 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* 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 _MATH_HEADERS_H
#include "math_headers.h"
#endif /* _MATH_HEADERS_H */
/****************************************************************************/
#if defined(IEEE_FLOATING_POINT_SUPPORT)
struct Library * MathIeeeSingBasBase;
struct Library * MathIeeeDoubBasBase;
struct Library * MathIeeeDoubTransBase;
#endif /* IEEE_FLOATING_POINT_SUPPORT */
/****************************************************************************/
double __huge_val;

View File

@ -1,5 +1,5 @@
/*
* $Id: math_init_exit.c,v 1.9 2005-03-07 16:56:36 obarthel Exp $
* $Id: math_init_exit.c,v 1.10 2005-03-09 10:48:59 obarthel Exp $
*
* :ts=4
*
@ -57,6 +57,20 @@
/****************************************************************************/
#if defined(IEEE_FLOATING_POINT_SUPPORT)
struct Library * MathIeeeSingBasBase;
struct Library * MathIeeeDoubBasBase;
struct Library * MathIeeeDoubTransBase;
#endif /* IEEE_FLOATING_POINT_SUPPORT */
/****************************************************************************/
double __huge_val;
/****************************************************************************/
CLIB_DESTRUCTOR(__math_exit)
{
ENTER();

View File

@ -1,5 +1,5 @@
#
# $Id: smakefile,v 1.29 2005-03-07 11:16:43 obarthel Exp $
# $Id: smakefile,v 1.30 2005-03-09 10:48:59 obarthel Exp $
#
# :ts=8
#
@ -149,7 +149,6 @@ DEBUG_OBJ = \
DIRENT_OBJ = \
dirent_closedir.o \
dirent_data.o \
dirent_opendir.o \
dirent_readdir.o \
dirent_rewinddir.o
@ -186,7 +185,6 @@ MATH_OBJ = \
math_ceil.o \
math_cos.o \
math_cosh.o \
math_data.o \
math_exp.o \
math_fabs.o \
math_floor.o \
@ -233,7 +231,6 @@ SOCKET_OBJ = \
socket_accept.o \
socket_bind.o \
socket_connect.o \
socket_data.o \
socket_gethostbyaddr.o \
socket_gethostbyname.o \
socket_gethostid.o \
@ -275,7 +272,6 @@ SOCKET_OBJ = \
STAT_OBJ = \
stat_chmod.o \
stat_convertfileinfo.o \
stat_data.o \
stat_fchmod.o \
stat_fstat.o \
stat_lstat.o \
@ -287,7 +283,6 @@ STAT_OBJ = \
STDIO_OBJ = \
stdio_asprintf.o \
stdio_clearerr.o \
stdio_data.o \
stdio_dropiobreadbuffer.o \
stdio_duplicate_fd.o \
stdio_examine_fh.o \

View File

@ -1,58 +0,0 @@
/*
* $Id: socket_data.c,v 1.4 2005-01-02 09:07:08 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* 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.
*/
#if defined(SOCKET_SUPPORT)
/****************************************************************************/
#ifndef _SOCKET_HEADERS_H
#include "socket_headers.h"
#endif /* _SOCKET_HEADERS_H */
/****************************************************************************/
struct Library * __SocketBase;
/****************************************************************************/
#if defined(__amigaos4__)
struct SocketIFace *__ISocket;
#endif /* __amigaos4__ */
/****************************************************************************/
int h_errno;
/****************************************************************************/
#endif /* SOCKET_SUPPORT */

View File

@ -1,5 +1,5 @@
/*
* $Id: socket_init_exit.c,v 1.13 2005-03-05 17:55:26 obarthel Exp $
* $Id: socket_init_exit.c,v 1.14 2005-03-09 10:48:59 obarthel Exp $
*
* :ts=4
*
@ -78,6 +78,20 @@ struct DaemonMessage
/****************************************************************************/
struct Library * __SocketBase;
/****************************************************************************/
#if defined(__amigaos4__)
struct SocketIFace *__ISocket;
#endif /* __amigaos4__ */
/****************************************************************************/
int h_errno;
/****************************************************************************/
CLIB_DESTRUCTOR(__socket_exit)
{
ENTER();

View File

@ -1,40 +0,0 @@
/*
* $Id: stat_data.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* 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 _STAT_HEADERS_H
#include "stat_headers.h"
#endif /* _STAT_HEADERS_H */
/****************************************************************************/
mode_t __current_umask = S_IWGRP | S_IWOTH;

View File

@ -1,5 +1,5 @@
/*
* $Id: stat_umask.c,v 1.3 2005-01-02 09:07:08 obarthel Exp $
* $Id: stat_umask.c,v 1.4 2005-03-09 10:48:59 obarthel Exp $
*
* :ts=4
*
@ -51,6 +51,10 @@
/****************************************************************************/
mode_t __current_umask = S_IWGRP | S_IWOTH;
/****************************************************************************/
mode_t
umask(mode_t new_mask)
{
@ -66,7 +70,9 @@ umask(mode_t new_mask)
result = __getumask();
PROFILE_ON();
__umask(new_mask & (S_IRWXU | S_IRWXG | S_IRWXO));
__current_umask = new_mask & (S_IRWXU | S_IRWXG | S_IRWXO);
__umask(__current_umask);
RETURN(result);
return(result);

View File

@ -1,48 +0,0 @@
/*
* $Id: stdio_data.c,v 1.2 2005-01-02 09:07:08 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
* 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 _STDIO_HEADERS_H
#include "stdio_headers.h"
#endif /* _STDIO_HEADERS_H */
/****************************************************************************/
/* The file handle table. */
struct iob ** __iob;
int __num_iob;
/****************************************************************************/
/* The file descriptor table. */
struct fd ** __fd;
int __num_fd;

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_growfdtable.c,v 1.4 2005-03-04 09:07:09 obarthel Exp $
* $Id: stdio_growfdtable.c,v 1.5 2005-03-09 10:48:59 obarthel Exp $
*
* :ts=4
*
@ -43,6 +43,12 @@
/****************************************************************************/
/* The file descriptor table. */
struct fd ** __fd;
int __num_fd;
/****************************************************************************/
int
__grow_fd_table(int max_fd)
{

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_growiobtable.c,v 1.4 2005-03-04 09:07:09 obarthel Exp $
* $Id: stdio_growiobtable.c,v 1.5 2005-03-09 10:48:59 obarthel Exp $
*
* :ts=4
*
@ -43,6 +43,12 @@
/****************************************************************************/
/* The file handle table. */
struct iob ** __iob;
int __num_iob;
/****************************************************************************/
int
__grow_iob_table(int max_iob)
{