mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
Compare commits
1 Commits
developmen
...
V1_203
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c1084a975 |
@@ -1,14 +0,0 @@
|
||||
---
|
||||
engines:
|
||||
duplication:
|
||||
enabled: false
|
||||
fixme:
|
||||
enabled: true
|
||||
markdownlint:
|
||||
enabled: true
|
||||
ratings:
|
||||
paths:
|
||||
- "**.c"
|
||||
- "**.h"
|
||||
- "**.l"
|
||||
- "**.md"
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,5 +0,0 @@
|
||||
*.o
|
||||
*.a
|
||||
/library/compiler.log
|
||||
/library/netinclude
|
||||
*.map
|
||||
36
.travis.yml
36
.travis.yml
@@ -1,36 +0,0 @@
|
||||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
language: c
|
||||
|
||||
# download and install our required cross compilers
|
||||
install:
|
||||
# Make sure we can install i386 packages as some adtools binaries
|
||||
# requires i386 libraries being installed to work in the 64bit env
|
||||
# of Travis
|
||||
- sudo dpkg --add-architecture i386
|
||||
- sudo apt-get -qq update || true
|
||||
- sudo apt-get -qq install libc6:i386
|
||||
# Install all adtools related stuff we need
|
||||
- curl -L https://dl.bintray.com/jens-maus/adtools/adtools-utils.tar.bz2 | sudo tar xj -C /
|
||||
- if [[ ${BUILD} =~ os3|release ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-m68k-amigaos.tar.bz2 | sudo tar xj -C / ; fi
|
||||
- if [[ ${BUILD} =~ os4|release ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-ppc-amigaos.tar.bz2 | sudo tar xj -C / ; fi
|
||||
- if [[ ${BUILD} =~ mos|release ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-ppc-morphos.tar.bz2 | sudo tar xj -C / ; fi
|
||||
- if [[ ${BUILD} =~ aros-ppc|release ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-ppc-aros.tar.bz2 | sudo tar xj -C / ; fi
|
||||
- if [[ ${BUILD} =~ aros-i386|release ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-i386-aros.tar.bz2 | sudo tar xj -C / ; fi
|
||||
- if [[ ${BUILD} =~ aros-x86_64|release ]]; then curl -L https://dl.bintray.com/jens-maus/adtools/adtools-x86_64-aros.tar.bz2 | sudo tar xj -C / ; fi
|
||||
- if [[ ${BUILD} =~ mingw32|release ]]; then sudo apt-get -qq install binutils-mingw-w64-i686 gcc-mingw-w64-i686 ; fi
|
||||
|
||||
# set the PATH variable to the directories the cross compilers are installed.
|
||||
before_script:
|
||||
- export PATH=/usr/local/amiga/bin:/opt/m68k-amigaos/bin:/opt/ppc-amigaos/bin:/opt/ppc-morphos/bin:${PATH}
|
||||
|
||||
# specify a list of variables to test (here we test the build for our supported
|
||||
# list of operating systems).
|
||||
env:
|
||||
- BUILD="-f GNUmakefile.68k OS=os3"
|
||||
- BUILD="-f GNUmakefile.os4 OS=os4"
|
||||
|
||||
# the build command to execute for each test
|
||||
script:
|
||||
- make -C library -j1 ${BUILD}
|
||||
29
LICENSE
29
LICENSE
@@ -1,29 +0,0 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2016, 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.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
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 HOLDER 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.
|
||||
297
README.md
297
README.md
@@ -1,297 +0,0 @@
|
||||
# clib2 – An ISO 'C' (1994) compliant runtime library for AmigaOS
|
||||
|
||||
[](https://travis-ci.org/adtools/clib2)
|
||||
[](https://codeclimate.com/github/adtools/clib2)
|
||||
[](https://opensource.org/licenses/BSD-3-Clause)
|
||||
[](https://github.com/adtools/clib2/issues)
|
||||
|
||||
## What is this?
|
||||
|
||||
This is my attempt to get Samba 2.2.x ported to the Amiga. My first Amiga port required *SAS/C* and a number of strange tricks had to be pulled to get it to support the kind of environment Samba needed. But with the introduction of Samba 2.2.x many of those tricks did not work any more, which is why I decided to attack the problem at the root, namely the runtime library.
|
||||
|
||||
Because it was no longer possible to build Samba with *SAS/C* on the new Amiga platform, the idea came up to move development to the GNU 'C' compiler. This turned out to be a challenge due to its somewhat underdeveloped runtime library and header files. Eventually, I decided to rewrite that library from scratch.
|
||||
|
||||
|
||||
## What does it do?
|
||||
|
||||
Using *'C' - A reference manual* (4th edition) as a reference I wrote a set of header files, then proceeded to implement each single function referenced in them. With few exceptions in the area of wide character support, the result should be a feature complete implementation of the ISO 'C' (1994) runtime library. The library was subsequently updated to offer functionality defined in *ISO/IEC 9899:1999*, also known as *C99*.
|
||||
|
||||
Because Samba needs a few POSIX-like routines to be supported, the library functionality is complemented by a set of routines described in *Advanced programming in the Unix environment*.
|
||||
|
||||
This is not a portable implementation of the library in the sense that you could move it from one 'C' compiler on one operating system to another. This is an Amiga specific implementation.
|
||||
|
||||
The library supports floating point math, which, for the 68k platform, is limited to IEEE single and double precision or M68881 inline math. There is no support for the fast floating point (FFP) format or exclusive IEEE single precision. You either get double precision (IEEE math) or extended precision (M68881 inline math). What it is that you get is determined at compile time. Use the `IEEE_FLOATING_POINT_SUPPORT` preprocessor symbol to activate IEEE math code and the `M68881_FLOATING_POINT_SUPPORT` symbol for M68881 inline math.
|
||||
|
||||
For the PowerPC platform, the library uses code borrowed from <a href="http://www.netlib.org/fdlibm/">fdlibm 5.3</a>, which is a portable library of arithmetic functions developed by Sun Microsystems which, for example, is also used within the Java platform.
|
||||
|
||||
## What does it not do?
|
||||
|
||||
This library is a departure from the typical 'C' runtime environments of the past which had to run on all AmigaOS releases, down to *Kickstart 1.1*. This very library was designed to take advantage of the routines available since *Kickstart 2.04* was introduced and virtually nobody ever put to use. This helps to cut the code size, and it also helps to keep bugs out of the library by falling back onto well-tested implementations. However, the catch is that the code won't run under *Kickstart 1.3* and below. But then these operating system releases have been obsolete for more than a decade, and you can always go back to a compiler environment which supports them.
|
||||
|
||||
There is very little support for `amiga.lib` functionality. There is `NewList()`, `HookEntry()`, `CallHook()`, `CallHookA()`, the `DoMethod()` family, the *RexxVars* family, but that's all. If you need more, you would have to implement it yourself. Put another way, if you absolutely need functionality that is only found in `amiga.lib`, you really shouldn't need it in the first place.
|
||||
|
||||
|
||||
## Where does the source code come from?
|
||||
|
||||
I originally thought that it might be helpful to piece this library together from various sources, such as the BSD libc. It turned out that this code was so 'portable' that it became much more complex than it ought to be. Also, some side-effects were present which considerably changed the behaviour of the library. For example, the BSD libc uses `bcopy()` as an alias for `memcpy()`, and unlike `memcpy()` is documented to, `bcopy()` supports overlapping copies.
|
||||
|
||||
Eventually, I wrote virtually all the code myself, borrowing algorithmic ideas from the BSD libc and the *Manx Aztec 'C'* runtime library. Because I don't know much about the environment *GCC* expects, I borrowed code snippets from *libnix*, which was written by Matthias Fleischer and Gunther Nikl. This in particular concerns the integer and floating point math support, the `setjmp`/`longjmp` routines and the startup code. The M68881 inline math code comes from the `<math-68881.h>` file written by Matthew Self `(self [at] bayes.arc.nasa.gov)`.
|
||||
|
||||
|
||||
## Limitations and caveats
|
||||
|
||||
There is hardly any documentation on the code I wrote. In part this is due to the fact that the code itself is very simple in design. It should speak for itself. However, to make a usable runtime library you have to have a user documentation as in *man pages* or *AutoDocs*. We will eventually have to have *AutoDocs* for this library.
|
||||
|
||||
The exception handling in the math code is not particularly effective. For one part this is due to the fact that there is no exception handler installed by the runtime library when it starts up which could catch and process the error conditions the CPU or FPU generates. The idea was to provide for a portable runtime library with little to no assembly language involved. To make the exception handling complete, such code would be necessary.
|
||||
|
||||
The library currently builds under *SAS/C*, but because the 'normal' program startup code is not utilized, the base relative (A4) addressing does not work. If you are going to test it, use the `data=faronly` option to compile the library and the programs.
|
||||
|
||||
Different build *Makefiles* are supplied for use with *GCC*. There is a `GNUmakefile.68k` for the 68k platform and a `GNUmakefile.os4` for the AmigaOS4 PowerPC version.
|
||||
|
||||
### Floating point math and functions (`scanf()`, `printf()`, etc.)
|
||||
|
||||
The plain `libc.a`, which your software would be linked against by default, does not contain any floating point support code. This means, for example, that `printf("%f",...)` will not produce the desired output and that `scanf("%f",...)` may not read any data at all. If your program needs functions such as these or `atod()` then you must link against `libm.a` or the equivalent.
|
||||
|
||||
To link the floating point support code with your software, use the `-lm` compiler option.
|
||||
**Careful!** The order in which you specify the libraries to link against is important here. Thus, `gcc -o test test.c -lm -lc` would correctly link the program `test` against the proper floating point math library, but `gcc -o test test.c -lc -lm` would not.
|
||||
|
||||
### The thread-safe library
|
||||
|
||||
Thread-safety does not imply that you can have multiple callers access and close the same file. There is no resource tracking to that degree yet. All that the thread-safety tries to afford you is not to get into big trouble if simultaneous and overlapping accesses to files, memory allocation and other resources are taking place.
|
||||
|
||||
The library code is supposed to be thread-safe if built with the `__THREAD_SAFE` preprocessor symbol defined. Note that 'thread-safe' does **not** mean 'reentrant'. Multiple callers for certain library functions are permitted, but not for all of them. For example, `mkdtemp()` is not thread-safe, and neither is `rand()` or `localtime()`. But as per *POSIX 1003.1c-1995* there are thread-safe variants of `rand()` and `localtime()` called `rand_r()`, `localtime_r()`, and others.
|
||||
|
||||
The use of the socket I/O functions is problematic because the underlying `bsdsocket.library` API is not supposed to be used by any process other than the one which opened it. While one TCP/IP stack (my own "Roadshow") allows you to share the library base among different processes, if so configured, it is the exception. No other TCP/IP stack available for the Amiga robustly supports a similar feature. If the TCP/IP stack supports this feature, then the global variable `__can_share_socket_library_base` will be set to a non-zero value.
|
||||
|
||||
Errors reported by the socket I/O functions which modify the global variables `errno` and `h_errno` may be directed to call the `__set_errno()` and `__set_h_errno()` functions instead, if the TCP/IP stack supports this feature. The global variable `__thread_safe_errno_h_errno` will be set to a non-zero value if it does.
|
||||
|
||||
A much more serious problem resides with the `exit()`, `abort()`, `assert()` and `raise()` functions, and how the `SIGINT` signal is processed. In the thread-safe library only the `main()` function may directly or indirectly call the `exit()` function. No child process may do so, since this would wreck its stack context, crashing it instantly; the main program would be very likely to crash, too, because `exit()` will clean up after all memory allocations and files currently in use. Functions such as `abort()` and `raise()` may call the `exit()` function indirectly. And the `raise()` function may be invoked as part of the `Control+C` checking. You should make sure that the signal handling does not affect any child processes. This can be done by replacing the `__check_abort()` function or by disabling `SIGINT` processing altogether, such as through a `signal(SIGINT,SIG_IGN)` call.
|
||||
|
||||
Also take care with file I/O involving the `stdin`/`stdout`/`stderr` streams; read/write operations on these streams will be mapped to the `Input()`/`Output()`/`ErrorOutput()` file handles of the process performing these operations. Since only this small set of operations is mapped, functions such as `fcntl()` or `select()` will not work on the `stdin`/`stdout`/`stderr` streams and the corresponding file descriptors `STDIN_FILENO`/`STDOUT_FILENO`/`STDERR_FILENO`. It is therefore strongly recommended to use the thread-safe library only for applications which can cope with the limitations described above.
|
||||
|
||||
### Using gmon (PowerPC only)
|
||||
|
||||
To use profiling, two steps are required. First of all, your program must be compiled with the *GCC* command line option `-pg`. This instructs the compiler to generate special profiling code in the prologue and epilogue of each function. Additionally, the program must be linked against `libprofile.a`. To do this, either manually add `-lprofile` to the linker command line, or modify the specs file as follows. Find the lines that look like this (it may actually differ slightly from your specs file, but the important thing is that the line before the line to be modified reads `lib:`):
|
||||
|
||||
```
|
||||
lib:
|
||||
--start-group -lc --end-group
|
||||
```
|
||||
|
||||
You will have to modify this to look like this:
|
||||
|
||||
```
|
||||
lib:
|
||||
%{pg: -lprofile} --start-group -lc --end-group
|
||||
```
|
||||
|
||||
Normally, the `specs` file is located at the compiler's installation directory. For cross-compilers, this is `/usr/local/amiga/lib/gcc/ppc-amigaos/*compiler-version*/specs`. For a native compiler, it's in `gcc:lib/gcc/ppc-amigaos/*compiler-version*/specs`. Most likely, your compiler will already have this added to it's `specs` file.
|
||||
|
||||
Profiling makes use of a special PowerPC facility called the *Performance Monitor*. It allows to "mark" tasks and count only during while a marked task is running. This allows performance analysis to be made independent of the actual system load. The *Performance Monitor* is available on all PowerPC models supported by AmigaOS 4 except for the *603e*, and embedded versions of the PowerPC like the *405* and *440* series. Consult the manual of the appropriate chip for more information.
|
||||
|
||||
### Implementation defined behaviour
|
||||
|
||||
#### 'C' language
|
||||
|
||||
##### Environment
|
||||
|
||||
The `main(int argc,char **argv);` function may be called with an `argc` value of 0, in which case the `argv` variable will contain a pointer to the Amiga Workbench startup message, which is of type `struct WBStartup *`, and is defined in the Amiga system header file `<workbench/startup.h>`.
|
||||
|
||||
##### Characters
|
||||
|
||||
The current locale is derived from the current Amiga operating system locale settings. The `setlocale("")` function call will choose the current Amiga operating system locale settings. Any other name passed to the `setlocale()` function, with the exception of `"C"`, which selects the 'C' locale, must be a locale name, as used by the Amiga operating system function `OpenLocale()` in `locale.library`.
|
||||
|
||||
##### Floating-point
|
||||
|
||||
The 68k version of *clib2* supports single and double precision floating point numbers, according to the *IEEE 754* standard. The software floating point number support is built upon the Amiga operating system libraries `mathieeesingbas.library`, `mathieeedoubbas.library` and `mathieeedoubtrans.library`. The hardware floating point number support uses the M68881/M68882/M68040/M68060 floating point unit instead.
|
||||
|
||||
The PowerPC version of *clib2* supports only double precision floating point numbers, according to the *IEEE 754* standard, because that is exactly what the PowerPC CPU supports. Single precision numbers may be implicitly converted to double precision numbers. This also means that the *C99* data type `long double` is identical to the `double` data type. Because there is no difference between these two, the library omits support for *C99* functions specifically designed to operate on `long double` data types, such as `rintl()`.
|
||||
|
||||
Both the 68k and the PowerPC versions of *clib2* may call software floating point support routines in order to perform double and single precision operations that go beyond simple addition and multiplication, such as `sqrt()`. These functions come from Sun Microsystems <a href="http://www.netlib.org/fdlibm/">fdlibm 5.3</a> library.
|
||||
|
||||
Unless your software is linked against `libm.a` no floating point functions will be available to it, possibly causing a linker error. When using the GNU 'C' compiler, you will want to add the option `-lm -lc` to the linker command line.
|
||||
|
||||
The exception handling is currently entirely out of control of the developer and solely subject to the rules imposed by the operating system itself.
|
||||
|
||||
The `fmod()` function returns the value of the `x` parameter and sets `errno` to `EDOM` if the `y` parameter value is 0.
|
||||
|
||||
#### Library functions
|
||||
|
||||
##### `NULL`
|
||||
|
||||
The `NULL` pointer constant is defined in the `<stddef.h>` header and will expand to `((void *)0L)` if the 'C' compiler is used. For a C++ compiler the constant will expand to `0L` instead.
|
||||
|
||||
##### `assert()` diagnostic messages
|
||||
|
||||
The diagnostic messages printed by the `assert()` function take the following form:
|
||||
|
||||
> `[*program name*] *file*:*line*: failed assertion "*condition*".`
|
||||
|
||||
where:
|
||||
|
||||
Label | Meaning
|
||||
----- | -------
|
||||
program name | Optional program name; if the program name is not yet known, then the entire text enclosed in square brackets will be omitted.
|
||||
file | The value of the `__FILE__` symbol at the location of the `assert()` call.
|
||||
line | The value of the `__LINE__` symbol at the location of the `assert()` call.
|
||||
condition | The condition passed to the `assert()` function.
|
||||
|
||||
If available, the diagnostic messages will be sent to `stderr`.
|
||||
|
||||
If the program was launched from Workbench or if the global variable `__no_standard_io` is set to a non-zero value, then the assertion failure message will not be displayed in the shell window, but in a requester window. The diagnostic message shown in this window will take the following form:
|
||||
|
||||
> `Assertion of condition "*condition*" failed in file "*file*", line *line*.`
|
||||
|
||||
The name of the program, if it is know at that time, will be displayed in the requester window title.
|
||||
|
||||
##### Signal handling
|
||||
|
||||
Only the minimum of required signals are supported by this library. These are `SIGABRT`, `SIGFPE`, `SIGILL`, `SIGINT`, `SIGSEGV` and `SIGTERM`.
|
||||
|
||||
As of this writing `SIGFPE` is never called by the floating point library functions.
|
||||
|
||||
The `Ctrl+C` event is translated into `SIGINT`. Signal delivery may be delayed until a library function which polls for the signal examines it. This means, for example, that a runaway program caught in an infinite loop cannot be aborted by sending it a `Ctrl+C` event unless special code is added which tests for the presence of the signal and calls the `__check_abort()` function on its own accord.
|
||||
|
||||
Processing of the `Ctrl+C` event involves the internal `__check_abort()` function which polls for the presence of the event and which will call `raise(SIGINT);`. The `__check_abort()` function may be replaced by user code.
|
||||
|
||||
##### Files
|
||||
|
||||
No new line characters are written unless specifically requested.
|
||||
|
||||
Space characters in a text stream before a new line character are read in and are not discarded.
|
||||
|
||||
When data is read from a file, the last character does not have to be a new line character.
|
||||
|
||||
No `NUL` byte will be appended to data written to a binary stream.
|
||||
|
||||
There is no difference between text and binary streams.
|
||||
|
||||
Writing to a text or binary stream does not truncate the associated file. A stream may be truncated by the initial `fopen()` call if the `mode` parameter starts with the letter `w`.
|
||||
|
||||
The file position indicator is initially set to the end of an append mode stream.
|
||||
|
||||
##### `printf()` family
|
||||
|
||||
The `%p` conversion is the hexadecimal representation of the pointer, and it is preceded by the string `0x`.
|
||||
|
||||
The `%a`, `%e`, `%f`, `%g`, `%A`, `%E`, `%F` and `%G` specifiers will produce the string `inf` for infinity.
|
||||
|
||||
##### `scanf()` family
|
||||
|
||||
The input for the `%p` conversion must be a hexadecimal number, preceded by either the string `0x` or `0X`.
|
||||
|
||||
In the `%[` conversion a `-` (dash) character that is neither the first nor the last character in the scanset indicates that a subrange of characters should be used. Thus `%[a-d]` is equivalent to `%[abcd]`.
|
||||
|
||||
The period (.) is the decimal-point character. The locale specific decimal-point character is accepted as an alternative to the period (.).
|
||||
|
||||
##### `malloc()`, `realloc()` and `calloc()`
|
||||
|
||||
In the standard `libc.a` implementation any request to allocate 0 (zero) bytes will fail. A result value of `NULL` will be returned and the global `errno` variable will be set to `EINVAL`.
|
||||
|
||||
In the `libunix.a` implementation a request to allocate 0 (zero) bytes will result in an allocation of at least 4 bytes, which will be set to zero. Each zero length allocation will return a different memory address.
|
||||
|
||||
##### `rename()`
|
||||
|
||||
In the standard `libc.a` implementation the `rename()` function will fail if there already is a file or directory by the new name to be used.
|
||||
|
||||
In the `libunix.a` implementation the `rename()` function will delete any existing file or directory by the new name.
|
||||
|
||||
##### `remove()`
|
||||
|
||||
In the standard `libc.a` implementation the `remove()` function will fail if the file is protected by deletion or currently in use.
|
||||
|
||||
In the `libunix.a` implementation the `remove()` function will remove the file when the program exits or the file is closed.
|
||||
|
||||
##### `abort()`
|
||||
|
||||
The `abort()` function will flush all buffered files, close all the files currently open and delete temporary files.
|
||||
|
||||
##### `exit()` and `_Exit()`
|
||||
|
||||
The value passed to the `exit()` function will be passed to the Amiga operating system. The value of `EXIT_FAILURE` is equivalent to `RETURN_FAIL` as defined in the Amiga system header file `<dos/dos.h>`; this value maps to the number 20. The value of `EXIT_SUCCESS` is equivalent to `RETURN_OK` as defined in the Amiga system header file `<dos/dos.h>`; this value maps to the number 0.
|
||||
|
||||
The `_Exit()` function will flush all buffered files, close all the files currently open and delete temporary files.
|
||||
|
||||
##### `getenv()`
|
||||
|
||||
Environment data is retrieved from the global Amiga operating system environment storage area through the `dos.library/GetEnv()` function. Global variables are stored in files in the `ENV:` directory.
|
||||
|
||||
##### `system()`
|
||||
|
||||
If the `command` parameter is not NULL and the `system()` function returns, then the result will be equivalent to the exit code of the program invoked, or -1 if the program could not be started. This follows the behaviour of the Amiga operating system function `dos.library/System()`. A return value of 0 typically indicates successful execution and a value > 0 typically indicates failure.
|
||||
|
||||
##### Time
|
||||
|
||||
The default time zone is derived from the Amiga operating system locale settings and takes the form `GMT+*hh*` or `GMT-*hh*`, respectively, in which *hh* stands for the difference between the local time zone and Greenwich Mean Time (actually, this is not GMT but UTC).
|
||||
|
||||
The `clock_t` and `time_t` types are unsigned 32 bit integers. The `time_t` epoch starts with midnight January 1st, 1970.
|
||||
|
||||
Daylight savings time is not supported.
|
||||
|
||||
The reference point used by the `clock()` function is the time when the program was started.
|
||||
|
||||
#### Locale specific behaviour
|
||||
|
||||
The direction of printing is from left to right.
|
||||
|
||||
The period (.) is the decimal-point character.
|
||||
|
||||
The `strftime()` behaviour follows the Amiga operating system locale settings. If the 'C' locale is in effect, then the output generated by the `%Z` takes the form `GMT+*hh*` or `GMT-*hh*`, respectively, in which *hh* stands for the difference between the local time zone and Greenwich Mean Time (this is really UTC).
|
||||
|
||||
## Conventions and design issues
|
||||
|
||||
You will have noticed the 330+ files in this directory. This is not the best way to organize a runtime library, but at least all the bits and pieces are in plain sight. Each file stands for the one or two routines it contains. The name indicates what routine(s) that might be. Each file name is prefixed by the name of the header file in which the corresponding routine is defined. So, for example, you will find that `unistd_lchown.c` contains the definition of the `lchown()` routine, which has its prototype defined in the `<unistd.h>` header file.
|
||||
|
||||
Internal function and variables which need to be visible across several modules have names prefixed with two underscores, as in `__stdio_init()`.
|
||||
|
||||
By default all library routines follow the ISO 'C' conventions in that where implementation defined behaviour is permitted, the AmigaOS rules are followed. For example, `unlink()` will by default operate like `DeleteFile()` and `rename()` will return with an error code set if the name of the file/directory to be renamed would collide with an existing directory entry.
|
||||
|
||||
|
||||
## The startup code
|
||||
|
||||
There are three program startup files provided. The most simplistic is in `startup.c` which I use for *SAS/C*. It just invokes the setup routine which eventually calls `main()` and drops straight into `exit()`.
|
||||
|
||||
The `ncrt0.S` file was adapted from the *libnix* startup code which sets up the base relative data area, if necessary (the `SMALL_DATA` preprocessor symbol must be defined).
|
||||
|
||||
The `nrcrt0.S` file was adapted from *libnix* startup code, too, and sets up the base relative data area for programs to be made resident. Note that the `geta4()` stub is missing here; it wouldn't work in a resident program anyway.
|
||||
|
||||
The `ncrt0.S` and `nrcrt0.S` files are considerably smaller and less complex than the *libnix* code they are based on. This is because in this library design all the more complex tasks are performed in the `stdlib_main.c` file rather than in assembly language.
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
Well, you're reading it. There isn't anything much yet. You can consult the book *'C' - A reference manual* and you could look at the
|
||||
<a href="http://www.opengroup.org/onlinepubs/007904975">Open Group's Single Unix
|
||||
Specification</a>.
|
||||
|
||||
It is recommended to browse the contents of the `include` directory. The header files contain information on library behaviour and not just data type and function prototype definitions. Specifically, the `<dos.h>` header file contains documentation about special libraries and global variables which may be used or replaced by user code.
|
||||
|
||||
|
||||
## Legal status
|
||||
|
||||
Because this library is in part based upon free software it would be uncourteous not to make it free software itself. The BSD license would probably be appropriate here.
|
||||
|
||||
The PowerPC math library is based in part on work by Sun Microsystems:
|
||||
|
||||
<pre>
|
||||
====================================================
|
||||
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
|
||||
Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software is freely granted, provided that this notice
|
||||
is preserved.
|
||||
====================================================
|
||||
</pre>
|
||||
|
||||
## Contacting the author
|
||||
|
||||
The basic work was done by Olaf Barthel during two weeks in July 2002. You can reach me at:
|
||||
|
||||
Olaf Barthel
|
||||
Gneisenaustr. 43
|
||||
D-31275 Lehrte
|
||||
|
||||
Or via e-mail:
|
||||
|
||||
obarthel [at] gmx.net
|
||||
@@ -1,30 +0,0 @@
|
||||
<!DOCTYPE html public "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Notes on building the library</title>
|
||||
<body>
|
||||
|
||||
<h1>Notes on building the library</h1>
|
||||
|
||||
<p>In order to build the library, you need a 'C' compiler (obvious, isn't it?) and
|
||||
a set of header files for the networking API definitions. The networking header
|
||||
files go into a directory <tt>netinclude</tt> which has to sit in the same directory as
|
||||
the source code and the <tt>include</tt> directory you find in there. I'm not currently
|
||||
supplying these header files here. Drop me a line, and I'll take care of that.</p>
|
||||
|
||||
<p>The SAS/C flavour (<tt>smakefile</tt>) should get the library built using the "large data"
|
||||
model. This rules out the use of residentable programs as the startup code I'm
|
||||
using is very primitive (<tt>startup.o</tt>) and doesn't tinker with A4 relative data
|
||||
addressing (and how this may be set up).</p>
|
||||
|
||||
<p>There are two makefiles for GCC, each a different flavour. There is <tt>GNUmakefile.68k</tt>,
|
||||
which will build the library for GCC on the 68k platform ("classic" Amiga). This
|
||||
builds all variants of the library, for large data, small data, resident, whatever
|
||||
model. It's a lot of work and I don't recommend you do this on a plain 68k machine.
|
||||
It will literally (!) take hours. The other makefile flavour is for AmigaOS4 using
|
||||
the PowerPC hosted GCC system (<tt>GNUmakefile.os4</tt>). This builds only the large data
|
||||
version of the library, but this is usually all you need. Small data support is
|
||||
currently not implemented but might follow in the future.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,67 +0,0 @@
|
||||
<!DOCTYPE html public "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Notes on using the library with Amiga GCC (68k)</title>
|
||||
<body>
|
||||
|
||||
<h1>Notes on using the library with Amiga GCC (68k)</h1>
|
||||
|
||||
<p>You can use the 68k build of clib2 with the existing Amiga 68k ports of the
|
||||
GNU 'C' compiler. In order to do so, you need to modify the <tt>specs</tt> file which
|
||||
controls how the compiler(s) and the linker interact, and where the linker
|
||||
will look for the program startup code and library files. Also, you will need
|
||||
to copy the header files, startup code and library files to the locations
|
||||
where the 'C' compiler and linker expects them.</p>
|
||||
|
||||
<p>Please read the following description before you follow the instructions. The
|
||||
changes suggested may have unexpected side-effects!</p>
|
||||
|
||||
<p>I have provided a working <tt>specs</tt> file with this documentation file. To switch
|
||||
over an existing Amiga 68k port of GCC to use clib2, you would proceed as
|
||||
follows:</p>
|
||||
|
||||
<ul>
|
||||
<li> Locate the directory within which GCC is installed. For example, this
|
||||
could be within a directory to which the name <tt>ADE:</tt>, <tt>GG:</tt> or <tt>GCC:</tt>
|
||||
is assigned. For the sake of simplicity, the following notes assume
|
||||
that the assignment name is <tt>GCC:</tt>
|
||||
|
||||
<li> Make backup copies of the following directories and files:
|
||||
<ol>
|
||||
<li> <tt>GCC:lib/gcc-lib/amigaos/2.95.3/specs</tt><br>
|
||||
|
||||
<p>(NOTE: Check the directory called <tt>GCC:lib/gcc-lib/amigaos</tt>
|
||||
first; the "2.95.3" quoted above refers to the version,
|
||||
revision and patch number of the GCC installed and your
|
||||
version number may differ!)</p>
|
||||
|
||||
<li> <tt>GCC:include</tt>
|
||||
<li> <tt>GCC:lib</tt>
|
||||
|
||||
</ol>
|
||||
|
||||
<li> Now you can proceed to install clib2; just copy the <tt>include</tt> and <tt>lib</tt>
|
||||
directories over, like this:
|
||||
<ol>
|
||||
<li><kbd>Copy include GCC:include all quiet</kbd>
|
||||
<li><kbd>Copy lib GCC:lib all quiet</kbd>
|
||||
</ol>
|
||||
|
||||
<li> Finally, replace the <tt>specs</tt> file with the one provided:
|
||||
<ol>
|
||||
|
||||
<li> <kbd>Copy specs GCC:lib/gcc-lib/amigaos/2.95.3/specs</kbd><br>
|
||||
|
||||
<p>(NOTE: Check the directory called <tt>GCC:lib/gcc-lib/amigaos</tt>
|
||||
first; the "2.95.3" quoted above refers to the version,
|
||||
revision and patch number of the GCC installed and your
|
||||
version number may differ!)</p>
|
||||
</ol>
|
||||
</ul>
|
||||
|
||||
<p>Once you have completed these steps you should be able to build programs using
|
||||
the 68k build of clib2 and you currently installed GCC. Note that these
|
||||
changes may have the effect of rendering your C++ compiler unusable, so make
|
||||
sure that you've made backup copies of all files and directories first!</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,517 +0,0 @@
|
||||
<!DOCTYPE html public "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>An ISO 'C' (1994) compliant runtime library for the Amiga</title>
|
||||
<body>
|
||||
|
||||
<h1>An ISO 'C' (1994) compliant runtime library for the Amiga</h1>
|
||||
|
||||
<h2>1. What is this?</h2>
|
||||
|
||||
<p>This is my attempt to get Samba 2.2.x ported to the Amiga. My first Amiga
|
||||
port required SAS/C and a number of strange tricks had to be pulled to get
|
||||
it to support the kind of environment Samba needed. But with the
|
||||
introduction of Samba 2.2.x many of those tricks did not work any more,
|
||||
which is why I decided to attack the problem at the root, namely the
|
||||
runtime library.</p>
|
||||
|
||||
<p>Because it was no longer possible to build Samba with SAS/C on the new
|
||||
Amiga platform, the idea came up to move development to the GNU 'C'
|
||||
compiler. This turned out to be a challenge due to its somewhat
|
||||
underdeveloped runtime library and header files. Eventually, I decided to
|
||||
rewrite that library from scratch.</p>
|
||||
|
||||
|
||||
<h2>2. What does it do?</h2>
|
||||
|
||||
<p>Using <i>'C' - A reference manual</i> (4th edition) as a reference I wrote a set of
|
||||
header files, then proceeded to implement each single function referenced in
|
||||
them. With few exceptions in the area of wide character support, the result
|
||||
should be a feature complete implementation of the ISO 'C' (1994) runtime
|
||||
library. The library was subsequently updated to offer functionality defined in
|
||||
<i>ISO/IEC 9899:1999</i>, also known as <i>C99</i>.</p>
|
||||
|
||||
<p>Because Samba needs a few POSIX-like routines to be supported, the library
|
||||
functionality is complemented by a set of routines described in <i>Advanced
|
||||
programming in the Unix environent</i>.</p>
|
||||
|
||||
<p>This is not a portable implementation of the library in the sense that you
|
||||
could move it from one 'C' compiler on one operating system to another.
|
||||
This is an Amiga specific implementation.</p>
|
||||
|
||||
<p>The library supports floating point math, which, for the 68k platform, is
|
||||
limited to IEEE single and double precision or M68881 inline math. There is no
|
||||
support for the fast floating point (FFP) format or exclusive IEEE single
|
||||
precision. You either get double precision (IEEE math) or extended precision
|
||||
(M68881 inline math). What it is that you get is determined at compile time.
|
||||
Use the <tt>IEEE_FLOATING_POINT_SUPPORT</tt> preprocessor symbol to activate IEEE math
|
||||
code and the <tt>M68881_FLOATING_POINT_SUPPORT</tt> symbol for M68881 inline math.</p>
|
||||
|
||||
<p>For the PowerPC platform, the library uses code borrowed from <i>fdlibm 5.3</i>,
|
||||
which is a portable library of arithmetic functions developed by Sun
|
||||
Microsystems which, for example, is also used within the Java platform.</p>
|
||||
|
||||
<h2>3. What does it not do?</h2>
|
||||
|
||||
<p>This library is a departure from the typical 'C' runtime environments of the
|
||||
past which had to run on all AmigaOS releases, down to Kickstart 1.1. This
|
||||
very library was designed to take advantage of the routines available since
|
||||
Kickstart 2.04 was introduced and virtually nobody ever put to use. This helps
|
||||
to cut the code size, and it also helps to keep bugs out of the library by
|
||||
falling back onto well-tested implementations. However, the catch is that the
|
||||
code won't run under Kickstart 1.3 and below. But then these operating system
|
||||
releases have been obsolete for more than a decade, and you can always go back
|
||||
to a compiler environment which supports them.</p>
|
||||
|
||||
<p>There is very little support for <tt>amiga.lib</tt> functionality. There is <tt>NewList()</tt>,
|
||||
<tt>HookEntry()</tt>, <tt>CallHook()</tt>, <tt>CallHookA()</tt>, the <tt>DoMethod()</tt> family, the RexxVars
|
||||
family, but that's all. If you need more, you would have to implement it
|
||||
yourself. Put another way, if you absolutely need functionality that is only
|
||||
found in <tt>amiga.lib</tt>, you really shouldn't need it in the first place.</p>
|
||||
|
||||
|
||||
<h2>4. Where does the source code come from?</h2>
|
||||
|
||||
<p>I originally thought that it might be helpful to piece this library together
|
||||
from various sources, such as the BSD libc. It turned out that this code was so
|
||||
'portable' that it became much more complex than it ought to be. Also, some
|
||||
side-effects were present which considerably changed the behaviour of the
|
||||
library. For example, the BSD libc uses <tt>bcopy()</tt> as an alias for <tt>memcpy()</tt>, and
|
||||
unlike <tt>memcpy()</tt> is documented to, <tt>bcopy()</tt> supports overlapping copies.</p>
|
||||
|
||||
<p>Eventually, I wrote virtually all the code myself, borrowing algorithmic ideas
|
||||
from the BSD libc and the Manx Aztec 'C' runtime library. Because I don't know
|
||||
much about the environment GCC expects, I borrowed code snippets from libnix,
|
||||
which was written by Matthias Fleischer and Gunther Nikl. This in particular
|
||||
concerns the integer and floating point math support, the <tt>setjmp</tt>/<tt>longjmp</tt>
|
||||
routines and the startup code. The M68881 inline math code comes from the
|
||||
<tt><math-68881.h></tt> file written by Matthew Self <tt>(self [at] bayes.arc.nasa.gov)</tt>.</p>
|
||||
|
||||
|
||||
<h2>5. Limitations and caveats</h2>
|
||||
|
||||
<p>There is hardly any documentation on the code I wrote. In part this is due to
|
||||
the fact that the code itself is very simple in design. It should speak for
|
||||
itself. However, to make a usable runtime library you have to have a user
|
||||
documentation as in man pages or AutoDocs. We will eventually have to have
|
||||
autodocs for this library.</p>
|
||||
|
||||
<p>The exception handling in the math code is not particularly effective. For one
|
||||
part this is due to the fact that there is no exception handler installed by
|
||||
the runtime library when it starts up which could catch and process the error
|
||||
conditions the CPU or FPU generates. The idea was to provide for a portable
|
||||
runtime library with little to no assembly language involved. To make the
|
||||
exception handling complete, such code would be necessary.</p>
|
||||
|
||||
<p>The library currently builds under SAS/C, but because the 'normal' program
|
||||
startup code is not utilized, the base relative (A4) addressing does not work.
|
||||
If you are going to test it, use the <tt>data=faronly</tt> option to compile the
|
||||
library and the programs.</p>
|
||||
|
||||
<p>Different build makefiles are supplied for use with GCC. There is a
|
||||
<tt>GNUmakefile.68k</tt> for the 68k platform and a <tt>GNUmakefile.os4</tt> for the AmigaOS4
|
||||
PowerPC version.</p>
|
||||
|
||||
<h3>5.1 Floating point math and functions (<tt>scanf()</tt>, <tt>printf()</tt>, etc.) </h3>
|
||||
|
||||
<p>The plain <tt>libc.a</tt>, which your software would be linked against by default, does not contain
|
||||
any floating point support code. This means, for example, that <tt>printf("%f",...)</tt> will not produce
|
||||
the desired output and that <tt>scanf("%f",...)</tt> may not read any data at all. If your
|
||||
program needs functions such as these or <tt>atod()</tt> then you must link against <tt>libm.a</tt> or
|
||||
the equivalent.</p>
|
||||
|
||||
<p>To link the floating point support code with your software, use the <tt>-lm</tt> compiler option. <em>Careful!</em>
|
||||
The order in which you specify the libraries to link against is important here. Thus, <tt>gcc -o test test.c -lm -lc</tt>
|
||||
would correctly link the program <tt>test</tt> against the proper floating point math library, but
|
||||
<tt>gcc -o test test.c -lc -lm</tt> would not.</p>
|
||||
|
||||
<h3>5.2 The thread-safe library</h3>
|
||||
|
||||
<p>Thread-safety does not imply that you can have multiple callers
|
||||
access and close the same file. There is no resource tracking to that degree
|
||||
yet. All that the thread-safety tries to afford you is not to get into big trouble
|
||||
if simultaneous and overlapping accesses to files, memory allocation and other
|
||||
resources are taking place.</p>
|
||||
|
||||
<p>The library code is supposed to be thread-safe if built with the <tt>__THREAD_SAFE</tt>
|
||||
preprocesssor symbol defined. Note that 'thread-safe' does <em>not</em> mean
|
||||
'reentrant'. Multiple callers for certain library functions are permitted, but
|
||||
not for all of them. For example, <tt>mkdtemp()</tt> is not thread-safe, and neither is
|
||||
<tt>rand()</tt> or <tt>localtime()</tt>. But as per <i>POSIX 1003.1c-1995</i> there are thread-safe
|
||||
variants of <tt>rand()</tt> and <tt>localtime()</tt> called <tt>rand_r()</tt>, <tt>localtime_r()</tt>, and others.</p>
|
||||
|
||||
<p>The use of the socket I/O functions is problematic because the
|
||||
underlying <tt>bsdsocket.library</tt> API is not supposed to be used by any process
|
||||
other than the one which opened it. While one TCP/IP stack (my own "Roadshow") allows you
|
||||
to share the library base among different processes, if so configured, it is the
|
||||
exception. No other TCP/IP stack available for the Amiga robustly supports a similar
|
||||
feature. If the TCP/IP stack supports this feature, then the global variable
|
||||
<tt>__can_share_socket_library_base</tt> will be set to a non-zero value.</p>
|
||||
|
||||
<p>Errors reported by the socket I/O functions which modify the global variables
|
||||
<tt>errno</tt> and <tt>h_errno</tt> may be directed to call the <tt>__set_errno()</tt>
|
||||
and <tt>__set_h_errno()</tt> functions instead, if the TCP/IP stack supports this feature. The global
|
||||
variable <tt>__thread_safe_errno_h_errno</tt> will be set to a non-zero value if it does.</p>
|
||||
|
||||
<p>A much more serious problem resides with the <tt>exit()</tt>, <tt>abort()</tt>,
|
||||
<tt>assert()</tt> and <tt>raise()</tt> functions, and how the <tt>SIGINT</tt> signal is
|
||||
processed. In the thread-safe library only the <tt>main()</tt> function may directly
|
||||
or indirectly call the <tt>exit()</tt> function. No child process may do so, since this
|
||||
would wreck its stack context, crashing it instantly; the main program would be very
|
||||
likely to crash, too, because <tt>exit()</tt> will clean up after all memory allocations
|
||||
and files currently in use. Functions such as <tt>abort()</tt> and <tt>raise()</tt> may
|
||||
call the <tt>exit()</tt> function indirectly. And the <tt>raise()</tt> function may
|
||||
be invoked as part of the <tt>Control+C</tt> checking. You should make sure that the
|
||||
signal handling does not affect any child processes. This can be done by replacing the
|
||||
<tt>__check_abort()</tt> function or by disabling <tt>SIGINT</tt> processing altogether,
|
||||
such as through a <tt>signal(SIGINT,SIG_IGN)</tt> call.</p>
|
||||
|
||||
<p> Also take care with file I/O involving the <tt>stdin</tt>/<tt>stdout</tt>/<tt>stderr</tt>
|
||||
streams; read/write operations on these streams will be mapped to the <tt>Input()</tt>/<tt>Output()</tt>/<tt>ErrorOutput()</tt>
|
||||
file handles of the process performing these operations. Since only this small set of
|
||||
operations is mapped, functions such as <tt>fcntl()</tt> or <tt>select()</tt> will not
|
||||
work on the <tt>stdin</tt>/<tt>stdout</tt>/<tt>stderr</tt> streams and the corresponding
|
||||
file descriptors <tt>STDIN_FILENO</tt>/<tt>STDOUT_FILENO</tt>/<tt>STDERR_FILENO</tt>.
|
||||
It is therefore strongly recommended to use the thread-safe library only for applications
|
||||
which can cope with the limitations described above.</p>
|
||||
|
||||
<h3>5.3 Using gmon (PowerPC only)</h3>
|
||||
|
||||
<p>To use profiling, two steps are required. First of all, your program must be compiled with
|
||||
the gcc command line option <tt>-pg</tt>. This instructs the compiler to generate special
|
||||
profiling code in the prologue and epilogue of each function. Additionally, the program
|
||||
must be linked with <tt>libprofile.a</tt>. To do this, either manually add
|
||||
<tt>-lprofile</tt> to the linker command line, or modify the specs file as follows.
|
||||
Find the lines that look like this (it may actually differ silghtily from your specs file,
|
||||
but the important thing is that the line before the line to be modified reads <tt>lib:</tt>):
|
||||
<pre>
|
||||
lib:
|
||||
--start-group -lc --end-group
|
||||
</pre>
|
||||
You will have to modify this to look like this:
|
||||
<pre>
|
||||
lib:
|
||||
%{pg: -lprofile} --start-group -lc --end-group
|
||||
</pre>
|
||||
<p>Normally, the specs file is located at the compilers installation directory. For cross-compilers,
|
||||
this is <tt>/usr/local/amiga/lib/gcc/ppc-amigaos/<i>compiler-version</i>/specs</tt>. For a native compiler,
|
||||
it's in <tt>gcc:lib/gcc/ppc-amigaos/<i>compiler-version</i>/specs</tt>. Most likely, your compiler will already have this added to it's specs file.</p>
|
||||
|
||||
<p>Profiling makes use of a special PowerPC facility called the Performance Monitor. It
|
||||
allows to "mark" tasks and count only during while a marked task is running. This allows
|
||||
performance analysis to be made independant of the actual system load. The Performace Monitor
|
||||
is available on all PowerPC models supported by AmigaOS 4 except for the <tt>603e</tt>, and
|
||||
embedded versions of the PowerPC like the <tt>405</tt> and <tt>440</tt> series. Consult the manual
|
||||
of the appropriate chip for more information.</p>
|
||||
|
||||
<h3>5.4 Implementation defined behaviour</h3>
|
||||
|
||||
<h4>5.4.1. 'C' language</h4>
|
||||
|
||||
<h5>5.4.1.1. Environment</h5>
|
||||
|
||||
<p>The <tt>main(int argc,char **argv);</tt> function may be called with an <tt>argc</tt> value of 0,
|
||||
in which case the <tt>argv</tt> variable will contain a pointer to the Amiga Workbench startup
|
||||
message, which is of type <tt>struct WBStartup *</tt>, and is defined in the Amiga system header
|
||||
file <tt><workbench/startup.h></tt>.</p>
|
||||
|
||||
<h5>5.4.1.2. Characters</h5>
|
||||
|
||||
<p>The current locale is derived from the current Amiga operating system locale settings. The
|
||||
<tt>setlocale("")</tt> function call will choose the current Amiga operating system locale settings.
|
||||
Any other name passed to the <tt>setlocale()</tt> function, with the exception of <tt>"C"</tt>,
|
||||
which selects the 'C' locale, must be a locale name, as used by the Amiga operating system
|
||||
function <tt>OpenLocale()</tt> in <tt>locale.library</tt>.</p>
|
||||
|
||||
<h5>5.4.1.3. Floating-point</h5>
|
||||
|
||||
<p>The 68k version of clib2 supports single and double precision floating point numbers,
|
||||
according to the <i>IEEE 754</i> standard. The software floating point number support is built upon the Amiga
|
||||
operating system libraries <tt>mathieeesingbas.library</tt>, <tt>mathieeedoubbas.library</tt>
|
||||
and <tt>mathieeedoubtrans.library</tt>. The hardware floating point number support uses
|
||||
the M68881/M68882/M68040/M68060 floating point unit intead.</p>
|
||||
|
||||
<p>The PowerPC version of clib2 supports only double precision floating point numbers, according to
|
||||
the <i>IEEE 754</i> standard, because that is exactly what the PowerPC CPU supports. Single precision
|
||||
numbers may be implicitly converted to double precision numbers. This also means that the <i>C99</i>
|
||||
data type <tt>long double</tt> is identical to the <tt>double</tt> data type. Because there is no
|
||||
difference between these two, the library omits support for <i>C99</i> functions specifically designed
|
||||
to operate on <tt>long double</tt> data types, such as <tt>rintl()</tt>.</p>
|
||||
|
||||
<p>Both the 68k and the PowerPC versions of clib2 may call software floating point support
|
||||
routines in order to perform double and single precision operations that go beyond
|
||||
simple addition and multiplication, such as <tt>sqrt()</tt>. These functions come from
|
||||
Sun Microsystems <i>fdlibm 5.3</i> library.</p>
|
||||
|
||||
<p>Unless your software is linked against <tt>libm.a</tt> no floating point functions will
|
||||
be available to it, possibly causing a linker error. When using the GNU 'C' compiler, you will
|
||||
want to add the option <tt>-lm -lc</tt> to the linker command line.</p>
|
||||
|
||||
<p>The exception handling is currently entirely out of control of the developer
|
||||
and solely subject to the rules imposed by the operating system itself.</p>
|
||||
|
||||
<p>The <tt>fmod()</tt> function returns the value of the <tt>x</tt> parameter and
|
||||
sets <tt>errno</tt> to <tt>EDOM</tt> if the <tt>y</tt> parameter value is 0.</p>
|
||||
|
||||
<h4>5.4.2. Library functions</h4>
|
||||
|
||||
<h5>5.4.2.1. <tt>NULL</tt></h5>
|
||||
|
||||
<p>The <tt>NULL</tt> pointer constant is defined in the <tt><stddef.h></tt> header and
|
||||
will expand to <tt>((void *)0L)</tt> if the 'C' compiler is used. For a C++ compiler the constant
|
||||
will expand to <tt>0L</tt> instead.</p>
|
||||
|
||||
<h5>5.4.2.2. <tt>assert()</tt> diagnostic messages</h5>
|
||||
|
||||
<p>The diagnostic messages printed by the <tt>assert()</tt> function take the following form:</p>
|
||||
|
||||
<blockquote><tt>[<i>program name</i>] <i>file</i>:<i>line</i>: failed assertion "<i>condition</i>".</tt></blockquote>
|
||||
|
||||
<p>where:</p>
|
||||
<table border=0>
|
||||
<tr><th align=right>program name</th><td>Optional program name; if the program name is not yet known, then the
|
||||
entire text enclosed in square brackets will be omitted.</td></tr>
|
||||
<tr><th align=right>file</th><td>The value of the <tt>__FILE__</tt> symbol at the location of the <tt>assert()</tt> call.</td></tr>
|
||||
<tr><th align=right>line</th><td>The value of the <tt>__LINE__</tt> symbol at the location of the <tt>assert()</tt> call.</td></tr>
|
||||
<tr><th align=right>condition</th><td>The condition passed to the <tt>assert()</tt> function.</td></tr>
|
||||
</table>
|
||||
|
||||
<p>If available, the diagnostic messages will be sent to <tt>stderr</tt>.</p>
|
||||
|
||||
<p>If the program was launched from Workbench or if the global variable <tt>__no_standard_io</tt> is set
|
||||
to a non-zero value, then the assertion failure message will not be displayed in the shell window, but
|
||||
in a requester window. The diagnostic message shown in this window will take the following form:</p>
|
||||
|
||||
<blockquote><tt>Assertion of condition "<i>condition</i>" failed in file "<i>file</i>", line <i>line</i>.</tt></blockquote>
|
||||
|
||||
<p>The name of the program, if it is know at that time, will be displayed in the requester window title.</p>
|
||||
|
||||
<h5>5.4.2.3. Signal handling</h5>
|
||||
|
||||
<p>Only the minimum of required signals are supported by this library. These are <tt>SIGABRT</tt>, <tt>SIGFPE</tt>,
|
||||
<tt>SIGILL</tt>, <tt>SIGINT</tt>, <tt>SIGSEGV</tt> and <tt>SIGTERM</tt>.</p>
|
||||
|
||||
<p>As of this writing <tt>SIGFPE</tt> is never called by the floating point library functions.</p>
|
||||
|
||||
<p>The <tt>Ctrl+C</tt> event is translated into <tt>SIGINT</tt>. Signal delivery may be delayed
|
||||
until a library function which polls for the signal examines it. This means, for example, that
|
||||
a runaway program caught in an infinite loop cannot be aborted by sending it a <tt>Ctrl+C</tt> event unless special code
|
||||
is added which tests for the presence of the signal and calls the <tt>__check_abort()</tt> all on its own.</p>
|
||||
|
||||
<p>Processing of the <tt>Ctrl+C</tt> event involves the internal <tt>__check_abort()</tt> function which
|
||||
polls for the presence of the event and which will call <tt>raise(SIGINT);</tt>. The <tt>__check_abort()</tt>
|
||||
function may be replaced by user code.</p>
|
||||
|
||||
<h5>5.4.2.4. Files</h5>
|
||||
|
||||
<p>No new line characters are written unless specifically requested.</p>
|
||||
|
||||
<p>Space characters in a text stream before a new line character are read in and not discarded.</p>
|
||||
|
||||
<p>When data is read from a file, the last character does not have to be a new line character.</p>
|
||||
|
||||
<p>No NUL byte will be appended to data written to a binary stream.</p>
|
||||
|
||||
<p>There is no difference between text and binary streams.</p>
|
||||
|
||||
<p>Writing to a text or binary stream does not truncate the associated file. A stream may be
|
||||
truncated by the initial <tt>fopen()</tt> call if the <tt>mode</tt> parameter starts with
|
||||
the letter <tt>w</tt>.</p>
|
||||
|
||||
<p>The file position indicator is initially set to the end of an append mode stream.</p>
|
||||
|
||||
<h5>5.4.2.5. <tt>printf()</tt> family</h5>
|
||||
|
||||
<p>The <tt>%p</tt> conversion is the hexadecimal representation of the pointer, and
|
||||
it is preceded by the string <tt>0x</tt>.</p>
|
||||
|
||||
<p>The <tt>%a</tt>, <tt>%e</tt>, <tt>%f</tt>, <tt>%g</tt>, <tt>%A</tt>,
|
||||
<tt>%E</tt>, <tt>%F</tt> and <tt>%G</tt> specifiers will produce the string <tt>inf</tt>
|
||||
for infinity.</p>
|
||||
|
||||
<h5>5.4.2.6. <tt>scanf()</tt> family</h5>
|
||||
|
||||
<p>The input for the <tt>%p</tt> conversion must be a hexadecimal number,
|
||||
preceded by either the string <tt>0x</tt> or <tt>0X</tt>.</p>
|
||||
|
||||
<p>In the <tt>%[</tt> conversion a <tt>-</tt> (dash) character that is neither the
|
||||
first nor the last character in the scanset indicates that a subrange of
|
||||
characters should be used. Thus <tt>%[a-d]</tt> is equivalent to <tt>%[abcd]</tt>.</p>
|
||||
|
||||
<p>The period (.) is the decimal-point character. The locale specific decimal-point
|
||||
character is accepted as an alternative to the period (.).</p>
|
||||
|
||||
<h5>5.4.2.7. <tt>malloc()</tt>, <tt>realloc()</tt> and <tt>calloc()</tt></h5>
|
||||
|
||||
<p>In the standard <tt>libc.a</tt> implementation any request to allocate
|
||||
0 (zero) bytes will fail. A result value of <tt>NULL</tt> will be returned and
|
||||
the global <tt>errno</tt> variable will be set to <tt>EINVAL</tt>.</p>
|
||||
|
||||
<p>In the <tt>libunix.a</tt> implementation a request to allocate
|
||||
0 (zero) bytes will result in an allocation of at least 4 bytes, which will
|
||||
be set to zero. Each zero length allocation will return a different
|
||||
memory address.</p>
|
||||
|
||||
<h5>5.4.2.8. <tt>rename()</tt></h5>
|
||||
|
||||
<p>In the standard <tt>libc.a</tt> implementation the <tt>rename()</tt> function
|
||||
will fail if there already is a file or directory by the new name to be used.</p>
|
||||
|
||||
<p>In the <tt>libunix.a</tt> implementation the <tt>rename()</tt> function will
|
||||
delete any existing file or directory by the new name.</p>
|
||||
|
||||
<h5>5.4.2.9. <tt>remove()</tt></h5>
|
||||
|
||||
<p>In the standard <tt>libc.a</tt> implementation the <tt>remove()</tt> function
|
||||
will fail if the file is protected by deletion or currently in use.</p>
|
||||
|
||||
<p>In the <tt>libunix.a</tt> implementation the <tt>remove()</tt> function
|
||||
will remove the file when the program exits or the file is closed.</p>
|
||||
|
||||
<h5>5.4.2.10. <tt>abort()</tt></h5>
|
||||
|
||||
<p>The <tt>abort()</tt> function will flush all buffered files,
|
||||
close all the files currently open and delete temporary files.</p>
|
||||
|
||||
<h5>5.4.2.11. <tt>exit()</tt> and <tt>_Exit()</tt></h5>
|
||||
|
||||
<p>The value passed to the <tt>exit()</tt> function will be passed to the
|
||||
Amiga operating system. The value of <tt>EXIT_FAILURE</tt> is equivalent
|
||||
to <tt>RETURN_FAIL</tt> as defined in the Amiga system header file
|
||||
<tt><dos/dos.h></tt>; this value maps to the number 20. The value
|
||||
of <tt>EXIT_SUCCESS</tt> is equivalent to <tt>RETURN_OK</tt> as defined in
|
||||
the Amiga system header file <tt><dos/dos.h></tt>; this value maps to
|
||||
the number 0.</p>
|
||||
|
||||
<p>The <tt>_Exit()</tt> function will flush all buffered files,
|
||||
close all the files currently open and delete temporary files.</p>
|
||||
|
||||
<h5>5.4.2.12. <tt>getenv()</tt></h5>
|
||||
|
||||
<p>Environment data is retrieved from the global Amiga operating system environment
|
||||
storage area through the <tt>dos.library/GetEnv()</tt> function. Global variables are
|
||||
stored in files in the <tt>ENV:</tt> directory.</p>
|
||||
|
||||
<h5>5.4.2.13. <tt>system()</tt></h5>
|
||||
|
||||
<p>If the <tt>command</tt> parameter is not NULL and the <tt>system()</tt> function returns, then the result will
|
||||
be equivalent to the exit code of the program invoked, or -1 if the program could not be started.
|
||||
This follows the behaviour of the Amiga operating system function <tt>dos.library/System()</tt>.
|
||||
A return value of 0 typically indicates successful execution and a value > 0
|
||||
typically indicates failure.</p>
|
||||
|
||||
<h5>5.4.2.14. Time</h5>
|
||||
|
||||
<p>The default time zone is derived from the Amiga operating system locale
|
||||
settings and takes the form <tt>GMT+<i>hh</i></tt> or <tt>GMT-<i>hh</i></tt>,
|
||||
respectively, in which <i>hh</i> stands for the difference between the local
|
||||
time zone and Greenwich Mean Time.</p>
|
||||
|
||||
<p>The <tt>clock_t</tt> and <tt>time_t</tt> types are unsigned 32 bit integers.
|
||||
The <tt>time_t</tt> epoch starts with midnight January 1st, 1970.</p>
|
||||
|
||||
<p>Daylight savings time is not supported.</p>
|
||||
|
||||
<p>The reference point used by the <tt>clock()</tt> function is the time
|
||||
when the program was started.</p>
|
||||
|
||||
<h4>5.4.3. Locale specific behaviour</h4>
|
||||
|
||||
<p>The direction of printing is from left to right.</p>
|
||||
|
||||
<p>The period (.) is the decimal-point character.</p>
|
||||
|
||||
<p>The <tt>strftime()</tt> behaviour follows the Amiga operating system locale
|
||||
settings. If the 'C' locale is in effect, then the output generated by the
|
||||
<tt>%Z</tt> takes the form <tt>GMT+<i>hh</i></tt> or <tt>GMT-<i>hh</i></tt>,
|
||||
respectively, in which <i>hh</i> stands for the difference between the local
|
||||
time zone and Greenwich Mean Time.</p>
|
||||
|
||||
<h2>6. Conventions and design issues</h2>
|
||||
|
||||
<p>You will have noticed the 330+ files in this directory. This is not the best
|
||||
way to organize a runtime library, but at least all the bits and pieces are in
|
||||
plain sight. Each file stands for the one or two routines it contains. The
|
||||
name indicates what routine(s) that might be. Each file name is prefixed by
|
||||
the name of the header file in which the corresponding routine is defined. So,
|
||||
for example, you will find that <tt>unistd_lchown.c</tt> contains the definition of
|
||||
the <tt>lchown()</tt> routine, which has its prototype defined in the <tt><unistd.h></tt> header
|
||||
file.</p>
|
||||
|
||||
<p>Internal function and variables which need to be visible across several
|
||||
modules have names prefixed with two underscores, as in <tt>__stdio_init()</tt>.</p>
|
||||
|
||||
<p>By default all library routines follow the ISO 'C' conventions in that where
|
||||
implementation defined behaviour is permitted, the AmigaOS rules are followed.
|
||||
For example, <tt>unlink()</tt> will by default operate like <tt>DeleteFile()</tt> and <tt>rename()</tt>
|
||||
will return with an error code set if the name of the file/directory to be
|
||||
renamed would collide with an existing directory entry.</p>
|
||||
|
||||
|
||||
<h2>7. The startup code</h2>
|
||||
|
||||
<p>There are three program startup files provided. The most simplistic is in
|
||||
<tt>startup.c</tt> which I use for SAS/C. It just invokes the setup routine which
|
||||
eventually calls <tt>main()</tt> and drops straight into <tt>exit()</tt>.</p>
|
||||
|
||||
<p>The <tt>ncrt0.S</tt> file was adapted from the libnix startup code which sets up the
|
||||
base relative data area, if necessary (the <tt>SMALL_DATA</tt> preprocessor symbol must
|
||||
be defined).</p>
|
||||
|
||||
<p>The <tt>nrcrt0.S</tt> file was adapted from libnix startup code, too, and sets up the
|
||||
base relative data area for programs to be made resident. Note that the
|
||||
<tt>geta4()</tt> stub is missing here; it wouldn't work in a resident program anyway.</p>
|
||||
|
||||
<p>The <tt>ncrt0.S</tt> and <tt>nrcrt0.S</tt> files are considerably smaller and less complex than
|
||||
the libnix code they are based on. This is because in this library design all
|
||||
the more complex tasks are performed in the <tt>stdlib_main.c</tt> file rather than in
|
||||
assembly language.</p>
|
||||
|
||||
|
||||
<h2>8. Documentation</h2>
|
||||
|
||||
<p>Well, you're reading it. There isn't anything much yet. You can consult the book
|
||||
<i>'C' - A reference manual</i> and you could look at the
|
||||
<a href="http://www.opengroup.org/onlinepubs/007904975">Open Group's Single Unix
|
||||
Specification</a>.</p>
|
||||
|
||||
<p>It is recommended to browse the contents of the <tt>include</tt> directory. The
|
||||
header files contain information on library behaviour and not just data type and
|
||||
function prototype definitions. Specifically, the <tt><dos.h></tt> header file
|
||||
contains documentation about special libraries and global variables which may be
|
||||
used or replaced by user code.</p>
|
||||
|
||||
|
||||
<h2>9. Legal status</h2>
|
||||
|
||||
<p>Because this library is in part based upon free software it would be
|
||||
uncourteous not to make it free software itself. The BSD license would
|
||||
probably be appropriate here.</p>
|
||||
|
||||
<p>The PowerPC math library is based in part on work by Sun Microsystems:</p>
|
||||
|
||||
<pre>
|
||||
====================================================
|
||||
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
|
||||
Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||
Permission to use, copy, modify, and distribute this
|
||||
software is freely granted, provided that this notice
|
||||
is preserved.
|
||||
====================================================
|
||||
</pre>
|
||||
|
||||
<h2>10. Contacting the author</h2>
|
||||
|
||||
<p>The basic work was done by Olaf Barthel during two weeks in July 2002. You
|
||||
can reach me at:</p>
|
||||
|
||||
<p>Olaf Barthel<br>
|
||||
Gneisenaustr. 43<br>
|
||||
D-31275 Lehrte<br></p>
|
||||
|
||||
<p>Or via e-mail:</p>
|
||||
|
||||
<p>obarthel [at] gmx.net</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,64 +0,0 @@
|
||||
*asm:
|
||||
%{m68000:-mc68010} %{mc68000:-mc68010} %{m68020:-mc68020} %{mc68020:-mc68020} %{m68030:-mc68030} %{m68040:-mc68040} %{m68060:-mc68060} %{m68020-40:-mc68020} %{m68020-60:-mc68020} %{!mc68000:%{!m68000:%{!mc68020:%{!m68020:%{!m68030:%{!m68040:%{!m68060:%{!m68020-40:%{!m68020-60:-mc68010}}}}}}}}} %{msmall-code:-sc}
|
||||
|
||||
*asm_final:
|
||||
|
||||
|
||||
*cpp:
|
||||
%{m68881:-D__HAVE_68881__} %{!ansi:%{m68020:-Dmc68020} %{mc68020:-Dmc68020} %{m68020-40:-Dmc68020} %{m68020-60:-Dmc68020} %{m68030:-Dmc68030} %{m68040:-Dmc68040} %{m68060:-Dmc68060}} %{m68020:-D__mc68020__ -D__mc68020} %{mc68020:-D__mc68020__ -D__mc68020} %{m68020-40:-D__mc68020__ -D__mc68020} %{m68020-60:-D__mc68020__ -D__mc68020} %{m68030:-D__mc68030__ -D__mc68030} %{m68040:-D__mc68040__ -D__mc68040} %{m68060:-D__mc68060__ -D__mc68060}
|
||||
|
||||
*cc1:
|
||||
%{resident:-fbaserel} %{resident32:-fbaserel32} %{msmall-code:-fno-function-cse}
|
||||
|
||||
*cc1plus:
|
||||
|
||||
|
||||
*endfile:
|
||||
|
||||
|
||||
*link:
|
||||
%{fbaserel:%{!resident:-m amiga_bss -fl libb}} %{resident:-m amiga_bss -amiga-datadata-reloc -fl libb} %{fbaserel32:%{!resident32:-m amiga_bss -fl libb32}} %{resident32:-m amiga_bss -amiga-datadata-reloc -fl libb32} %{g:-amiga-debug-hunk} %{m68020:-fl libm020} %{mc68020:-fl libm020} %{m68030:-fl libm020} %{m68040:-fl libm020} %{m68060:-fl libm020} %{m68020-40:-fl libm020} %{m68020-60:-fl libm020} %{noixemul:}
|
||||
|
||||
*lib:
|
||||
%{mstackextend:-lstack} -lc -lamiga -ldebug -lgcc -lc
|
||||
|
||||
*libgcc:
|
||||
%{mstackextend:-lstack} -lc -lgcc
|
||||
|
||||
*startfile:
|
||||
%{resident32:nr32crt0.o%s}%{!resident32:%{fbaserel32:nb32crt0.o%s}%{!fbaserel32:%{resident:nrcrt0.o%s}%{!resident:%{fbaserel:nbcrt0.o%s}%{!fbaserel:ncrt0.o%s}}}}
|
||||
|
||||
*switches_need_spaces:
|
||||
|
||||
|
||||
*signed_char:
|
||||
%{funsigned-char:-D__CHAR_UNSIGNED__}
|
||||
|
||||
*predefines:
|
||||
-Dmc68000 -Damiga -Damigaos -DMCH_AMIGA -DAMIGA -D__CLIB2__ -D__chip=__attribute__((__chip__)) -D__saveds=__attribute__((__saveds__)) -D__interrupt=__attribute__((__interrupt__)) -D__stackext=__attribute__((__stackext__)) -D__regargs=__attribute__((__regparm__)) -D__stdargs=__attribute__((__stkparm__)) -D__aligned=__attribute__((__aligned__(4))) -Asystem(amigaos) -Acpu(m68k) -Amachine(m68k)
|
||||
|
||||
*cross_compile:
|
||||
0
|
||||
|
||||
*version:
|
||||
2.95.3
|
||||
|
||||
*multilib:
|
||||
. ;
|
||||
|
||||
*multilib_defaults:
|
||||
|
||||
|
||||
*multilib_extra:
|
||||
|
||||
|
||||
*multilib_matches:
|
||||
|
||||
|
||||
*linker:
|
||||
collect2
|
||||
|
||||
*link_command:
|
||||
%{!fsyntax-only: %{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{static:} %{L*} %D %o %{!nostdlib:%{!nodefaultlibs:%G %L %G}} %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*}
|
||||
}}}}}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: GNUmakefile.68k,v 1.107 2010-10-20 13:50:16 obarthel Exp $
|
||||
# $Id: GNUmakefile.68k,v 1.106 2008-04-16 07:38:10 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@@ -122,7 +122,7 @@ WARNINGS = \
|
||||
# -Wconversion -Wshadow
|
||||
|
||||
INCLUDES = -Iinclude -I. -Inetinclude
|
||||
#OPTIONS = -fno-builtin -fno-common
|
||||
#OPTIONS = -fno-builtin -fno-common -DDEBUG
|
||||
OPTIONS = -fno-builtin -fno-common -DNDEBUG
|
||||
#OPTIONS = -fno-builtin -fno-common -DNDEBUG -D__THREAD_SAFE
|
||||
#OPTIONS = -fno-builtin -fno-common -D__MEM_DEBUG
|
||||
@@ -261,7 +261,6 @@ C_LIB = \
|
||||
stdio_iobhookentry.o \
|
||||
stdio_lock.o \
|
||||
stdio_locksemaphorename.o \
|
||||
stdio_long_path.o \
|
||||
stdio_nostdio.o \
|
||||
stdio_openiob.o \
|
||||
stdio_parent_of_fh.o \
|
||||
@@ -327,16 +326,11 @@ C_LIB = \
|
||||
stdlib_dosbase.o \
|
||||
stdlib_exit.o \
|
||||
stdlib_free.o \
|
||||
stdlib_free_unused_slabs.o \
|
||||
stdlib_decay_unused_slabs.o \
|
||||
stdlib_getdefstacksize.o \
|
||||
stdlib_getenv.o \
|
||||
stdlib_getmemstats.o \
|
||||
stdlib_getsp.o \
|
||||
stdlib_get_errno.o \
|
||||
stdlib_get_slab_usage.o \
|
||||
stdlib_get_slab_allocations.o \
|
||||
stdlib_get_slab_stats.o \
|
||||
stdlib_isresident.o \
|
||||
stdlib_labs.o \
|
||||
stdlib_llabs.o \
|
||||
@@ -374,10 +368,11 @@ C_LIB = \
|
||||
stdlib_set_process_window.o \
|
||||
stdlib_shell_escape.o \
|
||||
stdlib_showerror.o \
|
||||
stdlib_slab.o \
|
||||
stdlib_slab_max_size.o \
|
||||
stdlib_slab_purge_threshold.o \
|
||||
stdlib_srand.o \
|
||||
stdlib_stackargbytes.o \
|
||||
stdlib_stackcheck.o \
|
||||
stdlib_stackoverflow.o \
|
||||
stdlib_stacksafezone.o \
|
||||
stdlib_stacksize.o \
|
||||
stdlib_stack_usage.o \
|
||||
stdlib_arg.o \
|
||||
@@ -492,13 +487,13 @@ C_LIB = \
|
||||
UNIX_LIB = \
|
||||
unix.lib_rev.o \
|
||||
dirent_closedir.o \
|
||||
dirent_rewinddir.o \
|
||||
dirent_opendir.o \
|
||||
dirent_readdir.o \
|
||||
dirent_rewinddir.o \
|
||||
fcntl_creat.o \
|
||||
fcntl_fcntl.o \
|
||||
fcntl_get_default_file.o \
|
||||
fcntl_open.o \
|
||||
fcntl_get_default_file.o \
|
||||
getopt_getopt_long.o \
|
||||
mount_convertinfo.o \
|
||||
mount_statfs.o \
|
||||
@@ -506,19 +501,18 @@ UNIX_LIB = \
|
||||
resource_setrlimit.o \
|
||||
stat_chmod.o \
|
||||
stat_fstat.o \
|
||||
stat_lock.o \
|
||||
stat_lstat.o \
|
||||
stat_lock.o \
|
||||
stat_mkdir.o \
|
||||
stat_rmdir.o \
|
||||
stat_stat.o \
|
||||
stdio_ctermid.o \
|
||||
stdio_fdhookentry.o \
|
||||
stdio_fflush.o \
|
||||
stdio_file_init.o \
|
||||
stdio_fopen.o \
|
||||
stdio_init_exit.o \
|
||||
stdio_file_init.o \
|
||||
stdio_locksemaphorename.o \
|
||||
stdio_long_path.o \
|
||||
stdio_openiob.o \
|
||||
stdio_popen.o \
|
||||
stdio_record_locking.o \
|
||||
@@ -528,28 +522,17 @@ UNIX_LIB = \
|
||||
stdlib_alloca_cleanup.o \
|
||||
stdlib_alloca_trap.o \
|
||||
stdlib_arg.o \
|
||||
stdlib_calloc.o \
|
||||
stdlib_decay_unused_slabs.o \
|
||||
stdlib_expand_wildcard.o \
|
||||
stdlib_expand_wildcard_check.o \
|
||||
stdlib_free.o \
|
||||
stdlib_free_unused_slabs.o \
|
||||
stdlib_getmemstats.o \
|
||||
stdlib_get_slab_allocations.o \
|
||||
stdlib_get_slab_stats.o \
|
||||
stdlib_get_slab_usage.o \
|
||||
stdlib_main.o \
|
||||
stdlib_main_stub.o \
|
||||
stdlib_malloc.o \
|
||||
stdlib_mkdtemp.o \
|
||||
stdlib_mkstemp.o \
|
||||
stdlib_mktemp.o \
|
||||
stdlib_malloc.o \
|
||||
stdlib_realloc.o \
|
||||
stdlib_red_black.o \
|
||||
stdlib_resetmemstats.o \
|
||||
stdlib_slab.o \
|
||||
stdlib_slab_max_size.o \
|
||||
stdlib_slab_purge_threshold.o \
|
||||
stdlib_system.o \
|
||||
systeminfo_sysinfo.o \
|
||||
termios_cfgetispeed.o \
|
||||
@@ -953,7 +936,6 @@ AMIGA_LIB = \
|
||||
amiga_hotkey.o \
|
||||
amiga_invertstring.o \
|
||||
amiga_newlist.o \
|
||||
amiga_pools.o \
|
||||
amiga_rangerand.o \
|
||||
amiga_remtof.o \
|
||||
amiga_rexxvars.o \
|
||||
@@ -1141,59 +1123,17 @@ $(LIBC_OBJS)/stdlib_getdefstacksize.o : stdlib_getdefstacksize.c stdlib_gcc_help
|
||||
|
||||
$(LIBC_OBJS)/stdlib_shell_escape.o : stdlib_shell_escape.c stdlib_gcc_help.h
|
||||
|
||||
$(LIBC_OBJS)/stdlib_alloca.o : stdlib_alloca.c stdlib_memory.h include/stdlib.h
|
||||
$(LIBC_OBJS)/stdlib_alloca.o : stdlib_alloca.c stdlib_memory.h
|
||||
|
||||
$(LIBC_OBJS)/stdlib_calloc.o : stdlib_calloc.c stdlib_memory.h include/stdlib.h
|
||||
$(LIBC_OBJS)/stdlib_calloc.o : stdlib_calloc.c stdlib_memory.h
|
||||
|
||||
$(LIBC_OBJS)/stdlib_free.o : stdlib_free.c stdlib_memory.h include/stdlib.h
|
||||
$(LIBC_OBJS)/stdlib_free.o : stdlib_free.c stdlib_memory.h
|
||||
|
||||
$(LIBC_OBJS)/stdlib_malloc.o : stdlib_malloc.c stdlib_memory.h include/stdlib.h
|
||||
$(LIBC_OBJS)/stdlib_malloc.o : stdlib_malloc.c stdlib_memory.h
|
||||
|
||||
$(LIBC_OBJS)/stdlib_slab.o : stdlib_slab.c stdlib_memory.h include/stdlib.h
|
||||
$(LIBC_OBJS)/stdlib_realloc.o : stdlib_realloc.c stdlib_memory.h
|
||||
|
||||
$(LIBC_OBJS)/stdlib_slab_purge_threshold.o : stdlib_slab_purge_threshold.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBC_OBJS)/stdlib_get_slab_stats.o : stdlib_get_slab_stats.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBC_OBJS)/stdlib_free_unused_slabs.o : stdlib_free_unused_slabs.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBC_OBJS)/stdlib_decay_unused_slabs.o : stdlib_decay_unused_slabs.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBC_OBJS)/stdlib_get_slab_usage.o : stdlib_get_slab_usage.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBC_OBJS)/stdlib_get_slab_allocations.o : stdlib_get_slab_allocations.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBC_OBJS)/stdlib_realloc.o : stdlib_realloc.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBC_OBJS)/stdlib_red_black.o : stdlib_red_black.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
##############################################################################
|
||||
|
||||
$(LIBUNIX_OBJS)/stdlib_alloca.o : stdlib_alloca.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBUNIX_OBJS)/stdlib_calloc.o : stdlib_calloc.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBUNIX_OBJS)/stdlib_decay_unused_slabs.o : stdlib_decay_unused_slabs.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBUNIX_OBJS)/stdlib_free.o : stdlib_free.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBUNIX_OBJS)/stdlib_free_unused_slabs.o : stdlib_free_unused_slabs.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBUNIX_OBJS)/stdlib_get_slab_allocations.o : stdlib_get_slab_allocations.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBUNIX_OBJS)/stdlib_get_slab_stats.o : stdlib_get_slab_stats.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBUNIX_OBJS)/stdlib_get_slab_usage.o : stdlib_get_slab_usage.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBUNIX_OBJS)/stdlib_malloc.o : stdlib_malloc.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBUNIX_OBJS)/stdlib_realloc.o : stdlib_realloc.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBUNIX_OBJS)/stdlib_red_black.o : stdlib_red_black.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBUNIX_OBJS)/stdlib_slab.o : stdlib_slab.c stdlib_memory.h include/stdlib.h
|
||||
|
||||
$(LIBUNIX_OBJS)/stdlib_slab_purge_threshold.o : stdlib_slab_purge_threshold.c stdlib_memory.h include/stdlib.h
|
||||
$(LIBC_OBJS)/stdlib_red_black.o : stdlib_red_black.c stdlib_memory.h
|
||||
|
||||
##############################################################################
|
||||
|
||||
@@ -1374,6 +1314,8 @@ CONSTRUCTOR_FILES = \
|
||||
stdlib_malloc.c \
|
||||
stdlib_program_name.c \
|
||||
stdlib_setenv.c \
|
||||
stdlib_stackcheck.c \
|
||||
stdlib_stackextension.c \
|
||||
time_clock.c \
|
||||
unistd_chdir_exit.c \
|
||||
unistd_init_exit.c \
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: GNUmakefile.os4,v 1.116 2008-11-06 14:44:07 obarthel Exp $
|
||||
# $Id: GNUmakefile.os4,v 1.114 2008-04-28 15:49:25 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@@ -26,19 +26,10 @@ NET_INCLUDE := netinclude
|
||||
CC := ppc-amigaos-gcc
|
||||
AR := ppc-amigaos-ar -q
|
||||
RANLIB := ppc-amigaos-ranlib
|
||||
COPY := cp -p
|
||||
COPY := cp -a
|
||||
DELETE := rm -rf
|
||||
MAKEDIR := mkdir -p
|
||||
# Enabling the LOG_COMMAND has the consequence that a rule will not
|
||||
# fail on an error because only the exit status from the tee command
|
||||
# will be considered
|
||||
#LOG_COMMAND := 2>&1 | tee -a compiler.log
|
||||
LOG_COMMAND :=
|
||||
# You may need to request a specific compiler version in order to
|
||||
# build the baserel versions of the library. At this time of
|
||||
# writing (2008-11-06) GCC 4.0.4 and below support the -mbaserel
|
||||
# feature, but more recent versions, including GCC 4.2.4, do not.
|
||||
#COMPILER_VERSION := -V4.0.2
|
||||
LOG_COMMAND := 2>&1 | tee -a compiler.log
|
||||
|
||||
# The following are for the native OS4 compiler; note that the
|
||||
# LOG_COMMAND should not be enabled unless you have a shell
|
||||
@@ -51,27 +42,25 @@ LOG_COMMAND :=
|
||||
#COPY := copy
|
||||
#DELETE := delete all quiet force
|
||||
#MAKEDIR := makedir all force
|
||||
#COMPILER_VERSION := -V4.0.2
|
||||
#LOG_COMMAND := *>< | tee >>compiler.log
|
||||
|
||||
##############################################################################
|
||||
|
||||
WARNINGS := \
|
||||
-Wall -W -Wpointer-arith -Wsign-compare -Wmissing-prototypes \
|
||||
-Wundef -Wmissing-declarations -Wunused -Wwrite-strings \
|
||||
-Wno-deprecated-declarations -Wno-unused-label \
|
||||
-Wundef -Wbad-function-cast -Wmissing-declarations -Wunused -Wwrite-strings
|
||||
|
||||
# -Wconversion -Wshadow -Wbad-function-cast
|
||||
# -Wconversion -Wshadow
|
||||
|
||||
INCLUDES := -Iinclude -I. -I$(SDK_INCLUDE)
|
||||
OPTIONS := -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames -fno-builtin -fno-common -std=c99 -nostdlib
|
||||
OPTIONS := -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames -fno-common -std=gnu99
|
||||
OPTIMIZE := -DNDEBUG -O3
|
||||
|
||||
#DEBUG := -ggdb
|
||||
#MEMDEBUG := -D__USE_MEM_TREES -D__MEM_DEBUG
|
||||
|
||||
CFLAGS := $(COMPILER_VERSION) $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(MEMDEBUG) $(OPTIONS) $(INCLUDES)
|
||||
AFLAGS := $(COMPILER_VERSION) -Wa,-mregnames
|
||||
CFLAGS := $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(MEMDEBUG) $(OPTIONS) $(INCLUDES)
|
||||
AFLAGS := -Wa,-mregnames
|
||||
|
||||
LARGEDATA := -msdata=data
|
||||
SOFTFLOAT := -msdata=data -msoft-float
|
||||
@@ -97,11 +86,7 @@ include libm.gmk
|
||||
include libnet.gmk
|
||||
include libdebug.gmk
|
||||
include libamiga.gmk
|
||||
|
||||
# Olaf (2019-08-22): Please note that "profile_profil.o" can no longer
|
||||
# be built, presumably for lack of header files needed
|
||||
# to build it properly.
|
||||
#include libprofile.gmk
|
||||
include libprofile.gmk
|
||||
|
||||
all-targets: \
|
||||
lib/crt0.o \
|
||||
@@ -168,12 +153,6 @@ cvs-tag:
|
||||
|
||||
# General build rules for all object files and the individual libraries
|
||||
|
||||
#NO_AGGRESSIVE_LOOP_OPTIMIZATIONS := -fno-aggressive-loop-optimizations
|
||||
|
||||
lib/crtbegin.o : CFLAGS += $(NO_AGGRESSIVE_LOOP_OPTIMIZATIONS)
|
||||
lib/crtbegin.o : crtbegin.c
|
||||
@$(COMPILE)
|
||||
|
||||
lib/%.o : AFLAGS += $(LARGEDATA)
|
||||
lib/%.o : %.S
|
||||
@$(ASSEMBLE)
|
||||
@@ -185,11 +164,6 @@ lib/small-data/%.o : AFLAGS += $(SMALLDATA)
|
||||
lib/small-data/%.o : %.S
|
||||
@$(ASSEMBLE)
|
||||
|
||||
lib/small-data/crtbegin.o : CFLAGS += $(SMALLDATA) $(NO_AGGRESSIVE_LOOP_OPTIMIZATIONS)
|
||||
lib/small-data/crtbegin.o : crtbegin.c
|
||||
@$(COMPILE)
|
||||
|
||||
lib/small-data/%.o : CFLAGS += $(SMALLDATA)
|
||||
lib/small-data/%.o : %.c
|
||||
@$(COMPILE)
|
||||
|
||||
@@ -197,11 +171,6 @@ lib/soft-float/%.o : AFLAGS += $(SOFTFLOAT)
|
||||
lib/soft-float/%.o : %.S
|
||||
@$(ASSEMBLE)
|
||||
|
||||
lib/soft-float/crtbegin.o : CFLAGS += $(SOFTFLOAT) $(NO_AGGRESSIVE_LOOP_OPTIMIZATIONS)
|
||||
lib/soft-float/crtbegin.o : crtbegin.c
|
||||
@$(COMPILE)
|
||||
|
||||
lib/soft-float/%.o : CFLAGS += $(SOFTFLOAT)
|
||||
lib/soft-float/%.o : %.c
|
||||
@$(COMPILE)
|
||||
|
||||
@@ -209,11 +178,6 @@ lib/baserel/%.o : AFLAGS += $(BASEREL)
|
||||
lib/baserel/%.o : %.S
|
||||
@$(ASSEMBLE)
|
||||
|
||||
lib/baserel/crtbegin.o : CFLAGS += $(BASEREL) $(NO_AGGRESSIVE_LOOP_OPTIMIZATIONS)
|
||||
lib/baserel/crtbegin.o : crtbegin.c
|
||||
@$(COMPILE)
|
||||
|
||||
lib/baserel/%.o : CFLAGS += $(BASEREL)
|
||||
lib/baserel/%.o : %.c
|
||||
@$(COMPILE)
|
||||
|
||||
@@ -221,11 +185,6 @@ lib.threadsafe/%.o : AFLAGS += $(LARGEDATA) $(THREADSAFE)
|
||||
lib.threadsafe/%.o : %.S
|
||||
@$(ASSEMBLE)
|
||||
|
||||
lib.threadsafe/crtbegin.o : CFLAGS += $(THREADSAFE) $(LARGEDATA) $(NO_AGGRESSIVE_LOOP_OPTIMIZATIONS)
|
||||
lib.threadsafe/crtbegin.o : crtbegin.c
|
||||
@$(COMPILE)
|
||||
|
||||
lib.threadsafe/%.o : CFLAGS += $(THREADSAFE) $(LARGEDATA)
|
||||
lib.threadsafe/%.o : %.c
|
||||
@$(COMPILE)
|
||||
|
||||
@@ -233,11 +192,6 @@ lib.threadsafe/small-data/%.o : AFLAGS += $(SMALLDATA) $(THREADSAFE)
|
||||
lib.threadsafe/small-data/%.o : %.S
|
||||
@$(ASSEMBLE)
|
||||
|
||||
lib.threadsafe/small-data/crtbegin.o : CFLAGS += $(THREADSAFE) $(SMALLDATA) $(NO_AGGRESSIVE_LOOP_OPTIMIZATIONS)
|
||||
lib.threadsafe/small-data/crtbegin.o : crtbegin.c
|
||||
@$(COMPILE)
|
||||
|
||||
lib.threadsafe/small-data/%.o : CFLAGS += $(THREADSAFE) $(SMALLDATA)
|
||||
lib.threadsafe/small-data/%.o : %.c
|
||||
@$(COMPILE)
|
||||
|
||||
@@ -245,11 +199,6 @@ lib.threadsafe/soft-float/%.o : AFLAGS += $(SOFTFLOAT) $(THREADSAFE)
|
||||
lib.threadsafe/soft-float/%.o : %.S
|
||||
@$(ASSEMBLE)
|
||||
|
||||
lib.threadsafe/soft-float/crtbegin.o : CFLAGS += $(THREADSAFE) $(SOFTFLOAT) $(NO_AGGRESSIVE_LOOP_OPTIMIZATIONS)
|
||||
lib.threadsafe/soft-float/crtbegin.o : crtbegin.c
|
||||
@$(COMPILE)
|
||||
|
||||
lib.threadsafe/soft-float/%.o : CFLAGS += $(THREADSAFE) $(SOFTFLOAT)
|
||||
lib.threadsafe/soft-float/%.o : %.c
|
||||
@$(COMPILE)
|
||||
|
||||
@@ -257,11 +206,6 @@ lib.threadsafe/baserel/%.o : AFLAGS += $(BASEREL) $(THREADSAFE)
|
||||
lib.threadsafe/baserel/%.o : %.S
|
||||
@$(ASSEMBLE)
|
||||
|
||||
lib.threadsafe/baserel/crtbegin.o : CFLAGS += $(THREADSAFE) $(BASEREL) $(NO_AGGRESSIVE_LOOP_OPTIMIZATIONS)
|
||||
lib.threadsafe/baserel/crtbegin.o : crtbegin.c
|
||||
@$(COMPILE)
|
||||
|
||||
lib.threadsafe/baserel/%.o : CFLAGS += $(THREADSAFE) $(BASEREL)
|
||||
lib.threadsafe/baserel/%.o : %.c
|
||||
@$(COMPILE)
|
||||
|
||||
@@ -270,17 +214,17 @@ lib.threadsafe/baserel/%.o : %.c
|
||||
define COMPILE
|
||||
-$(MAKEDIR) $(@D)
|
||||
echo "Compiling $< [$(@D)]"
|
||||
$(CC) $(CFLAGS) -o $@ -c $< $(LOG_COMMAND)
|
||||
$(CC) -o $@ -c $(CFLAGS) $< $(LOG_COMMAND)
|
||||
endef
|
||||
|
||||
define ASSEMBLE
|
||||
-$(MAKEDIR) $(@D)
|
||||
echo "Assembling $< [$(@D)]"
|
||||
$(CC) $(AFLAGS) -o $@ -c $< $(LOG_COMMAND)
|
||||
$(CC) -o $@ -c $(AFLAGS) $< $(LOG_COMMAND)
|
||||
endef
|
||||
|
||||
define MAKELIB
|
||||
-$(MAKEDIR) $(@D)
|
||||
-$(MAKEDIR) $@
|
||||
$(DELETE) $@
|
||||
echo "Making $@"
|
||||
$(AR) $@ $^ $(LOG_COMMAND)
|
||||
|
||||
0
library/TODO
Normal file → Executable file
0
library/TODO
Normal file → Executable file
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define VERSION 1
|
||||
#define REVISION 216
|
||||
#define DATE "10.7.2025"
|
||||
#define VERS "amiga.lib 1.216"
|
||||
#define VSTRING "amiga.lib 1.216 (10.7.2025)\r\n"
|
||||
#define VERSTAG "\0$VER: amiga.lib 1.216 (10.7.2025)"
|
||||
#define REVISION 203
|
||||
#define DATE "28.4.2008"
|
||||
#define VERS "amiga.lib 1.203"
|
||||
#define VSTRING "amiga.lib 1.203 (28.4.2008)\r\n"
|
||||
#define VERSTAG "\0$VER: amiga.lib 1.203 (28.4.2008)"
|
||||
|
||||
@@ -1 +1 @@
|
||||
216
|
||||
203
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/*
|
||||
* $Id: amiga_argarrayinit.c,v 1.7 2008-09-30 14:09:00 obarthel Exp $
|
||||
* $Id: amiga_argarrayinit.c,v 1.6 2006-09-22 09:02:51 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -52,14 +52,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __amigaos4__
|
||||
#define MEMORY_TYPE MEMF_PRIVATE
|
||||
#else
|
||||
#define MEMORY_TYPE MEMF_ANY
|
||||
#endif /* __amigaos4__ */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
const unsigned char ** CXLIB_argarray;
|
||||
|
||||
struct DiskObject * CXLIB_disko;
|
||||
@@ -78,7 +70,7 @@ ArgArrayInit(LONG argc, CONST_STRPTR * argv)
|
||||
if(argc == 1)
|
||||
goto out; /* skip command name */
|
||||
|
||||
CXLIB_argarray = (const unsigned char **)AllocVec(sizeof(char *) * argc,MEMORY_TYPE|MEMF_CLEAR);
|
||||
CXLIB_argarray = (const unsigned char **)AllocVec(sizeof(char *) * argc,MEMF_ANY|MEMF_CLEAR);
|
||||
if(CXLIB_argarray == NULL)
|
||||
goto out;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=8
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -79,8 +79,6 @@ DoTimer(struct timeval *tv,LONG unit,LONG command)
|
||||
struct MsgPort * mp;
|
||||
LONG error;
|
||||
|
||||
PROFILE_OFF();
|
||||
|
||||
assert( tv != NULL );
|
||||
|
||||
#if defined(__amigaos4__)
|
||||
@@ -131,10 +129,14 @@ DoTimer(struct timeval *tv,LONG unit,LONG command)
|
||||
tr->tr_time.tv_secs = tv->tv_secs;
|
||||
tr->tr_time.tv_micro = tv->tv_micro;
|
||||
|
||||
PROFILE_OFF();
|
||||
|
||||
SetSignal(0,(1UL << mp->mp_SigBit));
|
||||
|
||||
error = DoIO((struct IORequest *)tr);
|
||||
|
||||
PROFILE_ON();
|
||||
|
||||
tv->tv_secs = tr->tr_time.tv_secs;
|
||||
tv->tv_micro = tr->tr_time.tv_micro;
|
||||
|
||||
@@ -159,7 +161,5 @@ DoTimer(struct timeval *tv,LONG unit,LONG command)
|
||||
}
|
||||
#endif /* __amigaos4__ */
|
||||
|
||||
PROFILE_ON();
|
||||
|
||||
return(error);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=8
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,562 +0,0 @@
|
||||
/*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2021 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <exec/memory.h>
|
||||
#include <exec/alerts.h>
|
||||
#include <exec/lists.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <proto/exec.h>
|
||||
#include <clib/alib_protos.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* This signature identifies a large allocation on the list
|
||||
* which contains both puddles and such large memory allocations.
|
||||
*/
|
||||
#define IS_LARGE_ALLOCATION 0
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* A private memory pool, as used by this implementation of the
|
||||
* pool memory management functions.
|
||||
*/
|
||||
struct MemoryPool
|
||||
{
|
||||
struct MinList mp_PuddleMinList; /* Both puddles and large allocations
|
||||
* are stored in this list. The puddles
|
||||
* are stored near the head of the list
|
||||
* and the large allocations are stored
|
||||
* near the tail of the list.
|
||||
*/
|
||||
|
||||
ULONG mp_MemoryFlags; /* Memory attributes for allocation,
|
||||
* which may also include MEMF_CLEAR.
|
||||
*/
|
||||
ULONG mp_PuddleSize; /* Largest allocation which will fit
|
||||
* into a single puddle.
|
||||
*/
|
||||
ULONG mp_PuddleSizeThreshold; /* Allocations which exceed this size
|
||||
* will be allocated separately and not
|
||||
* make use of the puddles.
|
||||
*/
|
||||
};
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The management data structure associated with a separate large memory
|
||||
* allocation. This is distinct from the puddles.
|
||||
*/
|
||||
struct LargeAllocation
|
||||
{
|
||||
struct MinNode la_MinNode;
|
||||
|
||||
ULONG la_Signature; /* Must be set to IS_LARGE_ALLOCATION */
|
||||
};
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* This combines a plain Node, a MemHeader and a LargeAllocation. They
|
||||
* all overlap to some degree. The "puddle" is really a MemHeader from
|
||||
* which the individual memory allocations are made.
|
||||
*
|
||||
* For reference, here is how the individual data structures look like.
|
||||
* The 'struct MinNode' is used by the 'struct LargeAllocation' and you
|
||||
* can see that the LargeAllocation.la_Signature overlaps the
|
||||
* Node.ln_Type and Node.ln_Pri fields. The 'struct MemHeader' begins
|
||||
* with a 'struct Node' and is initialized so that the Node.ln_Type and
|
||||
* Node.ln_Pri are never zero. This is why LargeAllocation.la_Signature
|
||||
* being zero is key to identifying large allocations which along with
|
||||
* the MemHeaders share the same storage list.
|
||||
*
|
||||
* struct MinNode {
|
||||
* struct MinNode * mln_Succ;
|
||||
* struct MinNode * mln_Pred;
|
||||
* };
|
||||
*
|
||||
* struct LargeAllocation {
|
||||
* struct MinNode la_MinNode;
|
||||
* ULONG la_Signature;
|
||||
* };
|
||||
*
|
||||
* struct Node {
|
||||
* struct Node * ln_Succ;
|
||||
* struct Node * ln_Pred;
|
||||
* UBYTE ln_Type;
|
||||
* BYTE ln_Pri;
|
||||
* char * ln_Name;
|
||||
* };
|
||||
*
|
||||
* struct MemHeader {
|
||||
* struct Node mh_Node;
|
||||
* UWORD mh_Attributes;
|
||||
* struct MemChunk * mh_First;
|
||||
* APTR mh_Lower;
|
||||
* APTR mh_Upper;
|
||||
* ULONG mh_Free;
|
||||
* };
|
||||
*/
|
||||
union PuddleUnion
|
||||
{
|
||||
struct Node pu_Node;
|
||||
struct MemHeader pu_MemHeader;
|
||||
struct LargeAllocation pu_LargeAllocation;
|
||||
};
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Our local Kickstart 1.x compatible implementation of FreeVec(). */
|
||||
static VOID free_vec(APTR allocation)
|
||||
{
|
||||
if (allocation != NULL)
|
||||
{
|
||||
ULONG * mem = allocation;
|
||||
|
||||
FreeMem(&mem[-1], mem[-1]);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Our local Kickstart 1.x compatible implementation of AllocVec(). */
|
||||
static APTR alloc_vec(ULONG size, ULONG flags)
|
||||
{
|
||||
ULONG * mem = NULL;
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
/* Note: no overflow testing is being performed! */
|
||||
size += sizeof(*mem);
|
||||
|
||||
mem = AllocMem(size, flags);
|
||||
if (mem != NULL)
|
||||
(*mem++) = size;
|
||||
}
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
VOID LibDeletePool(APTR pool)
|
||||
{
|
||||
/* If possible, use the operating system implementation
|
||||
* instead of this reimplementation.
|
||||
*/
|
||||
#if ! defined(__amigaos4__)
|
||||
if (SysBase->LibNode.lib_Version >= 39)
|
||||
{
|
||||
DeletePool(pool);
|
||||
return;
|
||||
}
|
||||
#endif /* ! defined(__amigaos4__) */
|
||||
|
||||
if (pool != NULL)
|
||||
{
|
||||
struct MemoryPool * mp = pool;
|
||||
struct MinNode * mln_next;
|
||||
struct MinNode * mln;
|
||||
|
||||
for (mln = mp->mp_PuddleMinList.mlh_Head ;
|
||||
mln->mln_Succ != NULL ;
|
||||
mln = mln_next)
|
||||
{
|
||||
mln_next = mln->mln_Succ;
|
||||
|
||||
free_vec(mln);
|
||||
}
|
||||
|
||||
FreeMem(mp, sizeof(*mp));
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Note: puddle size should not be 0 or every single memory allocation
|
||||
* will result in an AllocVec() call.
|
||||
*/
|
||||
APTR LibCreatePool(
|
||||
ULONG memory_flags,
|
||||
ULONG puddle_size,
|
||||
ULONG threshold_size)
|
||||
{
|
||||
struct MemoryPool * mp = NULL;
|
||||
APTR result = NULL;
|
||||
|
||||
/* If possible, use the operating system implementation
|
||||
* instead of this reimplementation.
|
||||
*/
|
||||
#if ! defined(__amigaos4__)
|
||||
if (SysBase->LibNode.lib_Version >= 39)
|
||||
{
|
||||
return CreatePool(memory_flags, puddle_size, threshold_size);
|
||||
}
|
||||
#endif /* ! defined(__amigaos4__) */
|
||||
|
||||
/* The threshold size must be less than or equal
|
||||
* to the puddle size.
|
||||
*/
|
||||
if (threshold_size > puddle_size)
|
||||
goto out;
|
||||
|
||||
/* Round up the puddle size to the size of a
|
||||
* memory block, as managed by Allocate().
|
||||
*
|
||||
* Note: no overflow checking is performed!
|
||||
*/
|
||||
puddle_size = (puddle_size + MEM_BLOCKMASK) & ~MEM_BLOCKMASK;
|
||||
|
||||
mp = AllocMem(sizeof(*mp), MEMF_ANY);
|
||||
if (mp == NULL)
|
||||
goto out;
|
||||
|
||||
NewList((struct List *)&mp->mp_PuddleMinList);
|
||||
|
||||
mp->mp_MemoryFlags = memory_flags;
|
||||
mp->mp_PuddleSize = puddle_size;
|
||||
mp->mp_PuddleSizeThreshold = threshold_size;
|
||||
|
||||
result = mp;
|
||||
mp = NULL;
|
||||
|
||||
out:
|
||||
|
||||
if (mp != NULL)
|
||||
LibDeletePool(mp);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Creates a new puddle from which memory allocations up to a certain size
|
||||
* will be made. Returns the new puddle or NULL for failure.
|
||||
*
|
||||
* Note: No overflow testing is performed when allocating the puddle.
|
||||
*/
|
||||
static union PuddleUnion * create_new_puddle(struct MemoryPool * mp)
|
||||
{
|
||||
ULONG memory_flags = mp->mp_MemoryFlags;
|
||||
ULONG puddle_size = mp->mp_PuddleSize;
|
||||
union PuddleUnion * result = NULL;
|
||||
union PuddleUnion * pu;
|
||||
struct MemHeader * mh;
|
||||
struct MemChunk * mc;
|
||||
|
||||
/* The extra sizeof(APTR) is needed for aligning the
|
||||
* allocatable memory chunks within the memory header.
|
||||
*
|
||||
* Note: no overflow checking is performed!
|
||||
*
|
||||
* Also note that the original memory allocation flags are
|
||||
* being used, which may include MEMF_CLEAR. This means that
|
||||
* if MEMF_CLEAR is set, the initial allocation will be
|
||||
* cleared and then the individual puddle allocations made
|
||||
* through LibAllocPooled() will be cleared, too.
|
||||
*/
|
||||
pu = alloc_vec(sizeof(pu->pu_MemHeader) + sizeof(LONG) + puddle_size, memory_flags);
|
||||
if (pu == NULL)
|
||||
goto out;
|
||||
|
||||
mh = &pu->pu_MemHeader;
|
||||
|
||||
/* The first allocatable memory chunk follows the memory header
|
||||
* and must be aligned to a 64 bit address. This happens to be
|
||||
* the smallest allocatable memory unit (MEM_BLOCKSIZE == 8).
|
||||
*/
|
||||
mc = (struct MemChunk *)(((ULONG)&mh[1] + sizeof(LONG)) & ~MEM_BLOCKMASK);
|
||||
|
||||
mc->mc_Next = NULL;
|
||||
mc->mc_Bytes = puddle_size;
|
||||
|
||||
/* Both ln_Type and ln_Pri must be non-zero! This allows them to
|
||||
* be identified as small puddles as compared to the large puddles
|
||||
* which have the la_Signature member set to IS_LARGE_ALLOCATION.
|
||||
* The 'struct Node' which introduces the 'struct MemHeader'
|
||||
* overlaps the 'struct LargeAllocation' in the Node.ln_Type/ln_Pri
|
||||
* fields. This is why the test for la_Signature == IS_LARGE_ALLOCATION
|
||||
* works.
|
||||
*/
|
||||
mh->mh_Node.ln_Type = NT_MEMORY;
|
||||
mh->mh_Node.ln_Pri = mh->mh_Node.ln_Type;
|
||||
|
||||
mh->mh_Node.ln_Name = (char *)&"\0Pool"[1]; /* The memory name must be an odd address. */
|
||||
mh->mh_Attributes = memory_flags;
|
||||
mh->mh_First = mc;
|
||||
mh->mh_Lower = mc;
|
||||
mh->mh_Upper = &((BYTE *)mc)[puddle_size];
|
||||
mh->mh_Free = puddle_size;
|
||||
|
||||
/* Puddles are always added at the head of the list. */
|
||||
AddHead((struct List *)&mp->mp_PuddleMinList, &pu->pu_Node);
|
||||
|
||||
result = pu;
|
||||
|
||||
out:
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Note: No overflow testing is performed when making a large allocation. */
|
||||
APTR LibAllocPooled(APTR pool, ULONG mem_size)
|
||||
{
|
||||
struct MemoryPool * mp;
|
||||
union PuddleUnion * pu;
|
||||
APTR result = NULL;
|
||||
|
||||
/* If possible, use the operating system implementation
|
||||
* instead of this reimplementation.
|
||||
*/
|
||||
#if ! defined(__amigaos4__)
|
||||
if (SysBase->LibNode.lib_Version >= 39)
|
||||
{
|
||||
return AllocPooled(pool, mem_size);
|
||||
}
|
||||
#endif /* ! defined(__amigaos4__) */
|
||||
|
||||
/* No pool or no memory to allocate? */
|
||||
if (pool == NULL || mem_size == 0)
|
||||
goto out;
|
||||
|
||||
mp = pool;
|
||||
|
||||
/* Requested allocation size is still within the threshold limit? */
|
||||
if (mem_size <= mp->mp_PuddleSizeThreshold)
|
||||
{
|
||||
/* Search for the first puddle from which memory may be
|
||||
* allocated. If no such puddle exists, it will have
|
||||
* to be created. Instead of puddles we might end up
|
||||
* finding a large memory allocation instead. This is
|
||||
* also an indication that a new puddle will have to
|
||||
* be created.
|
||||
*/
|
||||
pu = (union PuddleUnion *)mp->mp_PuddleMinList.mlh_Head;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
/* We just reached the end of the puddle list or this
|
||||
* is a large allocation? We can't use an existing puddle to
|
||||
* allocate memory, so we have to make a new one.
|
||||
*/
|
||||
if (pu->pu_Node.ln_Succ == NULL || pu->pu_LargeAllocation.la_Signature == IS_LARGE_ALLOCATION)
|
||||
{
|
||||
/* We need to create another puddle, which is added to
|
||||
* the head of the list. Then the search for allocatable
|
||||
* memory in the puddle list will resume there.
|
||||
*/
|
||||
pu = create_new_puddle(mp);
|
||||
if (pu == NULL)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Try to allocate memory from this puddle.*/
|
||||
result = Allocate(&pu->pu_MemHeader, mem_size);
|
||||
if (result != NULL)
|
||||
{
|
||||
/* If the allocation needs to be zeroed, clear
|
||||
* the entire allocated memory which Allocate()
|
||||
* returned. It's been rounded up to be a
|
||||
* multiple of MEM_BLOCKSIZE.
|
||||
*
|
||||
* Note that the puddle will have been allocated
|
||||
* with MEMF_CLEAR already, which does not render
|
||||
* the following memset() call redundant, but
|
||||
* making the initial puddle allocation use
|
||||
* MEMF_CLEAR is definitely redundant.
|
||||
*/
|
||||
if ((mp->mp_MemoryFlags & MEMF_CLEAR) != 0)
|
||||
memset(result, 0, (mem_size + MEM_BLOCKMASK) & ~MEM_BLOCKMASK);
|
||||
|
||||
/* And we're good. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Try the next puddle on the list. */
|
||||
pu = (union PuddleUnion *)pu->pu_Node.ln_Succ;
|
||||
}
|
||||
}
|
||||
/* No, we need to allocate this memory chunk separately. */
|
||||
else
|
||||
{
|
||||
struct LargeAllocation * la;
|
||||
|
||||
/* Note: no overflow checking is performed! */
|
||||
pu = alloc_vec(sizeof(pu->pu_LargeAllocation) + mem_size, mp->mp_MemoryFlags);
|
||||
if (pu == NULL)
|
||||
goto out;
|
||||
|
||||
/* This identifies it as a separate large allocation. */
|
||||
pu->pu_LargeAllocation.la_Signature = IS_LARGE_ALLOCATION;
|
||||
|
||||
/* The separate large allocations are stored near the end
|
||||
* of the list. The puddles are always stored at the beginning
|
||||
* of the list.
|
||||
*/
|
||||
AddTail((struct List *)&mp->mp_PuddleMinList, &pu->pu_Node);
|
||||
|
||||
la = &pu->pu_LargeAllocation;
|
||||
|
||||
result = &la[1];
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Note: The size of the allocation to free must match
|
||||
* exactly or memory will remain unfreed. Furthermore,
|
||||
* the wrong allocation size may lead to general
|
||||
* memory corruption.
|
||||
*/
|
||||
VOID LibFreePooled(APTR pool, APTR memory, ULONG size)
|
||||
{
|
||||
/* If possible, use the operating system implementation
|
||||
* instead of this reimplementation.
|
||||
*/
|
||||
#if ! defined(__amigaos4__)
|
||||
if (SysBase->LibNode.lib_Version >= 39)
|
||||
{
|
||||
FreePooled(pool, memory, size);
|
||||
return;
|
||||
}
|
||||
#endif /* ! defined(__amigaos4__) */
|
||||
|
||||
if (pool != NULL && memory != NULL)
|
||||
{
|
||||
struct MemoryPool * mp = pool;
|
||||
|
||||
/* This allocation was made from a puddle? */
|
||||
if (size <= mp->mp_PuddleSizeThreshold)
|
||||
{
|
||||
union PuddleUnion * pu_deallocation = NULL;
|
||||
union PuddleUnion * pu;
|
||||
|
||||
/* Try to find the puddle which contains this
|
||||
* allocation.
|
||||
*/
|
||||
for (pu = (union PuddleUnion *)mp->mp_PuddleMinList.mlh_Head ;
|
||||
pu->pu_Node.ln_Succ != NULL ;
|
||||
pu = (union PuddleUnion *)pu->pu_Node.ln_Succ)
|
||||
{
|
||||
/* Did we reach the end of the puddle list? Then
|
||||
* the given memory address and/or size may be
|
||||
* invalid...
|
||||
*/
|
||||
if (pu->pu_LargeAllocation.la_Signature == IS_LARGE_ALLOCATION)
|
||||
break;
|
||||
|
||||
/* Is this the memory header which contains the
|
||||
* memory allocation?
|
||||
*/
|
||||
if (pu->pu_MemHeader.mh_Lower <= memory && memory < pu->pu_MemHeader.mh_Upper)
|
||||
{
|
||||
/* Free the allocation and remember where it
|
||||
* came from. We will make use of this below to
|
||||
* free now unused puddles.
|
||||
*/
|
||||
Deallocate(&pu->pu_MemHeader, memory, size);
|
||||
|
||||
pu_deallocation = pu;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Did we succeed in releasing this memory allocation? */
|
||||
if (pu_deallocation != NULL)
|
||||
{
|
||||
APTR upper;
|
||||
|
||||
/* The more frequently memory is freed from a
|
||||
* specific puddle, the easier it should become
|
||||
* to find it on the list again. We try to move it
|
||||
* closer to the beginning of the list unless it
|
||||
* is already at the head of the list.
|
||||
*/
|
||||
if (mp->mp_PuddleMinList.mlh_Head != (struct MinNode *)pu)
|
||||
{
|
||||
/* This puddle precedes the one from which we
|
||||
* just released an allocation.
|
||||
*/
|
||||
struct Node * pred = pu->pu_Node.ln_Pred;
|
||||
struct Node * before;
|
||||
|
||||
/* Put this puddle at the head of the list? */
|
||||
if (pred == (struct Node *)mp->mp_PuddleMinList.mlh_Head)
|
||||
before = NULL;
|
||||
/* No, insert it in front of its predecessor. */
|
||||
else
|
||||
before = pred->ln_Pred;
|
||||
|
||||
Remove(&pu->pu_Node);
|
||||
Insert((struct List *)&mp->mp_PuddleMinList, &pu->pu_Node, before);
|
||||
}
|
||||
|
||||
/* Has this puddle been emptied? */
|
||||
upper = &((BYTE *)pu->pu_MemHeader.mh_Lower)[pu->pu_MemHeader.mh_Free];
|
||||
if (upper == pu->pu_MemHeader.mh_Upper)
|
||||
{
|
||||
/* Then we may remove and free it now. */
|
||||
Remove(&pu->pu_Node);
|
||||
|
||||
free_vec(pu);
|
||||
}
|
||||
}
|
||||
/* Something's wrong :-( */
|
||||
else
|
||||
{
|
||||
Alert(AN_BadFreeAddr);
|
||||
}
|
||||
}
|
||||
/* No, this is a large allocation which must be freed as it is. */
|
||||
else
|
||||
{
|
||||
struct LargeAllocation * la = &((struct LargeAllocation *)memory)[-1];
|
||||
|
||||
Remove((struct Node *)&la->la_MinNode);
|
||||
|
||||
free_vec(la);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -262,8 +262,9 @@ STATIC VOID
|
||||
_SetValue(struct Environment * env,struct NexxStr * value,struct Node * symbol_table_node)
|
||||
{
|
||||
STATIC CONST UWORD code[] = { 0x4EAE,0xFFAC,0x4E75 }; /* jsr -84(a6) ; rts */
|
||||
struct Node * result;
|
||||
|
||||
EmulateTags(code,
|
||||
result = (struct Node *)EmulateTags(code,
|
||||
ET_RegisterA0,env,
|
||||
ET_RegisterA1,value,
|
||||
ET_RegisterD0,symbol_table_node,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -13,9 +13,9 @@ rm -rf $dir_name
|
||||
# Create the directory, copy all the libraries, header files
|
||||
# and release note files inside.
|
||||
mkdir $dir_name
|
||||
cp -pR lib $dir_name
|
||||
cp -pR lib.threadsafe $dir_name
|
||||
cp -pR include $dir_name
|
||||
cp -a lib $dir_name
|
||||
cp -a lib.threadsafe $dir_name
|
||||
cp -a include $dir_name
|
||||
cp changes $dir_name
|
||||
|
||||
# Delete the CVS data from the include directory
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define VERSION 1
|
||||
#define REVISION 217
|
||||
#define DATE "10.7.2025"
|
||||
#define VERS "c.lib 1.217"
|
||||
#define VSTRING "c.lib 1.217 (10.7.2025)\r\n"
|
||||
#define VERSTAG "\0$VER: c.lib 1.217 (10.7.2025)"
|
||||
#define REVISION 203
|
||||
#define DATE "28.4.2008"
|
||||
#define VERS "c.lib 1.203"
|
||||
#define VSTRING "c.lib 1.203 (28.4.2008)\r\n"
|
||||
#define VERSTAG "\0$VER: c.lib 1.203 (28.4.2008)"
|
||||
|
||||
@@ -1 +1 @@
|
||||
217
|
||||
203
|
||||
|
||||
369
library/changes
369
library/changes
@@ -1,370 +1,3 @@
|
||||
c.lib 1.217 (10.7.2025)
|
||||
|
||||
- Added support for handling path names that exceed 255 characters in
|
||||
the AmigaOS 2.x/3.x build. This feature works by replacing calls to the
|
||||
CreateDir(), DeleteFile(), Lock(), MakeLink(), Open(), Rename(),
|
||||
SetComment(), SetFileDate(), SetOwner() and SetProtection() functions
|
||||
with a call to a front-end which breaks down long path names into
|
||||
the individual path components. This is a compile-time option which
|
||||
is enabled through the "library/stdio_long_path.h" header file.
|
||||
|
||||
Note that this feature is by default disabled for AmigaOS 4 because
|
||||
its dos.library already transparently performs the long path
|
||||
processing.
|
||||
|
||||
- The raise() function no longer directly calls abort() because that
|
||||
function in turn would have invoked raise(SIGABRT), triggering an
|
||||
infinite loop. Instead, raise() now invokes the __abort() function
|
||||
which abort() would have called via raise(SIGABRT).
|
||||
|
||||
- fgets() no longer leverages the __getc() macro, which in the
|
||||
original implementation added excessive overhead for even small
|
||||
read operations. Instead, fgets() now focuses on copying data
|
||||
stored in the FILE read buffer, transferring the buffered data
|
||||
in bulk, if possible. The same kind of changes are present in
|
||||
the gets() function.
|
||||
|
||||
- fputs() and puts() no longer leverage the __putc() macro. As with
|
||||
the fgets() implementation, the focus is now on enabling bulk
|
||||
data transfer, eliminating the __putc() macro overhead. For line
|
||||
buffered output, both fputs() and puts() will check if the text
|
||||
ends with a line feed and, if so, will output everything up to
|
||||
and including the line feed. If enabled, Ctrl+C checking will
|
||||
occur for every single line written.
|
||||
|
||||
- fread() and fwrite() no longer leverage the __getc() and
|
||||
__putc() macros. Their focus is on enabling bulk data transfer
|
||||
instead.
|
||||
|
||||
- The setvbuf() function now correctly sets the buffer size to the
|
||||
value of BUFSIZ if a buffer size of 0 is specified. Previously,
|
||||
setvbuf() would have disabled buffering for the FILE instead (this
|
||||
was a bug).
|
||||
|
||||
Failure to allocate a buffer of the specified non-zero size is
|
||||
now caught and results in the setvbuf() function to indicate
|
||||
failure, setting the errno variable to ENOBUFS.
|
||||
|
||||
- The alloca() library function (which is a built-in function for
|
||||
gcc, for example) now calls abort() rather than returning NULL.
|
||||
|
||||
- Changed the numeric overflow check which the calloc() function
|
||||
uses, simplifying it.
|
||||
|
||||
- The memory management debugging code in stdlib_free.c is no longer
|
||||
reusing the allocation size value to indicate that an allocation
|
||||
should never be freed. This indication is now stored in a separate
|
||||
flags field.
|
||||
|
||||
- The memory debugging code in malloc() now checks if the combined
|
||||
size of the management data structures and front/back padding
|
||||
stay within the bounds of a 32 bit integer.
|
||||
|
||||
The list of memory nodes to be freed is now initialized first.
|
||||
Previously, the list would be left uninitialized if the attempt to
|
||||
allocate memory for memory arbitration semaphore had failed.
|
||||
|
||||
- The realloc() function now obtains the original size of the
|
||||
allocation from a dedicated field of the data structure which
|
||||
precedes the allocation, whose purpose is to track the
|
||||
allocation until it is freed. Previously, obtaining the relevant
|
||||
allocation size information was encapsulated by a "clever"
|
||||
macro.
|
||||
|
||||
With memory debugging enabled, the stored allocation size no
|
||||
longer says how much memory, padding included, is being used.
|
||||
Instead, the requested allocation size is stored unchanged, with
|
||||
the total allocation size derived from this number. The idea is
|
||||
to make it harder to mistake the original allocation size for
|
||||
the padded one and vice versa.
|
||||
|
||||
- The use of the optional slab allocator now has to be deliberately
|
||||
enabled in the "library/stdlib_memory.h" header file.
|
||||
|
||||
- The minimum size of an allocation managed by the optional slab
|
||||
allocator is now 16 bytes instead of 8 because the management
|
||||
data structure for each allocation now includes a flags field.
|
||||
|
||||
- The minimum size of a slab is now 4096 bytes.
|
||||
|
||||
- The optional slab allocator now checks for integer overflows when
|
||||
processing allocation requests, taking into account the size of
|
||||
the actual allocation, including padding. The task of figuring
|
||||
out how much padding is needed now rests in a function which
|
||||
calculates the total overhead.
|
||||
|
||||
- The usleep() function now correctly returns 0 and the function
|
||||
prototype reflects this, too. Thanks go to capehill who raised
|
||||
this issue.
|
||||
|
||||
- The "struct dirent" which is used by the readdir() function now
|
||||
features a "d_type" member which indicates the kind of directory
|
||||
entry the respective entry represents. For the time being,
|
||||
the type can be one of DT_DIR (directory, or hard link to a
|
||||
directory), DT_REG (file, or hard link to a file) or DT_LINK (soft
|
||||
link). How do you know if the "d_type" member is available?
|
||||
Check if the _DIRENT_HAVE_D_TYPE macro is defined. If it is, then
|
||||
you can make use of the "d_type" member.
|
||||
|
||||
- Implemented the fixes for the tgamma() and tgammaf() functions
|
||||
which were prompted by sodero. Thank you very much!
|
||||
|
||||
- The sqrt() function now returns a plain NAN if the function
|
||||
parameter is < 0. Thanks go to sodero for providing the fix.
|
||||
|
||||
- The definition of "locale_t" is now based upon an incomplete
|
||||
structure, with locale_t being a pointer to it. This change was
|
||||
was provided by sacredbanana. Thank you very much!
|
||||
|
||||
|
||||
amiga.lib 1.216 (10.7.2025)
|
||||
|
||||
- Added a 'C' implementation of the pools.lib functions which were
|
||||
merged with the Kickstart/Workbench 3.0 era amiga.lib. This
|
||||
implementation provides the LibDeletePool(), LibCreatePool(),
|
||||
LibAllocPooled() and LibFreePooled() functions which had not
|
||||
been available before in clib2.
|
||||
|
||||
Please note that these functions are largely obsolete and only
|
||||
helpful for code which must run on Kickstart 2.04. The current
|
||||
implementation performs no error checking for integer overflows,
|
||||
just like the original pools.lib implementation.
|
||||
|
||||
|
||||
c.lib 1.216 (xxx)
|
||||
|
||||
- Add some wchar and multibyte-string related functions to allow gcc
|
||||
building a libstdc++ library with wide char support. For now, the
|
||||
functions are mostly stub ones only. They can be implemented on
|
||||
demand.
|
||||
|
||||
|
||||
c.lib 1.215 (26.6.2017)
|
||||
|
||||
- Added -fno-aggressive-loop-optimizations option when building crtbegin.c
|
||||
to work around constructor/destructor hack with GCC 5.4.0 on AmigaOS 4.
|
||||
|
||||
- Added -fno-builtin option to fix conflicts with builtin memset()
|
||||
with GCC 5.4.0 on AmigaOS 4.
|
||||
|
||||
|
||||
c.lib 1.214 (27.4.2017)
|
||||
|
||||
- Added integer overflow test to calloc().
|
||||
|
||||
- Tiny change in getopt_long() so that the value pointed to by longindex
|
||||
is always initialized to an invalid index position (that being -1),
|
||||
instead of 0. The value of 0 can break some shell commands, most notably
|
||||
GNU wget.
|
||||
|
||||
|
||||
c.lib 1.213 (4.12.2016)
|
||||
|
||||
- Added the __decay_unused_slabs() function which brings all currently
|
||||
empty slabs which are still protected from reuse closer to getting
|
||||
reused or released.
|
||||
|
||||
- The slab-test program now exercises the memory allocation functions
|
||||
to a greater degree. Memory is allocated in random chunk sizes,
|
||||
the allocations are resized (to other random chunk sizes),
|
||||
33% of all allocations are randomly freed, empty slabs readied for
|
||||
reuse then discarded. The output in JSON format now shows a bit
|
||||
more information as to what is being done.
|
||||
|
||||
- Rewrote __get_slab_stats() to use setjmp() and longjmp() in the
|
||||
print() callback invocation.
|
||||
|
||||
- __get_slab_stats() now reports how many times a slab was reused
|
||||
after having stuck around in the "empty slab" list.
|
||||
|
||||
- Changing the slab size through an environment variable is now
|
||||
a feature of the debug build.
|
||||
|
||||
- Small changes to allow the library to be built with SAS/C again.
|
||||
This includes adding code to disable/re-enable profiling,
|
||||
fixing "stdlib_profile.h" and updating the smakefiles.
|
||||
|
||||
- Still not sure what it does, but _CXV45 now sits along with _CX25
|
||||
and _CX35 in "sas_cxv.asm". "sas_cxv54.asm" is not needed any
|
||||
more.
|
||||
|
||||
- Found the last use of MEMF_PRIVATE which should have been compiled
|
||||
only for the OS4 version.
|
||||
|
||||
|
||||
c.lib 1.212 (27.11.2016)
|
||||
|
||||
- Unused slabs which get recycled are no longer reinitialized from
|
||||
scratch if their chunk size matches what the allocator needed.
|
||||
If the chunk size matches, the list of available chunks is
|
||||
left unchanged, and just the various counters are reset.
|
||||
|
||||
- Added __get_slab_stats() function.
|
||||
|
||||
- Added support for global __slab_purge_threshold tuning variable.
|
||||
|
||||
|
||||
c.lib 1.211 (23.11.2016)
|
||||
|
||||
- Added more consistency checking to the slab allocator, which is
|
||||
built if DEBUG is defined in "stdlib_slab.c".
|
||||
|
||||
- Memory allocations are no longer guaranteed to be aligned to
|
||||
64 bit word boundaries. In fact, this has not even worked
|
||||
reliably in the past 10 years.
|
||||
|
||||
- Memory allocation request sizes are now rounded to multiples of
|
||||
32 bit words (the size of an address pointer) instead to the
|
||||
size of a 64 bit word.
|
||||
|
||||
- Reduced the memory footprint of the memory allocation management
|
||||
data structures by reusing the most significant bit of the
|
||||
memory allocation size. This allows many more allocations to fit
|
||||
into the 32 byte chunk slabs, but limits the maximum memory
|
||||
allocation size to a little less than 2 GBytes.
|
||||
|
||||
- Added integer overflow checks to the memory management code.
|
||||
|
||||
- Reduced the memory management overhead further. This cuts an
|
||||
additional 8 bytes per allocation, unless neither the slab
|
||||
allocator nor memory pools are available. With this reduction
|
||||
the slab allocator is able to use 16 byte chunks, which cover
|
||||
memory allocation requests of 1..8 bytes.
|
||||
|
||||
- Fixed a bug caused by returning an allocation back to a slab
|
||||
which passed the wrong pointer.
|
||||
|
||||
|
||||
c.lib 1.210 (22.11.2016)
|
||||
|
||||
- Added __get_slab_allocations() function which will report information
|
||||
about each memory allocation made by the slab allocator which does
|
||||
not come from a slab.
|
||||
|
||||
- If the first slab in the list of slabs which share the same chunk
|
||||
size has no more room, it means that all other slabs following
|
||||
it have no room either. This speeds up the test to find a slab with
|
||||
free space, which can now abort and directly proceed to allocate
|
||||
memory for a new slab.
|
||||
|
||||
- If an empty slab's decay count hits zero, it is moved to the front
|
||||
of the empty slab list to be reclaimed more quickly.
|
||||
|
||||
- Allocations made from the slab now carry a pointer back to the
|
||||
slab which they are a part of. This speeds up deallocation but
|
||||
has the downside of making the smallest usable slab chunk size
|
||||
64 bytes, which is double what used to be the minimum before.
|
||||
|
||||
|
||||
c.lib 1.209 (21.11.2016)
|
||||
|
||||
- The maximum slab size is now 2^17 bytes (= 131072). If you request
|
||||
a slab size larger than this, you will get slab sizes of 131072
|
||||
bytes instead.
|
||||
|
||||
- Enabling the memory management debugging code no longer produces
|
||||
compiler errors.
|
||||
|
||||
|
||||
c.lib 1.208 (19.11.2016)
|
||||
|
||||
- Updated <stdlib.h> with new functions and data structures for
|
||||
use with the slab allocator.
|
||||
|
||||
- Added __get_slab_usage() function which can be used to query
|
||||
the slab allocator memory usage at runtime.
|
||||
|
||||
|
||||
c.lib 1.207 (18.11.2016)
|
||||
|
||||
- Added a slab allocator which replaces the use of memory pools or the
|
||||
plain AllocMem() operations, respectively. In order to activate the
|
||||
slab allocator, choose a slab size (e.g. 2048 bytes or 4096 bytes)
|
||||
and declare a global variable like this:
|
||||
|
||||
ULONG __slab_max_size = 2048;
|
||||
|
||||
Memory allocations smaller than the slab size will be made from
|
||||
"slabs", i.e. large chunks of memory of the given size. Larger
|
||||
allocations will be managed separately.
|
||||
|
||||
|
||||
m.lib 1.206 (24.4.2015)
|
||||
|
||||
- The fscanf() family failed to parse and convert %f parameters correctly
|
||||
if the respective number did not begin with a digit, but a decimal
|
||||
point. Hence ".7" would not be processed, but "0.7" would.
|
||||
|
||||
c.lib 1.206 (24.4.2015)
|
||||
|
||||
- Reworked the __putc() and putc() macros to reference the 'c' input
|
||||
parameter only once, and to be free of side-effects when tinkering
|
||||
with the buffer position.
|
||||
|
||||
- isatty() had the __fd_lock() call in the wrong place, which could have
|
||||
led to cleanup problems later.
|
||||
|
||||
- The close action in the stdio, socket and termios hook code now
|
||||
also zaps the fd pointer itself after cleaning up the file descriptor
|
||||
table entry.
|
||||
|
||||
- Removed the remains of all the stack extension and stack overflow/underflow
|
||||
checking code. It never actually worked. The bit that does work is the stack
|
||||
usage measurement code, plus the bit that sets up the custom stack
|
||||
according to local setting or by calling a query function.
|
||||
|
||||
|
||||
c.lib 1.205 (21.8.2010)
|
||||
|
||||
- Added dlclose(), dlerror(), dlopen() and dlsym() functions, which are
|
||||
available only under OS4. There is a variant of dlopen() in libunix.a
|
||||
which will perform a path name conversion. Note that these functions
|
||||
will not work in the thread-safe variant of the library because it
|
||||
would be unwise to tinker with the currently running program's binary.
|
||||
|
||||
- Added support for ELF shared objects and libraries. This is implemented through
|
||||
constructor/destructor functions, which means that you can use this
|
||||
functionality even in Amiga Exec style shared libraries, with the proper
|
||||
library initialization code to invoke the constructor/destructor functions
|
||||
for you.
|
||||
|
||||
- Updated uname() to recognize AmigaOS 4.1.
|
||||
|
||||
- The translation from Unix to Amiga path names did not properly process
|
||||
multiple occurences of "/./" in the path name. Thanks go to Steven Solie
|
||||
for finding the issue.
|
||||
|
||||
- The detection of "/./" and "/../" patterns in Unix path names to be
|
||||
translated into Amiga path names did not test if it was overrunning
|
||||
the end of the string.
|
||||
|
||||
- If strcmp(), strncmp() and memcmp() detect a pair of different
|
||||
characters, then the function result must be calculated as if the
|
||||
characters were of type "unsigned char". This is a requirement
|
||||
according to the ISO 'C' (1994) standard. Thanks go to Georg Steger
|
||||
for finding the issue.
|
||||
|
||||
- The definitions for INT_MIN, INT_MAX and UINT_MAX in <limits.h> no
|
||||
longer use long integer types, as prompted by Steven Solie.
|
||||
|
||||
|
||||
c.lib 1.204 (11.11.2008)
|
||||
|
||||
- The memory allocated by malloc() and friends is now of type MEMF_PRIVATE
|
||||
under OS4 and beyond. The AmigaOS 2.x/3.x compatible code will still
|
||||
use MEMF_ANY in the same situation, though. Other uses of MEMF_ANY have
|
||||
been replaced as well where MEMF_PRIVATE would have made better sense.
|
||||
|
||||
- I/O buffers allocated are now aligned according to the CPU cache line size,
|
||||
if the operating system can supply such detailed information.
|
||||
|
||||
- unsetenv() now returns a status value.
|
||||
|
||||
- Corrected the function prototype for wcspbrk().
|
||||
|
||||
- Added function prototypes for mbrtowc_l(), wcscoll_l(), wcscspn() and wcsrchr().
|
||||
|
||||
|
||||
c.lib 1.203 (28.4.2008)
|
||||
|
||||
- Added 68k stubs to amiga_rexxvars.c for the OS4 build to use. The new code now
|
||||
@@ -1488,7 +1121,7 @@ c.lib 1.187 (29.1.2005)
|
||||
adding/subtracting the local time zone.
|
||||
|
||||
- Changed the algorithm that calculates the number of days that have passed
|
||||
so far as used by the __convert_time() function and the conversion
|
||||
so far as used by the the __convert_time() function and the conversion
|
||||
code in strftime().
|
||||
|
||||
- Also changed the algorithm used by strftime() to produce the week numbers
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
2
library/complex_headers.h
Normal file → Executable file
2
library/complex_headers.h
Normal file → Executable file
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,34 +1,7 @@
|
||||
//
|
||||
// $Id: crt0.S,v 1.6 2005-10-11 09:28:29 obarthel Exp $
|
||||
// $Id: crt0.S,v 1.6 2005-10-11 09:28:29 obarthel Exp $
|
||||
//
|
||||
// :ts=4
|
||||
//
|
||||
// Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
// Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
// 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.
|
||||
// :ts=4
|
||||
//
|
||||
|
||||
.text
|
||||
|
||||
@@ -1,37 +1,9 @@
|
||||
/*
|
||||
* crtbegin.c
|
||||
/*
|
||||
* $Id: crtbegin.c,v 1.11 2006-09-22 09:02:51 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Handles global constructors and destructors for the OS4 GCC build.
|
||||
*
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* 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(__amigaos4__)
|
||||
@@ -48,12 +20,7 @@
|
||||
* Dummy constructor and destructor array. The linker script will put these at the
|
||||
* very beginning of section ".ctors" and ".dtors". crtend.o contains a similar entry
|
||||
* with a NULL pointer entry and is put at the end of the sections. This way, the init
|
||||
* code can find the global constructor/destructor pointers.
|
||||
*
|
||||
* WARNING:
|
||||
* This hack does not work correctly with GCC 5 and higher. The optimizer
|
||||
* will see a one element array and act appropriately. The current workaround
|
||||
* is to use -fno-aggressive-loop-optimizations when compiling this file.
|
||||
* code can find the global constructor/destructor pointers
|
||||
*/
|
||||
static void (*__CTOR_LIST__[1]) (void) __attribute__(( used, section(".ctors"), aligned(sizeof(void (*)(void))) ));
|
||||
static void (*__DTOR_LIST__[1]) (void) __attribute__(( used, section(".dtors"), aligned(sizeof(void (*)(void))) ));
|
||||
@@ -68,14 +35,9 @@ void _fini(void);
|
||||
void
|
||||
_init(void)
|
||||
{
|
||||
extern void shared_obj_init(void);
|
||||
int num_ctors,i;
|
||||
int j;
|
||||
|
||||
/* The shared objects need to be set up before any local
|
||||
constructors are invoked. */
|
||||
shared_obj_init();
|
||||
|
||||
for(i = 1, num_ctors = 0 ; __CTOR_LIST__[i] != NULL ; i++)
|
||||
num_ctors++;
|
||||
|
||||
@@ -88,7 +50,6 @@ _init(void)
|
||||
void
|
||||
_fini(void)
|
||||
{
|
||||
extern void shared_obj_exit(void);
|
||||
int num_dtors,i;
|
||||
static int j;
|
||||
|
||||
@@ -97,10 +58,6 @@ _fini(void)
|
||||
|
||||
while(j++ < num_dtors)
|
||||
__DTOR_LIST__[j]();
|
||||
|
||||
/* The shared objects need to be cleaned up after all local
|
||||
destructors have been invoked. */
|
||||
shared_obj_exit();
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@@ -1,37 +1,9 @@
|
||||
/*
|
||||
/*
|
||||
* $Id: crtend.c,v 1.2 2005-03-09 21:07:25 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* End markers for the CTOR and DTOR list.
|
||||
*
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* 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(__amigaos4__)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=8
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=8
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define VERSION 1
|
||||
#define REVISION 215
|
||||
#define DATE "26.6.2017"
|
||||
#define VERS "debug.lib 1.215"
|
||||
#define VSTRING "debug.lib 1.215 (26.6.2017)\r\n"
|
||||
#define VERSTAG "\0$VER: debug.lib 1.215 (26.6.2017)"
|
||||
#define REVISION 203
|
||||
#define DATE "28.4.2008"
|
||||
#define VERS "debug.lib 1.203"
|
||||
#define VSTRING "debug.lib 1.203 (28.4.2008)\r\n"
|
||||
#define VERSTAG "\0$VER: debug.lib 1.203 (28.4.2008)"
|
||||
|
||||
@@ -1 +1 @@
|
||||
215
|
||||
203
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2015 by Olaf Barthel <obarthel (at) gmx.net>
|
||||
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user