mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- The thread-safety code is now subject to conditional compilation.
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
This commit is contained in:
@ -67,6 +67,11 @@
|
||||
not reentrant (this is not ixemul.library) it should be thread-safe
|
||||
now. Thread-safe in the sense of POSIX 1003.1c-1995.
|
||||
|
||||
- The thread-safety code is now subject to conditional compilation.
|
||||
Both the library and the user code need to be rebuilt with the
|
||||
preprocessor symbol __THREAD_SAFE defined to get thread-safe
|
||||
code.
|
||||
|
||||
|
||||
c.lib 1.188 (7.2.2005)
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: dirent_data.c,v 1.6 2005-02-27 21:58:21 obarthel Exp $
|
||||
* $Id: dirent_data.c,v 1.7 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -42,6 +42,10 @@ struct MinList NOCOMMON __directory_list;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__THREAD_SAFE)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static struct SignalSemaphore * dirent_lock;
|
||||
|
||||
/****************************************************************************/
|
||||
@ -64,6 +68,10 @@ __dirent_unlock(void)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
CLIB_CONSTRUCTOR(__dirent_init)
|
||||
{
|
||||
BOOL success = FALSE;
|
||||
@ -72,11 +80,15 @@ CLIB_CONSTRUCTOR(__dirent_init)
|
||||
|
||||
NewList((struct List *)&__directory_list);
|
||||
|
||||
dirent_lock = AllocVec(sizeof(*dirent_lock),MEMF_ANY|MEMF_PUBLIC);
|
||||
if(dirent_lock == NULL)
|
||||
goto out;
|
||||
#if defined(__THREAD_SAFE)
|
||||
{
|
||||
dirent_lock = AllocVec(sizeof(*dirent_lock),MEMF_ANY|MEMF_PUBLIC);
|
||||
if(dirent_lock == NULL)
|
||||
goto out;
|
||||
|
||||
InitSemaphore(dirent_lock);
|
||||
InitSemaphore(dirent_lock);
|
||||
}
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
success = TRUE;
|
||||
|
||||
@ -102,8 +114,12 @@ CLIB_DESTRUCTOR(__dirent_exit)
|
||||
closedir((DIR *)__directory_list.mlh_Head);
|
||||
}
|
||||
|
||||
FreeVec(dirent_lock);
|
||||
dirent_lock = NULL;
|
||||
#if defined(__THREAD_SAFE)
|
||||
{
|
||||
FreeVec(dirent_lock);
|
||||
dirent_lock = NULL;
|
||||
}
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: dirent_headers.h,v 1.6 2005-02-27 21:58:21 obarthel Exp $
|
||||
* $Id: dirent_headers.h,v 1.7 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -73,9 +73,26 @@ extern struct MinList NOCOMMON __directory_list;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__THREAD_SAFE)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern void __dirent_lock(void);
|
||||
extern void __dirent_unlock(void);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#else
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define __dirent_lock() ((void)0)
|
||||
#define __dirent_unlock() ((void)0)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* _DIRENT_HEADERS_H */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: fcntl_read.c,v 1.6 2005-02-20 15:46:52 obarthel Exp $
|
||||
* $Id: fcntl_read.c,v 1.7 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -63,6 +63,9 @@ read(int file_descriptor, void * buffer, size_t num_bytes)
|
||||
assert( buffer != NULL );
|
||||
assert( (int)num_bytes >= 0);
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(buffer == NULL)
|
||||
@ -79,9 +82,6 @@ read(int file_descriptor, void * buffer, size_t num_bytes)
|
||||
assert( __fd[file_descriptor] != NULL );
|
||||
assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
fd = __get_file_descriptor(file_descriptor);
|
||||
if(fd == NULL)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: fcntl_write.c,v 1.6 2005-02-20 15:46:52 obarthel Exp $
|
||||
* $Id: fcntl_write.c,v 1.7 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -63,6 +63,9 @@ write(int file_descriptor, const void * buffer, size_t num_bytes)
|
||||
assert( buffer != NULL );
|
||||
assert( (int)num_bytes >= 0 );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(buffer == NULL)
|
||||
@ -79,9 +82,6 @@ write(int file_descriptor, const void * buffer, size_t num_bytes)
|
||||
assert( __fd[file_descriptor] != NULL );
|
||||
assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
fd = __get_file_descriptor(file_descriptor);
|
||||
if(fd == NULL)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio.h,v 1.6 2005-02-27 18:09:12 obarthel Exp $
|
||||
* $Id: stdio.h,v 1.7 2005-02-28 10:07:35 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -292,7 +292,7 @@ extern int __unlockfile(FILE *stream,int c);
|
||||
((FILE *)(f))->buffer[((FILE *)(f))->position++] : \
|
||||
fgetc(f))
|
||||
|
||||
#define getc_unlocked(f)
|
||||
#define getc_unlocked(f) __getc_unlocked(f)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -311,7 +311,7 @@ extern int __unlockfile(FILE *stream,int c);
|
||||
(((FILE *)(f))->buffer[((FILE *)(f))->num_write_bytes-1]))) : \
|
||||
fputc((c),(f)))
|
||||
|
||||
#define putc_unlocked(c,f) __putc((c),(f))
|
||||
#define putc_unlocked(c,f) __putc_unlocked((c),(f))
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -320,8 +320,20 @@ extern int __unlockfile(FILE *stream,int c);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__THREAD_SAFE)
|
||||
|
||||
#define getc(f) (flockfile(f), __unlockfile((f),__getc_unlocked(f)))
|
||||
#define putc(c,f) (flockfile(f), __unlockfile((f),__putc_unlocked((c),(f))))
|
||||
|
||||
#else
|
||||
|
||||
#define getc(f) __getc_unlocked(f)
|
||||
#define putc(c,f) __putc_unlocked((c),(f))
|
||||
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define getchar() getc(stdin)
|
||||
#define putchar(c) putc((c),stdout)
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: locale_headers.h,v 1.5 2005-02-27 21:58:21 obarthel Exp $
|
||||
* $Id: locale_headers.h,v 1.6 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -78,8 +78,28 @@ extern char NOCOMMON __locale_name_table[NUM_LOCALES][MAX_LOCALE_NAME_LEN];
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__THREAD_SAFE)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern void __locale_lock(void);
|
||||
extern void __locale_unlock(void);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#else
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define __locale_lock() ((void)0)
|
||||
#define __locale_unlock() ((void)0)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern void __close_all_locales(void);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: locale_init_exit.c,v 1.6 2005-02-27 21:58:21 obarthel Exp $
|
||||
* $Id: locale_init_exit.c,v 1.7 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -41,10 +41,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static struct SignalSemaphore * locale_lock;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
struct Library * NOCOMMON __LocaleBase;
|
||||
|
||||
/****************************************************************************/
|
||||
@ -188,6 +184,14 @@ __locale_init(void)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__THREAD_SAFE)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static struct SignalSemaphore * locale_lock;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void
|
||||
__locale_lock(void)
|
||||
{
|
||||
@ -206,14 +210,22 @@ __locale_unlock(void)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
CLIB_DESTRUCTOR(__locale_exit_destructor)
|
||||
{
|
||||
ENTER();
|
||||
|
||||
__locale_exit();
|
||||
|
||||
FreeVec(locale_lock);
|
||||
locale_lock = NULL;
|
||||
#if defined(__THREAD_SAFE)
|
||||
{
|
||||
FreeVec(locale_lock);
|
||||
locale_lock = NULL;
|
||||
}
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
LEAVE();
|
||||
}
|
||||
@ -227,11 +239,15 @@ CLIB_CONSTRUCTOR(__locale_init_constructor)
|
||||
|
||||
ENTER();
|
||||
|
||||
locale_lock = AllocVec(sizeof(*locale_lock),MEMF_ANY|MEMF_PUBLIC);
|
||||
if(locale_lock == NULL)
|
||||
goto out;
|
||||
#if defined(__THREAD_SAFE)
|
||||
{
|
||||
locale_lock = AllocVec(sizeof(*locale_lock),MEMF_ANY|MEMF_PUBLIC);
|
||||
if(locale_lock == NULL)
|
||||
goto out;
|
||||
|
||||
InitSemaphore(locale_lock);
|
||||
InitSemaphore(locale_lock);
|
||||
}
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
for(i = 0 ; i < NUM_LOCALES ; i++)
|
||||
strcpy(__locale_name_table[i],"C");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: mount_fstatfs.c,v 1.6 2005-02-21 10:21:42 obarthel Exp $
|
||||
* $Id: mount_fstatfs.c,v 1.7 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -63,6 +63,9 @@ fstatfs(int file_descriptor, struct statfs *buf)
|
||||
|
||||
assert( buf != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(buf == NULL)
|
||||
@ -79,9 +82,6 @@ fstatfs(int file_descriptor, struct statfs *buf)
|
||||
assert( __fd[file_descriptor] != NULL );
|
||||
assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
fd = __get_file_descriptor(file_descriptor);
|
||||
if(fd == NULL)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stat_chmod.c,v 1.4 2005-02-03 16:56:15 obarthel Exp $
|
||||
* $Id: stat_chmod.c,v 1.5 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -64,6 +64,9 @@ chmod(const char * path_name, mode_t mode)
|
||||
|
||||
assert( path_name != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(path_name == NULL)
|
||||
@ -76,9 +79,6 @@ chmod(const char * path_name, mode_t mode)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(UNIX_PATH_SEMANTICS)
|
||||
{
|
||||
if(__unix_path_semantics)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stat_fstat.c,v 1.6 2005-02-20 15:46:52 obarthel Exp $
|
||||
* $Id: stat_fstat.c,v 1.7 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -62,6 +62,9 @@ fstat(int file_descriptor, struct stat * buffer)
|
||||
|
||||
assert( buffer != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(buffer == NULL)
|
||||
@ -78,9 +81,6 @@ fstat(int file_descriptor, struct stat * buffer)
|
||||
assert( __fd[file_descriptor] != NULL );
|
||||
assert( FLAG_IS_SET(__fd[file_descriptor]->fd_Flags,FDF_IN_USE) );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
fd = __get_file_descriptor(file_descriptor);
|
||||
if(fd == NULL)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stat_lstat.c,v 1.4 2005-02-03 16:56:15 obarthel Exp $
|
||||
* $Id: stat_lstat.c,v 1.5 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -59,6 +59,9 @@ lstat(const char * path_name, struct stat * buffer)
|
||||
|
||||
assert( path_name != NULL && buffer != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(path_name == NULL || buffer == NULL)
|
||||
@ -71,9 +74,6 @@ lstat(const char * path_name, struct stat * buffer)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
result = stat(path_name,buffer);
|
||||
|
||||
out:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stat_mkdir.c,v 1.4 2005-02-03 16:56:15 obarthel Exp $
|
||||
* $Id: stat_mkdir.c,v 1.5 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -64,6 +64,9 @@ mkdir(const char * path_name, mode_t mode)
|
||||
|
||||
assert( path_name != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(path_name == NULL)
|
||||
@ -76,9 +79,6 @@ mkdir(const char * path_name, mode_t mode)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(UNIX_PATH_SEMANTICS)
|
||||
{
|
||||
if(__unix_path_semantics)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stat_rmdir.c,v 1.4 2005-02-03 16:56:15 obarthel Exp $
|
||||
* $Id: stat_rmdir.c,v 1.5 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -64,6 +64,9 @@ rmdir(const char * path_name)
|
||||
|
||||
assert( path_name != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(path_name == NULL)
|
||||
@ -76,9 +79,6 @@ rmdir(const char * path_name)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(UNIX_PATH_SEMANTICS)
|
||||
{
|
||||
if(__unix_path_semantics)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stat_stat.c,v 1.6 2005-02-03 16:56:15 obarthel Exp $
|
||||
* $Id: stat_stat.c,v 1.7 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -74,6 +74,9 @@ stat(const char * path_name, struct stat * st)
|
||||
|
||||
assert( path_name != NULL && st != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(path_name == NULL || st == NULL)
|
||||
@ -86,9 +89,6 @@ stat(const char * path_name, struct stat * st)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(UNIX_PATH_SEMANTICS)
|
||||
{
|
||||
if(__unix_path_semantics)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_asprintf.c,v 1.4 2005-02-03 16:56:15 obarthel Exp $
|
||||
* $Id: stdio_asprintf.c,v 1.5 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -60,6 +60,9 @@ asprintf(char **ret, const char *format, ...)
|
||||
|
||||
assert( ret != NULL && format != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(ret == NULL || format == NULL)
|
||||
@ -70,9 +73,6 @@ asprintf(char **ret, const char *format, ...)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
va_start(arg,format);
|
||||
result = vasprintf(ret,format,arg);
|
||||
va_end(arg);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_fclose.c,v 1.6 2005-02-27 18:09:10 obarthel Exp $
|
||||
* $Id: stdio_fclose.c,v 1.7 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -64,6 +64,9 @@ fclose(FILE *stream)
|
||||
|
||||
assert( file->iob_Lock == NULL || file->iob_Lock->ss_Owner == NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(stream == NULL)
|
||||
@ -78,9 +81,6 @@ fclose(FILE *stream)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
assert( __is_valid_iob(file) );
|
||||
assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) );
|
||||
assert( file->iob_BufferSize > 0 );
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_flockfile.c,v 1.1 2005-02-27 18:09:10 obarthel Exp $
|
||||
* $Id: stdio_flockfile.c,v 1.2 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -54,6 +54,9 @@ flockfile(FILE *stream)
|
||||
|
||||
assert( stream != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(stream == NULL)
|
||||
@ -66,9 +69,6 @@ flockfile(FILE *stream)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
assert( __is_valid_iob(file) );
|
||||
assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) );
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_freopen.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
|
||||
* $Id: stdio_freopen.c,v 1.4 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -58,6 +58,9 @@ freopen(const char *filename, const char *mode, FILE *stream)
|
||||
|
||||
assert( filename != NULL && mode != NULL && stream != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(filename == NULL || mode == NULL || stream == NULL)
|
||||
@ -70,9 +73,6 @@ freopen(const char *filename, const char *mode, FILE *stream)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
assert( __is_valid_iob(file) );
|
||||
assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) );
|
||||
assert( file->iob_BufferSize > 0 );
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_ftrylockfile.c,v 1.1 2005-02-27 18:09:10 obarthel Exp $
|
||||
* $Id: stdio_ftrylockfile.c,v 1.2 2005-02-28 10:07:30 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -55,6 +55,9 @@ ftrylockfile(FILE *stream)
|
||||
|
||||
assert( stream != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(stream == NULL)
|
||||
@ -67,9 +70,6 @@ ftrylockfile(FILE *stream)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
assert( __is_valid_iob(file) );
|
||||
assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) );
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_funlockfile.c,v 1.1 2005-02-27 18:09:10 obarthel Exp $
|
||||
* $Id: stdio_funlockfile.c,v 1.2 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -54,6 +54,9 @@ funlockfile(FILE *stream)
|
||||
|
||||
assert( stream != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(stream == NULL)
|
||||
@ -66,9 +69,6 @@ funlockfile(FILE *stream)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
assert( __is_valid_iob(file) );
|
||||
assert( FLAG_IS_SET(file->iob_Flags,IOBF_IN_USE) );
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_headers.h,v 1.16 2005-02-27 18:09:10 obarthel Exp $
|
||||
* $Id: stdio_headers.h,v 1.17 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -428,6 +428,32 @@ extern BOOL NOCOMMON __no_standard_io;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__THREAD_SAFE)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern void __stdio_lock(void);
|
||||
extern void __stdio_unlock(void);
|
||||
extern void __stdio_lock_exit(void);
|
||||
extern int __stdio_lock_init(void);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#else
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define __stdio_lock() ((void)0)
|
||||
#define __stdio_unlock() ((void)0)
|
||||
#define __stdio_lock_exit() ((void)0)
|
||||
#define __stdio_lock_init() (0)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDIO_PROTOS_H
|
||||
#include "stdio_protos.h"
|
||||
#endif /* _STDIO_PROTOS_H */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_init_exit.c,v 1.19 2005-02-27 21:58:21 obarthel Exp $
|
||||
* $Id: stdio_init_exit.c,v 1.20 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -193,13 +193,21 @@ __stdio_init(void)
|
||||
if(buffer == NULL)
|
||||
goto out;
|
||||
|
||||
/* Allocate memory for an arbitration mechanism, then
|
||||
initialize it. */
|
||||
lock = AllocVec(sizeof(*lock),MEMF_ANY|MEMF_PUBLIC);
|
||||
if(lock == NULL)
|
||||
goto out;
|
||||
#if defined(__THREAD_SAFE)
|
||||
{
|
||||
/* Allocate memory for an arbitration mechanism, then
|
||||
initialize it. */
|
||||
lock = AllocVec(sizeof(*lock),MEMF_ANY|MEMF_PUBLIC);
|
||||
if(lock == NULL)
|
||||
goto out;
|
||||
|
||||
InitSemaphore(lock);
|
||||
InitSemaphore(lock);
|
||||
}
|
||||
#else
|
||||
{
|
||||
lock = NULL;
|
||||
}
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
/* Check if this stream is attached to a console window. */
|
||||
if(default_file != ZERO)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_lock.c,v 1.1 2005-02-27 21:58:21 obarthel Exp $
|
||||
* $Id: stdio_lock.c,v 1.2 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -37,6 +37,10 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__THREAD_SAFE)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static struct SignalSemaphore * stdio_lock;
|
||||
|
||||
/****************************************************************************/
|
||||
@ -94,3 +98,7 @@ __stdio_lock_init(void)
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_openiob.c,v 1.9 2005-02-27 21:58:21 obarthel Exp $
|
||||
* $Id: stdio_openiob.c,v 1.10 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -165,13 +165,21 @@ __open_iob(const char *filename, const char *mode, int file_descriptor, int slot
|
||||
CLEAR_FLAG(fd->fd_Flags,FDF_APPEND);
|
||||
}
|
||||
|
||||
/* Allocate memory for an arbitration mechanism, then
|
||||
initialize it. */
|
||||
lock = AllocVec(sizeof(*lock),MEMF_ANY|MEMF_PUBLIC);
|
||||
if(lock == NULL)
|
||||
goto out;
|
||||
#if defined(__THREAD_SAFE)
|
||||
{
|
||||
/* Allocate memory for an arbitration mechanism, then
|
||||
initialize it. */
|
||||
lock = AllocVec(sizeof(*lock),MEMF_ANY|MEMF_PUBLIC);
|
||||
if(lock == NULL)
|
||||
goto out;
|
||||
|
||||
InitSemaphore(lock);
|
||||
InitSemaphore(lock);
|
||||
}
|
||||
#else
|
||||
{
|
||||
lock = NULL;
|
||||
}
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
/* Figure out the buffered file access mode by looking at the open mode. */
|
||||
file_flags = IOBF_IN_USE | IOBF_NO_NUL;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_popen.c,v 1.5 2005-02-03 16:56:16 obarthel Exp $
|
||||
* $Id: stdio_popen.c,v 1.6 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -64,6 +64,9 @@ pclose(FILE *stream)
|
||||
|
||||
assert(stream != NULL);
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(stream == NULL)
|
||||
@ -76,9 +79,6 @@ pclose(FILE *stream)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
fclose(stream);
|
||||
|
||||
/* ZZZ we actually could catch the program's termination code
|
||||
@ -117,6 +117,9 @@ popen(const char *command, const char *type)
|
||||
|
||||
assert(command != NULL && type != NULL);
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(command == NULL || type == NULL)
|
||||
@ -129,9 +132,6 @@ popen(const char *command, const char *type)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
/* The first character selects the access mode: read or write. We don't
|
||||
support anything else. */
|
||||
switch(type[0])
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_printf.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
|
||||
* $Id: stdio_printf.c,v 1.4 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -55,6 +55,9 @@ printf(const char *format, ...)
|
||||
|
||||
assert( format != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(format == NULL)
|
||||
@ -65,9 +68,6 @@ printf(const char *format, ...)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
va_start(arg,format);
|
||||
result = vfprintf(stdout,format,arg);
|
||||
va_end(arg);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_protos.h,v 1.9 2005-02-27 21:58:21 obarthel Exp $
|
||||
* $Id: stdio_protos.h,v 1.10 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -215,12 +215,4 @@ extern void __remove_fd_alias(struct fd * fd);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* stdio_lock.c */
|
||||
extern void __stdio_lock(void);
|
||||
extern void __stdio_unlock(void);
|
||||
extern void __stdio_lock_exit(void);
|
||||
extern int __stdio_lock_init(void);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* _STDIO_PROTOS_H */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_record_locking.c,v 1.3 2005-02-25 10:14:21 obarthel Exp $
|
||||
* $Id: stdio_record_locking.c,v 1.4 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -999,7 +999,9 @@ __handle_record_locking(int cmd,struct flock * l,struct fd * fd,int * error_ptr)
|
||||
|
||||
(*error_ptr) = EINTR;
|
||||
|
||||
__check_abort();
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_remove.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
|
||||
* $Id: stdio_remove.c,v 1.4 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -54,6 +54,9 @@ remove(const char *filename)
|
||||
|
||||
assert( filename != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(filename == NULL)
|
||||
@ -66,9 +69,6 @@ remove(const char *filename)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(UNIX_PATH_SEMANTICS)
|
||||
{
|
||||
result = unlink(filename);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_rename.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
|
||||
* $Id: stdio_rename.c,v 1.4 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -60,6 +60,9 @@ rename(const char *oldname,const char *newname)
|
||||
|
||||
assert( oldname != NULL && newname != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(oldname == NULL || newname == NULL)
|
||||
@ -72,9 +75,6 @@ rename(const char *oldname,const char *newname)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(UNIX_PATH_SEMANTICS)
|
||||
{
|
||||
if(__unix_path_semantics)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_scanf.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
|
||||
* $Id: stdio_scanf.c,v 1.4 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -55,6 +55,9 @@ scanf(const char *format, ...)
|
||||
|
||||
assert(format != NULL);
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(format == NULL)
|
||||
@ -67,9 +70,6 @@ scanf(const char *format, ...)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
va_start(arg,format);
|
||||
result = __vfscanf(stdin,format,arg);
|
||||
va_end(arg);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_snprintf.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
|
||||
* $Id: stdio_snprintf.c,v 1.4 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -60,6 +60,9 @@ snprintf(char *s, size_t size, const char *format, ...)
|
||||
assert( size == 0 || s != NULL );
|
||||
assert( (int)size >= 0);
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if((size > 0 && s == NULL) || format == NULL)
|
||||
@ -70,9 +73,6 @@ snprintf(char *s, size_t size, const char *format, ...)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
va_start(arg,format);
|
||||
result = vsnprintf(s,size,format,arg);
|
||||
va_end(arg);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_sprintf.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
|
||||
* $Id: stdio_sprintf.c,v 1.4 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -56,6 +56,9 @@ sprintf(char *s, const char *format, ...)
|
||||
|
||||
assert( s != NULL && format != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(s == NULL || format == NULL)
|
||||
@ -66,9 +69,6 @@ sprintf(char *s, const char *format, ...)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
va_start(arg,format);
|
||||
result = vsprintf(s,format,arg);
|
||||
va_end(arg);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_sscanf.c,v 1.5 2005-02-27 18:09:11 obarthel Exp $
|
||||
* $Id: stdio_sscanf.c,v 1.6 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -58,6 +58,9 @@ sscanf(const char *s,const char *format, ...)
|
||||
|
||||
assert( s != NULL && format != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(s == NULL || format == NULL)
|
||||
@ -70,9 +73,6 @@ sscanf(const char *s,const char *format, ...)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
__initialize_iob(&string_iob,__sscanf_hook_entry,
|
||||
NULL,
|
||||
local_buffer,sizeof(local_buffer),
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_vasprintf.c,v 1.8 2005-02-27 18:09:11 obarthel Exp $
|
||||
* $Id: stdio_vasprintf.c,v 1.9 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -71,6 +71,9 @@ __vasprintf(const char *file,int line,char **ret,const char *format,va_list arg)
|
||||
|
||||
assert( ret != NULL && format != NULL && arg != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(ret == NULL || format == NULL || format == arg)
|
||||
@ -83,9 +86,6 @@ __vasprintf(const char *file,int line,char **ret,const char *format,va_list arg)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
(*ret) = NULL;
|
||||
|
||||
__initialize_iob(&string_iob,__vasprintf_hook_entry,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_vprintf.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
|
||||
* $Id: stdio_vprintf.c,v 1.4 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -55,6 +55,9 @@ vprintf(const char *format,va_list arg)
|
||||
|
||||
assert( format != NULL && arg != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(format == NULL || arg == NULL)
|
||||
@ -65,9 +68,6 @@ vprintf(const char *format,va_list arg)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
result = vfprintf(stdout,format,arg);
|
||||
|
||||
out:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_vsnprintf.c,v 1.6 2005-02-27 18:09:11 obarthel Exp $
|
||||
* $Id: stdio_vsnprintf.c,v 1.7 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -63,6 +63,9 @@ vsnprintf(char *buffer,size_t size,const char *format,va_list arg)
|
||||
|
||||
assert( format != NULL && arg != NULL && (int)size >= 0 );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(format == NULL || (buffer == NULL && size > 0))
|
||||
@ -75,9 +78,6 @@ vsnprintf(char *buffer,size_t size,const char *format,va_list arg)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
__initialize_iob(&string_iob,__vsnprintf_hook_entry,
|
||||
NULL,
|
||||
local_buffer,sizeof(local_buffer),
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_vsprintf.c,v 1.5 2005-02-27 18:09:11 obarthel Exp $
|
||||
* $Id: stdio_vsprintf.c,v 1.6 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -52,6 +52,9 @@ vsprintf(char *s,const char *format,va_list arg)
|
||||
|
||||
assert( s != NULL && format != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(s == NULL || format == NULL)
|
||||
@ -62,9 +65,6 @@ vsprintf(char *s,const char *format,va_list arg)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
__initialize_iob(&string_iob,__vsprintf_hook_entry,
|
||||
NULL,
|
||||
buffer,sizeof(buffer),
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_free.c,v 1.7 2005-02-27 21:58:21 obarthel Exp $
|
||||
* $Id: stdlib_free.c,v 1.8 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -522,71 +522,3 @@ free(void * ptr)
|
||||
{
|
||||
__free(ptr,NULL,0);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void
|
||||
__memory_exit(void)
|
||||
{
|
||||
ENTER();
|
||||
|
||||
#ifdef __MEM_DEBUG
|
||||
{
|
||||
kprintf("[%s] %ld bytes still allocated upon exit, maximum of %ld bytes allocated at a time.\n",
|
||||
__program_name,__current_memory_allocated,__maximum_memory_allocated);
|
||||
|
||||
kprintf("[%s] %ld chunks of memory still allocated upon exit, maximum of %ld chunks allocated at a time.\n",
|
||||
__program_name,__current_num_memory_chunks_allocated,__maximum_num_memory_chunks_allocated);
|
||||
|
||||
__check_memory_allocations(__FILE__,__LINE__);
|
||||
|
||||
__never_free = FALSE;
|
||||
|
||||
if(__memory_list.mlh_Head != NULL)
|
||||
{
|
||||
while(NOT IsListEmpty((struct List *)&__memory_list))
|
||||
{
|
||||
((struct MemoryNode *)__memory_list.mlh_Head)->mn_AlreadyFree = FALSE;
|
||||
|
||||
__free_memory_node((struct MemoryNode *)__memory_list.mlh_Head,__FILE__,__LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__USE_MEM_TREES)
|
||||
{
|
||||
__initialize_red_black_tree(&__memory_tree);
|
||||
}
|
||||
#endif /* __USE_MEM_TREES */
|
||||
}
|
||||
#endif /* __MEM_DEBUG */
|
||||
|
||||
if(__memory_pool != NULL)
|
||||
{
|
||||
NewList((struct List *)&__memory_list);
|
||||
|
||||
DeletePool(__memory_pool);
|
||||
__memory_pool = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(__memory_list.mlh_Head != NULL)
|
||||
{
|
||||
#ifdef __MEM_DEBUG
|
||||
{
|
||||
while(NOT IsListEmpty((struct List *)&__memory_list))
|
||||
__free_memory_node((struct MemoryNode *)__memory_list.mlh_Head,__FILE__,__LINE__);
|
||||
}
|
||||
#else
|
||||
{
|
||||
while(NOT IsListEmpty((struct List *)&__memory_list))
|
||||
__free_memory_node((struct MemoryNode *)__memory_list.mlh_Head,NULL,0);
|
||||
}
|
||||
#endif /* __MEM_DEBUG */
|
||||
}
|
||||
}
|
||||
|
||||
FreeVec(__memory_semaphore);
|
||||
__memory_semaphore = NULL;
|
||||
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_getenv.c,v 1.3 2005-02-03 16:56:16 obarthel Exp $
|
||||
* $Id: stdlib_getenv.c,v 1.4 2005-02-28 10:07:31 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -55,6 +55,9 @@ getenv(const char * name)
|
||||
|
||||
assert( name != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(name == NULL)
|
||||
@ -67,9 +70,6 @@ getenv(const char * name)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
if(GetVar((STRPTR)name,env_var_buffer,sizeof(env_var_buffer),0) < 0)
|
||||
{
|
||||
SHOWMSG("couldn't get the variable");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_headers.h,v 1.10 2005-02-27 21:58:21 obarthel Exp $
|
||||
* $Id: stdlib_headers.h,v 1.11 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -198,10 +198,9 @@ extern unsigned int NOCOMMON __random_seed;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern struct SignalSemaphore * NOCOMMON __memory_semaphore;
|
||||
extern struct MemoryTree NOCOMMON __memory_tree;
|
||||
extern struct MinList NOCOMMON __memory_list;
|
||||
extern APTR NOCOMMON __memory_pool;
|
||||
extern struct MemoryTree NOCOMMON __memory_tree;
|
||||
extern struct MinList NOCOMMON __memory_list;
|
||||
extern APTR NOCOMMON __memory_pool;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -263,6 +262,28 @@ extern int NOCOMMON __default_puddle_size;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__THREAD_SAFE)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern void __memory_lock(void);
|
||||
extern void __memory_unlock(void);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#else
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define __memory_lock() ((void)0)
|
||||
#define __memory_unlock() ((void)0)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDLIB_PROTOS_H
|
||||
#include "stdlib_protos.h"
|
||||
#endif /* _STDLIB_PROTOS_H */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_malloc.c,v 1.8 2005-02-27 21:58:21 obarthel Exp $
|
||||
* $Id: stdlib_malloc.c,v 1.9 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -63,7 +63,6 @@ struct MemoryTree __memory_tree;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
struct SignalSemaphore * NOCOMMON __memory_semaphore;
|
||||
APTR NOCOMMON __memory_pool;
|
||||
struct MinList NOCOMMON __memory_list;
|
||||
|
||||
@ -267,11 +266,19 @@ malloc(size_t size)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__THREAD_SAFE)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static struct SignalSemaphore * memory_semaphore;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void
|
||||
__memory_lock(void)
|
||||
{
|
||||
if(__memory_semaphore != NULL)
|
||||
ObtainSemaphore(__memory_semaphore);
|
||||
if(memory_semaphore != NULL)
|
||||
ObtainSemaphore(memory_semaphore);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
@ -279,8 +286,84 @@ __memory_lock(void)
|
||||
void
|
||||
__memory_unlock(void)
|
||||
{
|
||||
if(__memory_semaphore != NULL)
|
||||
ReleaseSemaphore(__memory_semaphore);
|
||||
if(memory_semaphore != NULL)
|
||||
ReleaseSemaphore(memory_semaphore);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void
|
||||
__memory_exit(void)
|
||||
{
|
||||
ENTER();
|
||||
|
||||
#ifdef __MEM_DEBUG
|
||||
{
|
||||
kprintf("[%s] %ld bytes still allocated upon exit, maximum of %ld bytes allocated at a time.\n",
|
||||
__program_name,__current_memory_allocated,__maximum_memory_allocated);
|
||||
|
||||
kprintf("[%s] %ld chunks of memory still allocated upon exit, maximum of %ld chunks allocated at a time.\n",
|
||||
__program_name,__current_num_memory_chunks_allocated,__maximum_num_memory_chunks_allocated);
|
||||
|
||||
__check_memory_allocations(__FILE__,__LINE__);
|
||||
|
||||
__never_free = FALSE;
|
||||
|
||||
if(__memory_list.mlh_Head != NULL)
|
||||
{
|
||||
while(NOT IsListEmpty((struct List *)&__memory_list))
|
||||
{
|
||||
((struct MemoryNode *)__memory_list.mlh_Head)->mn_AlreadyFree = FALSE;
|
||||
|
||||
__free_memory_node((struct MemoryNode *)__memory_list.mlh_Head,__FILE__,__LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__USE_MEM_TREES)
|
||||
{
|
||||
__initialize_red_black_tree(&__memory_tree);
|
||||
}
|
||||
#endif /* __USE_MEM_TREES */
|
||||
}
|
||||
#endif /* __MEM_DEBUG */
|
||||
|
||||
if(__memory_pool != NULL)
|
||||
{
|
||||
NewList((struct List *)&__memory_list);
|
||||
|
||||
DeletePool(__memory_pool);
|
||||
__memory_pool = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(__memory_list.mlh_Head != NULL)
|
||||
{
|
||||
#ifdef __MEM_DEBUG
|
||||
{
|
||||
while(NOT IsListEmpty((struct List *)&__memory_list))
|
||||
__free_memory_node((struct MemoryNode *)__memory_list.mlh_Head,__FILE__,__LINE__);
|
||||
}
|
||||
#else
|
||||
{
|
||||
while(NOT IsListEmpty((struct List *)&__memory_list))
|
||||
__free_memory_node((struct MemoryNode *)__memory_list.mlh_Head,NULL,0);
|
||||
}
|
||||
#endif /* __MEM_DEBUG */
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__THREAD_SAFE)
|
||||
{
|
||||
FreeVec(memory_semaphore);
|
||||
memory_semaphore = NULL;
|
||||
}
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
@ -292,11 +375,15 @@ __memory_init(void)
|
||||
|
||||
ENTER();
|
||||
|
||||
__memory_semaphore = AllocVec(sizeof(*__memory_semaphore),MEMF_ANY|MEMF_PUBLIC);
|
||||
if(__memory_semaphore == NULL)
|
||||
goto out;
|
||||
#if defined(__THREAD_SAFE)
|
||||
{
|
||||
memory_semaphore = AllocVec(sizeof(*memory_semaphore),MEMF_ANY|MEMF_PUBLIC);
|
||||
if(memory_semaphore == NULL)
|
||||
goto out;
|
||||
|
||||
InitSemaphore(__memory_semaphore);
|
||||
InitSemaphore(memory_semaphore);
|
||||
}
|
||||
#endif /* __THREAD_SAFE */
|
||||
|
||||
#if defined(__USE_MEM_TREES) && defined(__MEM_DEBUG)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_mktemp.c,v 1.6 2005-02-03 16:56:16 obarthel Exp $
|
||||
* $Id: stdlib_mktemp.c,v 1.7 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -77,7 +77,8 @@ mktemp(char * name_template)
|
||||
|
||||
assert(name_template != NULL);
|
||||
|
||||
this_process = (struct Process *)FindTask(NULL);
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
@ -91,8 +92,7 @@ mktemp(char * name_template)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
this_process = (struct Process *)FindTask(NULL);
|
||||
|
||||
SHOWSTRING(name_template);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_protos.h,v 1.8 2005-02-27 21:58:21 obarthel Exp $
|
||||
* $Id: stdlib_protos.h,v 1.9 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -139,13 +139,11 @@ extern int __startup_init(void);
|
||||
|
||||
/* stdlib_malloc.c */
|
||||
extern int __memory_init(void);
|
||||
extern void __memory_exit(void);
|
||||
extern size_t __get_allocation_size(size_t size);
|
||||
extern void * __allocate_memory(size_t size,BOOL never_free,const char * file,int line);
|
||||
extern void __memory_lock(void);
|
||||
extern void __memory_unlock(void);
|
||||
|
||||
/* stdlib_free.c */
|
||||
extern void __memory_exit(void);
|
||||
extern struct MemoryNode * __find_memory_node(void * address);
|
||||
extern void __force_free(void * ptr,const char * file,int line);
|
||||
extern void __check_memory_allocations(const char * file,int line);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_putenv.c,v 1.4 2005-02-03 16:56:16 obarthel Exp $
|
||||
* $Id: stdlib_putenv.c,v 1.5 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -58,6 +58,9 @@ putenv(const char *string)
|
||||
|
||||
assert( string != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(string == NULL)
|
||||
@ -70,9 +73,6 @@ putenv(const char *string)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
result = setenv(string,"",1);
|
||||
|
||||
out:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_setenv.c,v 1.6 2005-02-03 16:56:17 obarthel Exp $
|
||||
* $Id: stdlib_setenv.c,v 1.7 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -106,6 +106,9 @@ setenv(const char *original_name, const char *original_value, int overwrite)
|
||||
|
||||
assert(original_name != NULL || original_value != NULL);
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(original_name == NULL && original_value == NULL)
|
||||
@ -118,9 +121,6 @@ setenv(const char *original_name, const char *original_value, int overwrite)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
if(name != NULL)
|
||||
{
|
||||
for(i = 0 ; i < strlen(name) ; i++)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_unsetenv.c,v 1.4 2005-02-03 16:56:17 obarthel Exp $
|
||||
* $Id: stdlib_unsetenv.c,v 1.5 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -60,7 +60,8 @@ unsetenv(const char *original_name)
|
||||
char * name_copy = NULL;
|
||||
unsigned i;
|
||||
|
||||
__check_abort();
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
assert( name != NULL );
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_access.c,v 1.4 2005-02-03 16:56:17 obarthel Exp $
|
||||
* $Id: unistd_access.c,v 1.5 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -63,6 +63,9 @@ access(const char * path_name, int mode)
|
||||
|
||||
assert( path_name != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(path_name == NULL)
|
||||
@ -75,9 +78,6 @@ access(const char * path_name, int mode)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
if(mode < 0 || mode > (R_OK|W_OK|X_OK|F_OK))
|
||||
{
|
||||
SHOWMSG("invalid mode");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_chdir.c,v 1.4 2005-02-03 16:56:17 obarthel Exp $
|
||||
* $Id: unistd_chdir.c,v 1.5 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -64,6 +64,9 @@ chdir(const char * path_name)
|
||||
|
||||
assert( path_name != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(path_name == NULL)
|
||||
@ -76,9 +79,6 @@ chdir(const char * path_name)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(UNIX_PATH_SEMANTICS)
|
||||
{
|
||||
if(__unix_path_semantics)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_chown.c,v 1.5 2005-02-03 16:56:17 obarthel Exp $
|
||||
* $Id: unistd_chown.c,v 1.6 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -65,6 +65,9 @@ chown(const char * path_name, uid_t owner, gid_t group)
|
||||
|
||||
assert( path_name != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(path_name == NULL)
|
||||
@ -77,9 +80,6 @@ chown(const char * path_name, uid_t owner, gid_t group)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
if(owner > 65535 || group > 65535)
|
||||
{
|
||||
SHOWMSG("invalid owner or group");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_getcwd.c,v 1.6 2005-02-03 16:56:17 obarthel Exp $
|
||||
* $Id: unistd_getcwd.c,v 1.7 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -81,6 +81,9 @@ __getcwd(char * buffer,size_t buffer_size,const char *file,int line)
|
||||
assert( buffer != NULL );
|
||||
assert( (int)buffer_size >= 0 );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(buffer == NULL || buffer_size == 0)
|
||||
@ -93,9 +96,6 @@ __getcwd(char * buffer,size_t buffer_size,const char *file,int line)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
PROFILE_OFF();
|
||||
dir_lock = Lock("",SHARED_LOCK);
|
||||
PROFILE_ON();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_getopt.c,v 1.4 2005-02-03 16:56:17 obarthel Exp $
|
||||
* $Id: unistd_getopt.c,v 1.5 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -70,6 +70,9 @@ getopt(int argc, char * argv[], char *opts)
|
||||
|
||||
assert( argc > 0 && argv != NULL && opts != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(argv == NULL || opts == NULL)
|
||||
@ -82,9 +85,6 @@ getopt(int argc, char * argv[], char *opts)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
SHOWVALUE(optind);
|
||||
|
||||
if(sp == 1)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_lchown.c,v 1.4 2005-02-03 16:56:17 obarthel Exp $
|
||||
* $Id: unistd_lchown.c,v 1.5 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -60,6 +60,9 @@ lchown(const char * path_name, uid_t owner, gid_t group)
|
||||
|
||||
assert( path_name != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(path_name == NULL)
|
||||
@ -72,9 +75,6 @@ lchown(const char * path_name, uid_t owner, gid_t group)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
result = chown(path_name,owner,group);
|
||||
|
||||
out:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_link.c,v 1.4 2005-02-03 16:56:17 obarthel Exp $
|
||||
* $Id: unistd_link.c,v 1.5 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -65,6 +65,9 @@ link(const char * existing_path,const char * new_path)
|
||||
|
||||
assert( existing_path != NULL && new_path != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(existing_path == NULL || new_path == NULL)
|
||||
@ -77,9 +80,6 @@ link(const char * existing_path,const char * new_path)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(UNIX_PATH_SEMANTICS)
|
||||
{
|
||||
if(__unix_path_semantics)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_readlink.c,v 1.4 2005-02-03 16:56:17 obarthel Exp $
|
||||
* $Id: unistd_readlink.c,v 1.5 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -66,6 +66,9 @@ readlink(const char * path_name, char * buffer, int buffer_size)
|
||||
|
||||
assert( path_name != NULL && buffer != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(path_name == NULL || buffer == NULL)
|
||||
@ -78,9 +81,6 @@ readlink(const char * path_name, char * buffer, int buffer_size)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(UNIX_PATH_SEMANTICS)
|
||||
{
|
||||
if(__unix_path_semantics && __translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_realpath.c,v 1.4 2005-02-03 16:56:17 obarthel Exp $
|
||||
* $Id: unistd_realpath.c,v 1.5 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -65,6 +65,9 @@ realpath(const char * path_name, char * buffer)
|
||||
|
||||
assert( path_name != NULL && buffer != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(path_name == NULL || buffer == NULL)
|
||||
@ -77,9 +80,6 @@ realpath(const char * path_name, char * buffer)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(UNIX_PATH_SEMANTICS)
|
||||
{
|
||||
if(__unix_path_semantics && __translate_unix_to_amiga_path_name(&path_name,&path_name_nti) != 0)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_symlink.c,v 1.4 2005-02-03 16:56:17 obarthel Exp $
|
||||
* $Id: unistd_symlink.c,v 1.5 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -63,6 +63,9 @@ symlink(const char * actual_path, const char * symbolic_path)
|
||||
|
||||
assert( actual_path != NULL && symbolic_path != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(actual_path == NULL || symbolic_path == NULL)
|
||||
@ -75,9 +78,6 @@ symlink(const char * actual_path, const char * symbolic_path)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
SHOWMSG("trying to make that link");
|
||||
|
||||
PROFILE_OFF();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_truncate.c,v 1.4 2005-02-03 16:56:17 obarthel Exp $
|
||||
* $Id: unistd_truncate.c,v 1.5 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -60,6 +60,9 @@ truncate(const char * path_name, off_t length)
|
||||
|
||||
assert( path_name != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(path_name == NULL)
|
||||
@ -72,9 +75,6 @@ truncate(const char * path_name, off_t length)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
if(length < 0)
|
||||
{
|
||||
SHOWMSG("invalid length");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_unlink.c,v 1.4 2005-02-03 16:56:17 obarthel Exp $
|
||||
* $Id: unistd_unlink.c,v 1.5 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -70,6 +70,9 @@ unlink(const char * path_name)
|
||||
|
||||
assert( path_name != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(path_name == NULL)
|
||||
@ -82,9 +85,6 @@ unlink(const char * path_name)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(UNIX_PATH_SEMANTICS)
|
||||
{
|
||||
if(__unix_path_semantics)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: utime_utime.c,v 1.6 2005-02-03 16:56:17 obarthel Exp $
|
||||
* $Id: utime_utime.c,v 1.7 2005-02-28 10:07:32 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -67,6 +67,9 @@ utime(const char * path_name,const struct utimbuf * times)
|
||||
|
||||
assert( path_name != NULL );
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
#if defined(CHECK_FOR_NULL_POINTERS)
|
||||
{
|
||||
if(path_name == NULL)
|
||||
@ -77,9 +80,6 @@ utime(const char * path_name,const struct utimbuf * times)
|
||||
}
|
||||
#endif /* CHECK_FOR_NULL_POINTERS */
|
||||
|
||||
if(__check_abort_enabled)
|
||||
__check_abort();
|
||||
|
||||
/* If a modification time is provided, convert it into the local
|
||||
DateStamp format, as used by the SetFileDate() function. */
|
||||
if(times != NULL)
|
||||
|
||||
Reference in New Issue
Block a user