The 'struct tm' is now properly updated to reflect the time and date information which comes out of the number of seconds calculated.
A bug reported by Andreas Falkenhahn is resolved which had the effect of distorting the number of seconds calculated.
Piping will have the consequence that the exit status of the first command
will not be considered. As this is the compiling command in our case, make
will not exit with an error code even if the compiling failed.
While there are shell-specific solutions, disabling LOG_COMMAND seems to
be the most general solution.
Added integer overflow test to calloc().
Tiny change in getopt_long() so that the value pointed to by the "longindex" parameter 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.
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.
Added a short test program for the slab allocator.
The malloc-test program was linked against the wrong object file in GNUmakefile.68k. Fixed.
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.
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.
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.
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.
If a new slab is allocated, or an empty slab is reused, the list of empty slabs is now purged, if possible. Empty slabs which cannot be immediately purged "decay" and will be collected the next time a new slab is allocated or an empty slab is reused.
If a chunk is allocated and the slab which the chunk came from is fully utilized, the slab is moved to the end of its list. This should avoid searching this slab for free space before all other slabs of the same chunk size have been tested first. Slabs with free space are always placed closer to the head of the list.
A slab-allocator can now be used as the back-end for all memory allocations by setting __slab_max_size to a value > 0. This controls the slab size used for allocations and should be a power of 2, such as 2048 or 4096 bytes.
This change still needs testing.
Changes in the naming of certain dos.library functions in the
V53 header files are now accounted for. This also affects
unistd/stat/utime code which uses the same header file.
- Replaced ISO Latin 1 code #160 with a plain blank space (ASCII code #32) where necessary
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15305 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- 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 the custom stack
according to local setting or by calling a query function.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15215 87f5fb63-7c3d-0410-a384-fd976d0f7a62
checking code. It never actually worked. The bit that does work is the stack
usage measurement code, plus the bit that sets up the the custom stack
according to local setting or by calling a query function.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15212 87f5fb63-7c3d-0410-a384-fd976d0f7a62
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.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15211 87f5fb63-7c3d-0410-a384-fd976d0f7a62
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.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15207 87f5fb63-7c3d-0410-a384-fd976d0f7a62
available only under OS4. There is a variant of dlopen() in libunix.a
which will perform a path name conversion.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15206 87f5fb63-7c3d-0410-a384-fd976d0f7a62
constructors are invoked, and after all local destructors have been
invoked.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15205 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- 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.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15204 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- Added a workaround for the baserel build flavour, which requires a specific
GCC version, e.g. 4.0.4 or earlier.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15202 87f5fb63-7c3d-0410-a384-fd976d0f7a62
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.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15201 87f5fb63-7c3d-0410-a384-fd976d0f7a62
if the operating system can supply that detailed information.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15200 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- Corrected the function prototype for wcspbrk().
- Added function prototypes for mbrtowc_l(), wcscoll_l(), wcscspn() and wcsrchr().
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15196 87f5fb63-7c3d-0410-a384-fd976d0f7a62
makefiles and the archive build script (that is: 'cp -a' becomes 'cp -p'
and 'cp -pR', depending upon the specific context).
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15195 87f5fb63-7c3d-0410-a384-fd976d0f7a62
works just about exactly like the amiga.lib RVI code used to do, which means
that there is no artificial length limit for the number of characters a string
retrieved may have, and the code is largely reentrant.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15191 87f5fb63-7c3d-0410-a384-fd976d0f7a62
dangerous and unnecessary.
- Plugged in 68k stubs for the OS4 build.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15190 87f5fb63-7c3d-0410-a384-fd976d0f7a62
function now substitutes a 10 microsecond timeout for a zero length timeout.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15189 87f5fb63-7c3d-0410-a384-fd976d0f7a62
it calls IsInteractive() on it.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15188 87f5fb63-7c3d-0410-a384-fd976d0f7a62
code as a reference. The 68k stubs currently only work for the 68k version of
the library, and a solution for the OS4 build still needs to be found. The code
is currently untested, but it should be complete.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15183 87f5fb63-7c3d-0410-a384-fd976d0f7a62
API functions, rather than omitting support for them in the 68k build.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15182 87f5fb63-7c3d-0410-a384-fd976d0f7a62
olaf in a different way so that libm.a never contains any hard float
opcodes and instead libm881 contains them. so the separate soft-float
directory are not required.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15181 87f5fb63-7c3d-0410-a384-fd976d0f7a62
and SetRexxVarFromMsg() will not be used and therefore not cause linkage errors
with our libamiga.a stubs anymore.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15180 87f5fb63-7c3d-0410-a384-fd976d0f7a62
resolve the issues with FPU code popping up in the mathieee#?.library
software floating point code.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15179 87f5fb63-7c3d-0410-a384-fd976d0f7a62
which are used for localization on some platforms. This is a non-standard
feature and the way clib2 treats it for now is just intended to avoid
trouble while performing the conversion.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15178 87f5fb63-7c3d-0410-a384-fd976d0f7a62
our libraries. In addition the specs file now also respects the -msoft-float
option at link time and sets the default link directory accordingly.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15176 87f5fb63-7c3d-0410-a384-fd976d0f7a62
was within the valid range for a log() function. Using DBL_EPSILON as the
threshold was not correct as EPSILON is 2.2204460492503131E-16 whereas
values like 1E-200 are still valid double values for a log().
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15175 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- Added llrint() function contributed by Henning Nielsen Lund. Thank you
very much!
- <unistd.h> now also include <stdio.h>, so that the SEEK_SET, etc. macros
are defined for lseek() to use.
- Added a wrapper function which handles the thread-safe stdio stream
resolution.
- In tcflush() a break signal can no longer cause the read flush loop
to be quit with two semaphores still locked.
- In __obtain_daemon_message() the test to verify if the bsdsocket.library API
would support the server API functionality checked the wrong feature. Fixed.
- Switched over the fd->fd_DefaultFile references to fd->fd_Socket where
sockets are used rather than file handles.
- Added functions which modify the callback function and the userdata pointer
stored in a low level unbuffered file/socket data structure. These function
perform the proper locking and are thus safe to use in a thread-safe environment.
- The low level unbuffered file/socket now has a public equivalent, which
is defined (along with the typedefs and flags) in <sys/clib2_io.h>. Functions
for tinkering with it are still to come.
- The math kernel code no longer uses its own private scalbn() function.
- Added a function prototype for the _exit() function. Note that _exit() is
not an ISO 'C' function.
- Corrected the getopt() function prototype, as prompted by Henning Nielsen Lund.
- The printf() family no longer adds a 0 or 0x prefix if the alternate
conversion modifier is present for the %o and %x conversions and the
value to be converted is 0 already. Put another way, printf("%#x %#o",0,0);
now prints "0 0". This required another change so that %p always includes
the 0x prefix even if the pointer involved is a NULL pointer.
- readlink() no longer sort-of-works for files and directories. It now only
works for soft linked objects and returns an error for everything else.
This is based upon a fix by Peter Bengtsson. Thank you very much!
- Moved the lstat() local Lock() function into its own separate file.
- uname() now returns correct and robust information for OS version
numbers > 36. This integrates a fix by Peter Bengtsson. Thank you
very much!
- Moved the crtbegin.o/crtend.o files out of the link libraries. Moving
them in was intended to work as a fix for the shared library build, but
now it seems that this has to be done at the link stage through the
GCC specs file...
- Integrated a fix for __rem_pio2() which affects sin(), tan() and cos(),
contributed by Steven Solie. Thank you very much!
- The internal 'struct fd' file descriptor table entry data structure
now has a user data field entry.
- Rearranged the contents of the 'struct fd' file descriptor table entry
data structure in preparation for making it public. Also added a version
field so that user code can handle changes to it gracefully. The default
file is no longer a BCPL pointer to a file handle by default, but
both a BPTR and a socket identifier, wrapped into a union.
- Added experimental tilde expansion in Unix path names. This still needs
some more work.
- __get_default_file() called __fd_unlock() without having called
__fd_lock() first. Ouch.
- Removed an unnecessary pair of __fd_lock()..__fd_unlock() calls from
ttyname_r().
- The libunix.a unlink() function is now reentrant, or at least thread-safe.
- You can now make unlink() stop after a failed deletion attempt which
failed because the object to be deleted was reported as being "in use".
The libunix.a variant defaults to report the deletion to have succeeded
under these circumstances and later tries to delete the files marked
for deletion. See <dos.h> for a brief documentation of how to change
the behaviour.
- basename() and dirname() can no longer return NULL. They truncate the
resulting path name instead. This is done so because some code that
calls basename() or dirname() does not check if the function's return
value is NULL.
- The SetOwner() fall-back code for Kickstart 2.04 was passing the wrong
parameters to the file system. The first (dp_Arg1) should have been
zero. Ouch.
- basename() is not supposed to modify the string it is passed and should
return a pointer to a string which can be modified. Now it does. Same
thing for dirname().
- asctime_r() now returns NULL if the buffer is too short to hold even a single
byte of data.
- ttyname() now calls ttyname_r(). Also, the libunix.a version of ttyname_r()
will produce "/CONSOLE" rather than "CONSOLE:".
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15173 87f5fb63-7c3d-0410-a384-fd976d0f7a62
very much!
- <unistd.h> now also include <stdio.h>, so that the SEEK_SET, etc. macros
are defined for lseek() to use.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15172 87f5fb63-7c3d-0410-a384-fd976d0f7a62
resolution.
- In tcflush() a break signal can no longer cause the read flush loop
to be quit with two semaphores still locked.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15170 87f5fb63-7c3d-0410-a384-fd976d0f7a62
would support the server API functionality checked the wrong feature. Fixed.
- Switched over the fd->fd_DefaultFile references to fd->fd_Socket where
sockets are used rather than file handles.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15169 87f5fb63-7c3d-0410-a384-fd976d0f7a62
stored in a low level unbuffered file/socket data structure. These function
perform the proper locking and are thus safe to use in a thread-safe environment.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15166 87f5fb63-7c3d-0410-a384-fd976d0f7a62
is defined (along with the typedefs and flags) in <sys/clib2_io.h>. Functions
for tinkering with it are still to come.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15165 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- Added a function prototype for the _exit() function. Note that _exit() is
not an ISO 'C' function.
- Corrected the getopt() function prototype, as prompted by Henning Nielsen Lund.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15164 87f5fb63-7c3d-0410-a384-fd976d0f7a62
with the library yet.
- The byteswap code was contributed by Peter Bengtsson. Thank you very much!
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15163 87f5fb63-7c3d-0410-a384-fd976d0f7a62
conversion modifier is present for the %o and %x conversions and the
value to be converted is 0 already. Put another way, printf("%#x %#o",0,0);
now prints "0 0". This required another change so that %p always includes
the 0x prefix even if the pointer involved is a NULL pointer.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15162 87f5fb63-7c3d-0410-a384-fd976d0f7a62
works for soft linked objects and returns an error for everything else.
This is based upon a fix by Peter Bengtsson. Thank you very much!
- Moved the lstat() local Lock() function into its own separate file.
- uname() now returns correct and robust information for OS version
numbers > 36. This integrates a fix by Peter Bengtsson. Thank you
very much!
- Moved the crtbegin.o/crtend.o files out of the link libraries. Moving
them in was intended to work as a fix for the shared library build, but
now it seems that this has to be done at the link stage through the
GCC specs file...
- Integrated a fix for __rem_pio2() which affects sin(), tan() and cos(),
contributed by Steven Solie. Thank you very much!
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15161 87f5fb63-7c3d-0410-a384-fd976d0f7a62
now has a user data field entry.
- Rearranged the contents of the 'struct fd' file descriptor table entry
data structure in preparation for making it public. Also added a version
field so that user code can handle changes to it gracefully. The default
file is no longer a BCPL pointer to a file handle by default, but
both a BPTR and a socket identifier, wrapped into a union.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15160 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- You can now make unlink() stop after a failed deletion attempt which
failed because the object to be deleted was reported as being "in use".
The libunix.a variant defaults to report the deletion to have succeeded
under these circumstances and later tries to delete the files marked
for deletion. See <dos.h> for a brief documentation of how to change
the behaviour.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15155 87f5fb63-7c3d-0410-a384-fd976d0f7a62
resulting path name instead. This is done so because some code that
calls basename() or dirname() does not check if the function's return
value is NULL.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15153 87f5fb63-7c3d-0410-a384-fd976d0f7a62
parameters to the file system. The first (dp_Arg1) should have been
zero. Ouch.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15151 87f5fb63-7c3d-0410-a384-fd976d0f7a62
which were missing and by casting pointers to the expected types.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15150 87f5fb63-7c3d-0410-a384-fd976d0f7a62
will produce "/CONSOLE" rather than "CONSOLE:".
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15147 87f5fb63-7c3d-0410-a384-fd976d0f7a62
return a pointer to a string which can be modified. Now it does. Same
thing for dirname().
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15145 87f5fb63-7c3d-0410-a384-fd976d0f7a62
will disable expansion of wildcard patterns passed on the command line.
Note that if the variable is not set then the global variable
'__expand_wildcard_args' will provide the defaults for the switch that
controls whether the wildcard expansion takes place. And after the
environment variable has been checked, the '__expand_wildcard_args_check'
function pointer can still be used to override the switch.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15141 87f5fb63-7c3d-0410-a384-fd976d0f7a62
it returns much useful information, though.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15138 87f5fb63-7c3d-0410-a384-fd976d0f7a62
Steven Solie. Thank you very much!
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15135 87f5fb63-7c3d-0410-a384-fd976d0f7a62
to avoid that the command line wildcard expansion takes place.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15132 87f5fb63-7c3d-0410-a384-fd976d0f7a62
define so that existing m68k compilers also have this define. In addition,
the common "-noixemul" option can now also be specified but will do a NOP
so that Makefiles sharing multiple runtime lib setups work without
a warning.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15131 87f5fb63-7c3d-0410-a384-fd976d0f7a62
stdin/stdout/stderr streams if it's part of the thread-safe library.
- fpathconf() now checks if the file descriptor is really referring to a file.
- The termios hook entry code could file descriptor's embedded file handle
rather than what the thread safe library had dynamically bound to the
stdin/stdout/stderr streams.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15130 87f5fb63-7c3d-0410-a384-fd976d0f7a62
omit the leading "./" path name.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15129 87f5fb63-7c3d-0410-a384-fd976d0f7a62
used in the GetDeviceProc() loop.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15127 87f5fb63-7c3d-0410-a384-fd976d0f7a62
checking if the file name includes path separators. If it does not,
then the search for the command begins with the resident command list;
otherwise the local directories are checked. The new code also properly
cleans after itself (a FreeDeviceProc() was missing) and the "PROGDIR:"
lock now always refers to the directory in which the command/script
file is found.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15126 87f5fb63-7c3d-0410-a384-fd976d0f7a62
makefiles. The OS4 build makefile was missing lrint() and
lrintf(). Ouch.
- execve() now checks if an abort signal arrives while it's trying
to read the first line of a script, or looking for an executable
on an assignment path.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15123 87f5fb63-7c3d-0410-a384-fd976d0f7a62
replaced by the user. If that function __execve_exit() does not call
exit but just returns to the caller without doing anything, execve()
will return the caller with the return code of the RunCommand()
function.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15122 87f5fb63-7c3d-0410-a384-fd976d0f7a62
by Henning Nielsen Lund. Thank you very much!
- atoll() no longer sets 'errno' directly but now calls __set_errno()
instead.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15116 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- Changed how multi-volume assignments are handled by execve().
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15115 87f5fb63-7c3d-0410-a384-fd976d0f7a62
Peter Bengtsson. Thank you very much!
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15106 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- Added the missing S_ISSOCKET() macro to <sys/stat.h>. Note that this
is not actually a POSIX feature.
- Added fmin(), fminf(), fmax() and fmaxf() to the build makefiles.
Somehow I must have forgotten about them :-(
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15105 87f5fb63-7c3d-0410-a384-fd976d0f7a62
sets to work with, as some software does which uses select() in place
of sleep().
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15103 87f5fb63-7c3d-0410-a384-fd976d0f7a62
<sys/filio.h> for better compatibility with the TCP/IP stack header
files.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15102 87f5fb63-7c3d-0410-a384-fd976d0f7a62
to disable wildcard pattern expansion of command line parameters when
linked against "libunix.a". Note that this has no effect on the "regular"
libc.a behaviour.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15100 87f5fb63-7c3d-0410-a384-fd976d0f7a62
hard-coded. You can override it at link time with a different
variable value for __break_signal_mask. This may have to be
augmented by an API for changing the value.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15094 87f5fb63-7c3d-0410-a384-fd976d0f7a62
in the OS4 SDK. Otherwise "struct timeval" will not be defined at the time
the <net/if.h> of the netincludes will be included by <proto/bsdsocket.h>.
- The strftime() hook function had the locale and character parameters
switched, which made 'setlocale(LC_ALL,""); strftime(..);' unusable.
Fixed.
- fchown() and chown() now accept owner and group ID values of -1, which
indicate that the respective information should not be changed.
- The OS4 library build now includes the crtbegin.o and crtend.o object
files in the libc.a library, which solves a problem with the thread-safe
shared library support code.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15090 87f5fb63-7c3d-0410-a384-fd976d0f7a62
in the OS4 SDK. Otherwise "struct timeval" will not be defined at the time
the <net/if.h> of the netincludes will be included by <proto/bsdsocket.h>.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15088 87f5fb63-7c3d-0410-a384-fd976d0f7a62
as suggested by Henning Nielsen Lund.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15085 87f5fb63-7c3d-0410-a384-fd976d0f7a62
Thank you very much!
- symlink() now also works for absolute and relative links, and is
part of "libunix.a". This patch was supplied by Henning Nielsen Lund.
Thank you very much!
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15081 87f5fb63-7c3d-0410-a384-fd976d0f7a62
longer part of "stdlib_main.c". This helps the C++ support, since the
__main symbol definition no longer clashes with the definition in
"libgcc.a".
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15076 87f5fb63-7c3d-0410-a384-fd976d0f7a62
counters for "maximum amount of memory used" and "maximum number of chunks
allocated" to the current figures for these values.
- Fixed the alloca() declaration in <stdlib.h> so that software which keys
off the fact whether or not the alloca preprocessor symbol is defined
will do the right thing.
- Added an optional call-back function which can be called if alloca()
is about to return NULL, which some software does not consider.
Rather than letting such software drop into an illegal memory access
or worse, that call-back function will be invoked instead, which can
print an error message and eventually call abort().
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15073 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- You can now request that your program uses the clib2 alloca() function
rather than the built-in compiler alloca().
- alloca() is now part of libunix.a, too.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15072 87f5fb63-7c3d-0410-a384-fd976d0f7a62
request to allocate 0 bytes as an error, returning NULL. They all
return a pointer sized memory chunk (= four bytes) initialized to
NULL (= 0) instead.
- The alloca() implementation which allocates memory from the system
rather than the local stack frame is thread-safe now. It also
interacts with the realloc(), calloc(), free() and malloc() functions
in that the alloca() cleanup routine is called once alloca() has
done its job. If all the memory allocated through alloca() has been
released no further calls to the cleanup function will be made.
- In the thread-safe library, realloc() permitted two different overlapping
calls to succeed in trying to reallocate the same chunk of memory due to
a race condition. Fixed.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15070 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- The malloc() in libunix.a now allocates four bytes of memory instead
of just one for a request to allocate 0 bytes.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15069 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- The standard malloc() now sets errno to EINVAL for zero length
allocations.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15066 87f5fb63-7c3d-0410-a384-fd976d0f7a62
behaviour of the library functions.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15065 87f5fb63-7c3d-0410-a384-fd976d0f7a62
request to allocate 0 bytes as an error, returning NULL. They all
return a 1 byte memory chunk initialized to 0 instead.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15064 87f5fb63-7c3d-0410-a384-fd976d0f7a62
feclearexcept(), fegetenv(), fegetexceptflag(), fegetround(),
feholdexcept(), feraiseexcept(), fesetenv(), fesetexceptflag(),
fetestexcept(), fetestround() and feupdateenv().
- Replaced the old pow() implementation. However, powf() may need to
be changed to set a domain error.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15062 87f5fb63-7c3d-0410-a384-fd976d0f7a62
the case of negative socket IDs.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15061 87f5fb63-7c3d-0410-a384-fd976d0f7a62
CVS subdirectories in the "include" directory.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15058 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- The cross compiler GNUmakefile.os4 variant now also logs all warnings
and errors to a compiler.log file.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15055 87f5fb63-7c3d-0410-a384-fd976d0f7a62
better. Note that this is not yet entirely succesful.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15054 87f5fb63-7c3d-0410-a384-fd976d0f7a62
bsdsocket.library API function to determine if what appears to be
a valid daemon startup message is sound.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15052 87f5fb63-7c3d-0410-a384-fd976d0f7a62
socket into a separate function which can be overridden by user code.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15051 87f5fb63-7c3d-0410-a384-fd976d0f7a62
daemon startup message by default. You now have to enable this feature
by declaring a global variable called "__check_daemon_startup" which is
described in <dos.h>.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15050 87f5fb63-7c3d-0410-a384-fd976d0f7a62
"__bool_true_false_are_defined" rather than "__bool_true_and_false_are_defined".
Thanks go to Peter Bengtsson for finding and fixing it.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15049 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- The thread-safe library now tries to enable bsdsocket.library base
sharing and attempts to make the TCP/IP stack call the local
__set_errno() and __set_h_errno(), so that any Process calling
the library functions will get a chance to see proper error
codes. Whether any of these features could be enabled can be tested
through two global variables __can_share_socket_library_base and
__thread_safe_errno_h_errno which are defined in <dos.h>. Note that
for both features to work you will need the Roadshow bsdsocket.library
version 4.275 or higher.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15048 87f5fb63-7c3d-0410-a384-fd976d0f7a62
file but were still unimplemented up until now.
- Replaced ldexp() and modf().
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15045 87f5fb63-7c3d-0410-a384-fd976d0f7a62
fdlibm which uses macros for manipulating the high and low words of a
double, like the rest of fdlibm functions in clib2. The previous version
would give bogus results when compiled with -O3 in clib2 which lead to
"interesting" results (and lots of fun while searching for the problem)
in Ghostscript. Wish I managed to track this down yesterday for 1.196
release... <aantonijevic>
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15043 87f5fb63-7c3d-0410-a384-fd976d0f7a62
stdio data is still locked.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15037 87f5fb63-7c3d-0410-a384-fd976d0f7a62
for building code that references the networking API. It is now possible,
provided you build your code with an existing TCP/IP API header file
set (such as from the "Roadshow" SDK) without running into data type
or function prototype declaration conflicts. I have added local versions
of <arpa/inet.h>, <netinet/in.h>, <netdb.h>, <sys/filio.h>, <sys/ioccom.h>,
<sys/ioctl.h>, <sys/select.h> and <sys/socket.h> and updated <unistd.h>,
<pwd.h> and <grp.h> accordingly. Note that some of the function prototypes
will conflict with the bsdsocket.library/usergroup.library API, which is
why you can disable the declarations through the __NO_NET_API preprocessor
symbol: if defined, none of the function prototypes will be defined.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15036 87f5fb63-7c3d-0410-a384-fd976d0f7a62
nearbyint(), remquof(), remquo(), roundf(), round(), tgammaf(),
tgamma(), truncf(), trunc(). Sort of implemented fmaf() and fma(),
which really ought to be done in "SIMD" fashion.
This completes the "real" floating point math library (ignoring
for a moment that the floating point environment code is still
not implemented).
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15035 87f5fb63-7c3d-0410-a384-fd976d0f7a62
and then hooks up the socket with the clib2 data structures. This
makes it possible to have several Processes calling the accept()
stub at the same time.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15033 87f5fb63-7c3d-0410-a384-fd976d0f7a62
calling exit(), the IoErr() value set at this time will now be
preserved until the program really returns control to the shell.
This turned out to be easier to implement than I had originally
thought, thanks to the fact that the atexit() functions are all
invoked straight after the exit() call.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15032 87f5fb63-7c3d-0410-a384-fd976d0f7a62
strtoul() and strtoull() now count how many digits were converted.
If that number is zero, then the conversion is considered to have
failed: 0 is returned, errno is set to ERANGE and the 'ptr' parameter
reference is initialized with a pointer to the string to be converted.
This has two consequences:
1) A floating point number that has no digits in the significand
is no longer converted to zero. For example ".e10" can no longer
result in a successful conversion.
2) You can detect if a conversion is successful by comparing pointers
after the conversion function has returned:
char * str;
char * ptr;
long n;
n = strtol(str,&ptr,10);
if(n == 0 && str == ptr)
printf("conversion has failed");
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15030 87f5fb63-7c3d-0410-a384-fd976d0f7a62
TMP_MAX value was off by one.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15029 87f5fb63-7c3d-0410-a384-fd976d0f7a62
called _exit(). It should have called exit() instead.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15028 87f5fb63-7c3d-0410-a384-fd976d0f7a62
64 bit integer conversion code. The plain 68000 version does not.
- The 64 bit integer conversion code used in by the scanf() family
was broken due to a misplaced overflow check, which had the cruel
effect of triggering for 32 bit integers as well. Fixed.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15023 87f5fb63-7c3d-0410-a384-fd976d0f7a62
in the printf(), scanf(), atoll(), strtoll() and strtoull() functions.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15021 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- getcwd() now considers a buffer size of 0 an error, and it sets
the errno code to ERANGE if the buffer is too small.
- With Unix path semantics enabled, rename() now fails if either
the old or the new name are empty strings. Same thing for
opendir(), utime(), unlink(), chown(), link(), readlink(),
realpath(), chdir(), access(), stat(), rmdir(), lstat(),
chmod(), statfs() and open()/fopen().
- Fixed several issues with the formatted output of strftime()
for the "C" locale: "%p" could return " PM", "%c" is now
equivalent to "%a %b %e %T %Y", "%x" is equivalent to "%m/%d/%y"
and "%X" is now equivalent to "%T".
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15020 87f5fb63-7c3d-0410-a384-fd976d0f7a62
compares the current file position against the current file size,
if that file is on a file system, or simply checks if there is
any data in the file (which works for the default PIPE: device).
- The raw file descriptor structure member fd_Position is now
always updated, regardless of whether the file supports random
access or not.
- The wildcard escape character used in __wildcard_expand_init() was
wrong. It should have been "'" but it was "`". Fixed.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15015 87f5fb63-7c3d-0410-a384-fd976d0f7a62
tested for a request still in progress. Fixed.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15014 87f5fb63-7c3d-0410-a384-fd976d0f7a62
be defined in <unistd.h> have been moved into a separate header file
<sys/clib2_net.h> which, for backwards compatibility, can be include
from within <unistd.h> if the preprocessor symbol __USE_CLIB2_NETLIB
is defined early on. Eventually, <sys/clib2_net.h> should be removed
from the general header files and become a local library build header
file altogether. Note that in this case you would have to build your
own software using common TCP/IP SDK header files.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15011 87f5fb63-7c3d-0410-a384-fd976d0f7a62
clib2 shared library initialization/cleanup functions should be used.
This is a dual-build library which will both work with the plain 68k
AmigaOS and the PowerPC native AmigaOS4. The example source code can be
found in the "skeleton_library" subdirectory.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15008 87f5fb63-7c3d-0410-a384-fd976d0f7a62
files which initialize global data, such as the new "stdlib_program_name.c"
and "stdlib_malloc.c".
- Until I can find a way to invoke it from within the library, the
__machine_test() function is no longer invoked.
- Tagged global data with NOCOMMON attributes.
- Added the __lib_init() and __lib_exit() functions, which are part of the
thread-safe library and which can be used to hook up clib2 with standard
Amiga shared library/device code. Some documentation on how to use them
can be found in the <dos.h> header file.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14999 87f5fb63-7c3d-0410-a384-fd976d0f7a62
it no longer requires that any parameters are quoted and it is automatically
enabled if you link against libunix.a, without libc.a standing a chance to
accidentally override it.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14990 87f5fb63-7c3d-0410-a384-fd976d0f7a62
of libunix.a, now translates the "*" wildcard into "#?" unless you prefix
it with a backtick ("`"), which is the wildcard pattern escape character
used on AmigaOS.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14989 87f5fb63-7c3d-0410-a384-fd976d0f7a62
Henning Nielsen Lund. Thank you very much!
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14988 87f5fb63-7c3d-0410-a384-fd976d0f7a62
the wildcard pattern expansion functions not getting included.
- Replacing "int" with "socklen_t" in the header files caused compilation
errors with the source code which wasn't using the new typedef yet. Fixed.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14985 87f5fb63-7c3d-0410-a384-fd976d0f7a62
because the wrong InfoData structure member was tested. Fixed.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14984 87f5fb63-7c3d-0410-a384-fd976d0f7a62
least for clib2) ftell() and fseek() functions, respectively.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14983 87f5fb63-7c3d-0410-a384-fd976d0f7a62
to add it to libunix.a rather than keeping it in a separate libtermios.a
library.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14971 87f5fb63-7c3d-0410-a384-fd976d0f7a62
conversion. Note that this is a non-standard feature!
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14970 87f5fb63-7c3d-0410-a384-fd976d0f7a62
remainder() and remainderf() for C99.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14965 87f5fb63-7c3d-0410-a384-fd976d0f7a62
and hypotf() for C99.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14964 87f5fb63-7c3d-0410-a384-fd976d0f7a62
isdigit(), isgraph(), islower(), isprint(), ispunct(), isspace(),
isupper(), isxdigit(), tolower() and toupper() functions
to clamp the input parameter to the "unsigned char" range before
it is submitted to the respective locale.library function. This
should be in sync with what the specs demand, which state that
if the input parameter is neither EOF nor in the range of an
"unsigned char" variable, then the results are undefined.
- ungetc() now returns the input character, clamped to an unsigned
char value, upon success. Previously, if the input parameter was
negative and not EOF, the result was identical to the input, which
could have had negative side-effects.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14958 87f5fb63-7c3d-0410-a384-fd976d0f7a62
regular libc.a, but only of libunix.a.
- Changed the definition of the D_S() macro to cast the pointer
address to an unsigned 32 bit integer.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14956 87f5fb63-7c3d-0410-a384-fd976d0f7a62
year number mod 100.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14955 87f5fb63-7c3d-0410-a384-fd976d0f7a62
in place of the copying loop.
- Modified __translate_unix_to_amiga_path_name() and
__translate_amiga_to_unix_path_name() to not to call strlen()
on the results of __strip_double_slash().
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14951 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- nan() and nanf() now return quiet NaNs.
- Added internal __inf() and __inff() functions.
- strtof() now calls nanf() and __inff(), respectively, to produce
the special floating point values for nan/inf/infinity.
- strtod() now calls nan() and __inf(), respectively, to produce
the special floating point values for nan/inf/infinity.
- The scanf() family now calls nan() and __inf(), respectively, to
produce the special floating point values for nan/inf/infinity.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14948 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- No longer uses a local copysign() function in "math_kernel_scalbn.c".
- Fixed an assignment which actually came out as a comparison in "stdio_vfscanf.c".
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14946 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- Floating point output in hexadecimal notation can now show a sign
in front of the hex prefix string.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14945 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- Removed the old isinf() and isnan() functions.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14944 87f5fb63-7c3d-0410-a384-fd976d0f7a62
islessequal() and islessgreater() to <math.h> for C99.
- The wchar_t type is now an 'unsigned short' integer (16 bits wide).
- Added PTRDIFF_MIN/PTRDIFF_MAX, WCHAR_MIN/WCHAR_MAX and
WINT_MIN/WINT_MAX to <stdint.h> for C99.
- Added imaxdiv() and imaxabs() for C99.
- Added strtoimax() and strtoumax() for C99.
- Added nextafter() and nextafterf() for C99.
- Added copysign() and copysignf() for C99.
- Unless I missed something, clib2 should now be functionally complete
with regard to C99, except for the floating point operations covered.
These are a major challenge all by themselves, and I wonder both
whether they are worth the effort and how one could implement them
correctly.
- fflush() now consistently supports a NULL parameter, causing all
streams to be flushed for which this behaviour is defined.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14943 87f5fb63-7c3d-0410-a384-fd976d0f7a62
"decimal" number. That is, if the difference is 5 hours and 30 minutes,
then %z will now print "530" rather than "330".
- mktime() now handles one leap second gracefully.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14941 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- Fixed math_headers.h so that fabsf.c compiles correctly with SAS/C.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14940 87f5fb63-7c3d-0410-a384-fd976d0f7a62
number rather than a decimal one. Now how odd is that?
- strtod() and strtof() now support "inf"/"infinity"/"nan"/"nan(..)" and
hexadecimal floating point numbers, for C99.
- Added the fpclassify(), isfinite(), isnormal() and signbit() macros for C99.
- Reimplemented isnan() and isinf() as macros for C99. The corresponding
functions will be dropped from the library. Note that the isinf() macro
does not return -1, 0 or 1 like the old function did, but only 0 or 1
depending upon whether the parameter represents +/- infinity or not.
- Added fabsf() for C99.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14935 87f5fb63-7c3d-0410-a384-fd976d0f7a62
%a/%A conversions for C99. The %j is treated like %ll, %t and %z are treated
like %l.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14933 87f5fb63-7c3d-0410-a384-fd976d0f7a62
of a command unless it contains path separator characters.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14929 87f5fb63-7c3d-0410-a384-fd976d0f7a62
of records or the size of each record is zero, both now call clearerr() to
avoid giving the caller the wrong impression that an EOF or error occured.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14927 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- Added code to the startup routine which allows you to monitor where command
was started from and which parameters it was invoked with.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14926 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- Added code to the startup routine which allows you to monitor where command
was started from and which parameters it was invoked with.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14925 87f5fb63-7c3d-0410-a384-fd976d0f7a62
Seek(). Seek() is particularly challenging because the value it
returns might be a valid file position and not an error.
- Replaced numeric function return codes of 0 and -1 with macros OK,
SEEK_ERROR/ERROR to clarify the respective purposes.
- Changed how ftell() and fseek() are used, double-checking the return
value and the errno code.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14923 87f5fb63-7c3d-0410-a384-fd976d0f7a62
are detected.
- Modified function return values of 0 and -1 to use macros like OK,
ERROR/SEEK_ERROR instead, to better convey what the purpose of these
values is.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14922 87f5fb63-7c3d-0410-a384-fd976d0f7a62
file has been protected from deletion.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14920 87f5fb63-7c3d-0410-a384-fd976d0f7a62
and which files this involves.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14917 87f5fb63-7c3d-0410-a384-fd976d0f7a62
locking in the stdio_fflush.c file.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14915 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- Made the clearerr(), feof() and ferror() macros thread-safe.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14914 87f5fb63-7c3d-0410-a384-fd976d0f7a62
very much! This includes the following:
- Added SSIZE_MAX to <limits.h>.
- Added <sys/uio.h>, readv() and writev().
- Cut back the soft link resolution code in lstat().
- In <fcntl.h> O_NDELAY is now an alias for O_NONBLOCK.
- Added <complex.h>, carg(), cargf(), cargl(), cimag(), cimagf(),
cimagl(), conj(), conjf(), conjl(), creal(), crealf() and creall().
Note that the C99 support for the complex floating point data
types is limited to GCC 3.x for now.
- Added va_copy() to <stdarg.h>.
- Added _Exit() to <stdlib.h>.
- Added <stdbool.h>.
- Added vfscanf() to <stdio.h>.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14912 87f5fb63-7c3d-0410-a384-fd976d0f7a62
to a likely console handler file's MsgPort.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14911 87f5fb63-7c3d-0410-a384-fd976d0f7a62
information identifying it as a character special file. Side-effect:
if the input/output went to a CON:/AUTO window, that window will
pop open and stay open.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14910 87f5fb63-7c3d-0410-a384-fd976d0f7a62
the original file descriptors they are duplicates of. I modified the
function which maps file descriptor numbers to file descriptor
table entries to return the table entries of the original files.
- In the thread-safe library, duplicated stdin/stdout/stderr
descriptors now work like the "real" ones. This is true even if
the "real" ones were closed and only their former aliases remain.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14909 87f5fb63-7c3d-0410-a384-fd976d0f7a62
a separate file.
- Simplified the library/open close code in "stdlib_main.c".
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14908 87f5fb63-7c3d-0410-a384-fd976d0f7a62
currently configured. It merely blocks the delivery of the respective
signal to prevent recursion.
- raise() now drops into abort() if a signal handler is set to
SIG_DFL. The exception is in SIGINT delivery, which has the
effect of printing a different termination message but otherwise
program flow takes the same path as abort().
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14907 87f5fb63-7c3d-0410-a384-fd976d0f7a62
signal_data.c and into signal_raise.c where they are actually used.
This makes it possible to override the default definition of the
__check_abort_enabled variable in your own programs.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14906 87f5fb63-7c3d-0410-a384-fd976d0f7a62
for OS4 if the AllocSysObject() function is used to create it.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14905 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- Clarified the caveats of the libm.a use.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14904 87f5fb63-7c3d-0410-a384-fd976d0f7a62
until the function has returned. Which is harsh, but there is no
elegant solution to the issue of keeping the same dos.library
file handles from concurrent use which SystemTagList() might just
end up using.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14898 87f5fb63-7c3d-0410-a384-fd976d0f7a62
the 68k build. The PowerPC build may follow later, provided
I manage to get the specs file fixed.
- Moved the check for the presence of an FPU into the
math_init.c code.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14897 87f5fb63-7c3d-0410-a384-fd976d0f7a62
the names of the functions assigned through the new macros are different.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14895 87f5fb63-7c3d-0410-a384-fd976d0f7a62
was still wrongish for the OS4 library. So I had to change
it *again*. Which probably means that the 68k library will
need further changes...
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14894 87f5fb63-7c3d-0410-a384-fd976d0f7a62
should no longer spell big trouble on account of the stdio
data structures possibly not being in a well-defined and
initialized state.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14893 87f5fb63-7c3d-0410-a384-fd976d0f7a62
separate files.
- Removed some more redundant data from stdlib_main.c.
- Added the first real C99 function: _Exit().
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14892 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- Dropped unused stub code which is now redundant because of
the constructor/destructor mechanism.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14891 87f5fb63-7c3d-0410-a384-fd976d0f7a62
to what it is supposed to do. Fixed.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14888 87f5fb63-7c3d-0410-a384-fd976d0f7a62
destructor functions in any way at all. I reimplemented the
entire library constructor/destructor functionality to use the
same approach as libnix.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14887 87f5fb63-7c3d-0410-a384-fd976d0f7a62
of the original file descriptor.
- close() did not return 0 if the file descriptor in question
was really just an alias. Fixed.
- Added a feature which makes it possible to have several clients
use the standard I/O streams (stdin/stdout/stderr) and have these
referring to their process' Input()/Output()/ErrorOutput()
streams. This is intended to support the upcoming shared
library feature.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14885 87f5fb63-7c3d-0410-a384-fd976d0f7a62
that the constructors/destructors are called in the proper
order, too.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14884 87f5fb63-7c3d-0410-a384-fd976d0f7a62
setjmp(). This is now done within stdlib_main.c prior to
calling the destructor function invocation code.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14883 87f5fb63-7c3d-0410-a384-fd976d0f7a62
constructor/destructor functions for initialization and cleanup
purposes.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14882 87f5fb63-7c3d-0410-a384-fd976d0f7a62
or initializes it.
- The stdlib constructor now performs the CPU/FPU compatibility test.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14879 87f5fb63-7c3d-0410-a384-fd976d0f7a62
Both the 68k and PowerPC platform now invoke them in the same order
and the 68k code uses the designated invocation priorities. The
PowerPC destructor function now sets up the exit() jmp_buf before
the destructor functions are called.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14874 87f5fb63-7c3d-0410-a384-fd976d0f7a62
invoke the library's constructor/destructor functions in a
very particular order. That way, you can use constructor/destructor
functions in your own code and not have them clash with the library's
own functions.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14871 87f5fb63-7c3d-0410-a384-fd976d0f7a62
avoids trouble with destructor functions which use stdio code. Unsolved
problem: the order in which destructors and constructors are called.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14870 87f5fb63-7c3d-0410-a384-fd976d0f7a62
sections where they should have been in the first place.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14869 87f5fb63-7c3d-0410-a384-fd976d0f7a62
socket_data.c, dirent_data.c and stdio_data.c and into the
code that initializes them.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14868 87f5fb63-7c3d-0410-a384-fd976d0f7a62
tests and the error message display can run safely even
on plain 68000 machines. This won't work for the 32 bit small
data model, which implies 68020 code, but so there...
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14866 87f5fb63-7c3d-0410-a384-fd976d0f7a62
initialization code for the stdin/stdout/stderr streams and
out of the program parameter setup.
- The current program name is now set up in the stdlib
initialization function.
- Simplified the machine test code; moved the FPU check into
the math initialization code.
- Added more safety checks to verify that file descriptor
file handles are valid.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14864 87f5fb63-7c3d-0410-a384-fd976d0f7a62
a MsgPort locally.
- The record locking semaphore code now builds a semaphore to add
before it tries to find the public one in memory. That way, the
code can spend less time in Forbid() state and, heaven forbid,
refrain from allocating memory while in that state.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14862 87f5fb63-7c3d-0410-a384-fd976d0f7a62
multiple concurrent callers to use the socket functions. Note
that this works only with the Roadshow TCP/IP stack, and the
results with other TCP/IP stacks are rather unpredictable.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14858 87f5fb63-7c3d-0410-a384-fd976d0f7a62
buffer tables so that all the memory allocations are in one
place and it's possible to specify exactly how many table
entries are required at a time.
- Creation and initialization of semaphores now uses the AmigaOS4
specific functions for this purpose, if available.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14857 87f5fb63-7c3d-0410-a384-fd976d0f7a62
it will pull in when linked.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14856 87f5fb63-7c3d-0410-a384-fd976d0f7a62
into a dedicated module. This also has the advantage that it's
harder to break code by accidentally forgetting to call
InitSemaphore() after having allocated the memory for it.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14853 87f5fb63-7c3d-0410-a384-fd976d0f7a62
routine. We no longer allocate memory and then modify it, but
call a function for each quoted parameter which does whatever is
necessary.
- The shell command parameter parser now considers the non-breaking
space character (ISO code 160) to be a blank space character, too.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14851 87f5fb63-7c3d-0410-a384-fd976d0f7a62
contributed by Peter Bengtsson. Thank you very much!
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14848 87f5fb63-7c3d-0410-a384-fd976d0f7a62
are now defined as empty macros unless __THREAD_SAFE is defined.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14847 87f5fb63-7c3d-0410-a384-fd976d0f7a62
support and the thread-safety.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14846 87f5fb63-7c3d-0410-a384-fd976d0f7a62
absolute Amiga path names passed to it and will use them without
changing them.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14845 87f5fb63-7c3d-0410-a384-fd976d0f7a62
Both the library and the user code need to be rebuilt with the
preprocessor symbol __THREAD_SAFE defined to get thread-safe
code.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14843 87f5fb63-7c3d-0410-a384-fd976d0f7a62
and dirent data operations. That should do it! While the library is
not reentrant (this is not ixemul.library) it should be thread-safe
now. Thread-safe in the sense of POSIX 1003.1c-1995.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14842 87f5fb63-7c3d-0410-a384-fd976d0f7a62
and ftrylockfile().
- Modified the internal FILE structure to allow for thread locking.
Note that this again requires that the library is rebuilt!
- Added or modified macros for getc_unlocked(), getchar_unlocked(),
putc_unlocked() and putchar_unlocked().
- Added rand_r().
- Added flockfile()/funlockfile() wrappers around all stdio
functions.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14841 87f5fb63-7c3d-0410-a384-fd976d0f7a62
checks while wildcard patterns are expanded in the the command line.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14840 87f5fb63-7c3d-0410-a384-fd976d0f7a62
parameters (which is by default linked in with libunix.a),
regular expressions can no longer prompt dos.library requesters
to appear. However, to be on the safe side, if you are expecting
to pass regular expressions on the command line, do not use
the wildcard expansion code such as by overriding the library
symbols with dummy functions such as are used in the file
"stdlib_wildcard_expand.c".
- Added a new variable '__open_locale' which can be used to
restrict all library functions to use the "C" language locale
rather than the current system locale settings. In addition
to that, two new functions __locale_exit() and __locale_init()
can be used to close and (re-)open the system locale at a
later time.
- Local ("static") functions are now identified by the STATIC
qualifier. This was done in preparation for changes that will
deal with global and local data and the issue of thread safety.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14839 87f5fb63-7c3d-0410-a384-fd976d0f7a62
function pointers alone. The utility.library/CallHookPkt mechanism
is no longer required.
- Moved the entire lseek() code relevant for files into the hook
function.
- Simplified the close() function which now just calls into the
hook code to perform whatever is necessary. The hook code is
responsible for cleaning up after aliases, etc. This change in
turn made it possible to greatly simplify the hook code for
buffered files which now bypasses close/read/write/lseek and
directly invokes the hook code for unbuffered files.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14835 87f5fb63-7c3d-0410-a384-fd976d0f7a62
Also, the file descriptor duplication code no longer uses a goto to
deliver its result.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14834 87f5fb63-7c3d-0410-a384-fd976d0f7a62
the file descriptor hook and into the respective functions,
such as dup2(), fchmod(), fchown(), fcntl(), fdatasync(), fstatfs(),
fsync(), ftruncate() and lseek(). Code which is not strictly
required will no longer find its way into your programs if you
link with the updated library.
NOTE: these changes require that the entire library is rebuilt!
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14833 87f5fb63-7c3d-0410-a384-fd976d0f7a62
"" rather than ":".
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14832 87f5fb63-7c3d-0410-a384-fd976d0f7a62
translate patterns such as "foo/bar/../../baz" properly, and to
use strlen() less.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14831 87f5fb63-7c3d-0410-a384-fd976d0f7a62
<inttypes.h> header files contributed by Peter Bengtsson. Thank
you very much!
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14827 87f5fb63-7c3d-0410-a384-fd976d0f7a62
handler. The side-effects were too varied and irritating after all.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14826 87f5fb63-7c3d-0410-a384-fd976d0f7a62
code which initialized them.
- Reading/changing the errno variable is no longer done directly, but
involves accessor functions.
- References to the HUGE_VAL quantity now involve an accessor function, too.
- Changed the manner in which the __huge_val constant is initialized by
the __math_init() function.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14824 87f5fb63-7c3d-0410-a384-fd976d0f7a62
code. Also, the contents of the AnchorPath structure are no longer
modified between calls. MatchEnd() has to be sufficient.
- Moved redundant code out of the readdir()/opendir()/closedir()
functions which is not required unless the code is built for
Unix compatibility mode.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14823 87f5fb63-7c3d-0410-a384-fd976d0f7a62
code. Also, the contents of the AnchorPath structure are no longer
modified between calls. MatchEnd() has to be sufficient.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14822 87f5fb63-7c3d-0410-a384-fd976d0f7a62
modified unless the library is built with the "CHECK_FOR_NULL_POINTERS"
option.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14821 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- Moved the date/time conversion test code around in "test.c".
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14820 87f5fb63-7c3d-0410-a384-fd976d0f7a62
"long long" data type are no longer prototyped if the library is built
for SAS/C.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14819 87f5fb63-7c3d-0410-a384-fd976d0f7a62
- Simplified the code in time_asctime_r.c which builds the time
string. It gracefully handles buffer sizes which are too short
by returning an empty string.
- Moved the tm->tm_wday initialization out of the hook function
in time_strftime.c since it was to be called only once anyway.
- Lost a few compiler warnings in unistd_time_delay.c and
time_gettimeofday.c.
- Folded duplicate code in time_mktime.c; also, errno is no longer
modified unless the library is built with the CHECK_FOR_NULL_POINTERS
option.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14818 87f5fb63-7c3d-0410-a384-fd976d0f7a62
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
(the '%U' and '%W' format specifiers). The new method is much simpler
than the old one.
- Made the code that converts a 'time_t' value into the 'struct DateStamp',
as used by strftime() and utime(), into its own function. This also
fixes a bug in the code strftime() would use which was completely
unaware of the local time zone settings.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14815 87f5fb63-7c3d-0410-a384-fd976d0f7a62
strftime() and asctime_r(). This one isn't sensitive to the effects of
adding/subtracting the local time zone.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14813 87f5fb63-7c3d-0410-a384-fd976d0f7a62
time, into the number of seconds since January 1st, 1970, relative to
UTC. This didn't really work up until now since the time value returned
was given as local time.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14810 87f5fb63-7c3d-0410-a384-fd976d0f7a62
function.
- The fall-back function for converting time into a string in strftime()
now calls itself for the "%x" and "%X" format specifiers.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14809 87f5fb63-7c3d-0410-a384-fd976d0f7a62
check against 0 that used to be in there.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14807 87f5fb63-7c3d-0410-a384-fd976d0f7a62
from Workbench would open and stay open. This was not intended to
happen and is a side-effect of the new stdio initialization code which
checks if the stdio streams are in non-blocking mode. Fixed.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14806 87f5fb63-7c3d-0410-a384-fd976d0f7a62
the OS4 header files, but not of the older header file distributions.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14804 87f5fb63-7c3d-0410-a384-fd976d0f7a62
have. This only worked for files which were closed anyway, but not
for the stdio streams. Fixed.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14803 87f5fb63-7c3d-0410-a384-fd976d0f7a62
is now determined at initialization time. The I/O mode is restored before
the program exits. Previously, any changes to the I/O mode would persist.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14801 87f5fb63-7c3d-0410-a384-fd976d0f7a62
out whether read/write accesses are permitted. This decision is now
for the file system to make.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14799 87f5fb63-7c3d-0410-a384-fd976d0f7a62
version of the library.
- Switched over the last use of DeviceProc() to GetDeviceProc(), etc.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14798 87f5fb63-7c3d-0410-a384-fd976d0f7a62
tracks whether or not console output is possible. We now use the
global "__no_standard_io" instead.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14794 87f5fb63-7c3d-0410-a384-fd976d0f7a62
function. Now this could have been big trouble...
- Removed tests for FileHandle->fh_Type != NULL which used to precede
all IsInterative() tests. I verified that IsInteractive() will always
return FALSE for NIL: type file handles.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14793 87f5fb63-7c3d-0410-a384-fd976d0f7a62
compiler settings, which can either default to an unsigned or
signed definition.
- Changed the rules again for the use of stderr/stdout redirection when
printing error messages. It is always safe to redirect them now and
no requester will appear unless you specifically set the value of the
"__no_standard_io" variable to TRUE in your program.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14792 87f5fb63-7c3d-0410-a384-fd976d0f7a62
messages and assertion failure notifications as requesters. The exception
is in redirecting stderr to NIL: which will prompt the requester use.
- gettimeofday() now calls GetSysTime() rather than DateStamp() to obtain
the current system time. This resolves granularity issues since the
DateStamp() result was only accurate by 1/50 of a second.
- The "ptrdiff_t" definition in <stddef.h> now defaults to type 'int' rather
than 'long int'.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14791 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-01-08 10:21:28 +00:00
1032 changed files with 56034 additions and 15190 deletions
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 <ahref="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 <ahref="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 | 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
<ahref="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:
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
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.