Changeset 2905
- Timestamp:
- Dec 26, 2006, 1:24:25 AM (19 years ago)
- Location:
- trunk/libc/src/kNIX
- Files:
-
- 4 deleted
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libc/src/kNIX/b_ioClose.c
r2739 r2905 29 29 * Header Files * 30 30 *******************************************************************************/ 31 #include "kNIX.h" 31 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO 32 #include "kNix.h"33 #include <errno.h>34 #include <klibc/backend.h>35 33 #include <klibc/logstrict.h> 36 34 -
trunk/libc/src/kNIX/b_ioFileSizeSet.c
r2742 r2905 29 29 * Header Files * 30 30 *******************************************************************************/ 31 #include "kNIX.h" 31 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO 32 #include "kNIX.h"33 #include <klibc/backend.h>34 33 #include <klibc/logstrict.h> 35 34 -
trunk/libc/src/kNIX/b_ioRead.c
r2739 r2905 28 28 * Header Files * 29 29 *******************************************************************************/ 30 #include "kNIX.h" 30 31 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO 31 #include "kNIX.h"32 #include <errno.h>33 #include <klibc/backend.h>34 32 #include <klibc/logstrict.h> 35 33 … … 47 45 int __libc_Back_ioRead(int fh, void *pvBuf, size_t cbToRead, size_t *pcbRead) 48 46 { 49 LIBCLOG_ENTER("fh=%d pvBuf=%p cbToRead=%zu pcbRead=%p\n", fh, buf, cbToRead, (void *)pcbRead);47 LIBCLOG_ENTER("fh=%d pvBuf=%p cbToRead=%zu pcbRead=%p\n", fh, pvBuf, cbToRead, (void *)pcbRead); 50 48 *pcbRead = 0; 51 49 … … 59 57 rc = pFH->pOps->pfnRead(pFH, pvBuf, cbToRead, pcbRead); 60 58 LIBC_ASSERT(rc <= 0); 61 LIBC_ASSERT(*pcbRead <= cb Read);59 LIBC_ASSERT(*pcbRead <= cbToRead); 62 60 } 63 61 else … … 69 67 } 70 68 if (!rc) 71 LIBCLOG_RETURN_MSG(rc, "ret %d *pcbRead=%zu\n", rc, *pc Read);69 LIBCLOG_RETURN_MSG(rc, "ret %d *pcbRead=%zu\n", rc, *pcbRead); 72 70 LIBCLOG_ERROR_RETURN_INT(rc); 73 71 } -
trunk/libc/src/kNIX/b_ioSeek.c
r2742 r2905 29 29 * Header Files * 30 30 *******************************************************************************/ 31 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO32 31 #include "kNIX.h" 33 #include <errno.h> 34 #include <stdio.h> 35 #include <unistd.h> 36 #include <klibc/backend.h> 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO 37 33 #include <klibc/logstrict.h> 38 34 -
trunk/libc/src/kNIX/b_ioWrite.c
r2739 r2905 28 28 * Header Files * 29 29 *******************************************************************************/ 30 #include "kNIX.h" 30 31 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO 31 #include "libc-alias.h"32 #include <errno.h>33 #include <klibc/backend.h>34 32 #include <klibc/logstrict.h> 35 33 … … 47 45 int __libc_Back_ioWrite(int fh, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten) 48 46 { 49 LIBCLOG_ENTER("fh=%d pvBuf=%p cbToWrite=%zu pcbWritten=%p\n", fh, buf, cbToWrite, (void *)pcbWritten);47 LIBCLOG_ENTER("fh=%d pvBuf=%p cbToWrite=%zu pcbWritten=%p\n", fh, pvBuf, cbToWrite, (void *)pcbWritten); 50 48 *pcbWritten = 0; 51 49 … … 63 61 rc = pFH->pOps->pfnWrite(pFH, pvBuf, cbToWrite, pcbWritten); 64 62 LIBC_ASSERT(rc <= 0); 65 LIBC_ASSERT(*pcbWritten <= cb Written);63 LIBC_ASSERT(*pcbWritten <= cbToWrite); 66 64 } 67 65 } -
trunk/libc/src/kNIX/b_mmanBrk.c
r2739 r2905 29 29 * Header Files * 30 30 *******************************************************************************/ 31 #include "kNIX.h" 31 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_MMAN 32 #include "kNIX.h"33 #include <errno.h>34 #include <sys/fmutex.h>35 33 #include <klibc/logstrict.h> 36 34 … … 52 50 int rc = _fmutex_request(&__libc_back_gmtxHeap, _FMR_IGNINT); 53 51 if (rc) 54 LIBCLOG_ERROR_RETURN (-EDOOFUS);52 LIBCLOG_ERROR_RETURN_INT(-EDOOFUS); 55 53 56 54 /* -
trunk/libc/src/kNIX/b_mmanSBrk.c
r2739 r2905 28 28 * Header Files * 29 29 *******************************************************************************/ 30 #include "kNIX.h" 30 31 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_MMAN 31 #include "kNIX.h"32 #include <errno.h>33 #include <sys/fmutex.h>34 32 #include <klibc/logstrict.h> 35 33 … … 53 51 int rc = _fmutex_request(&__libc_back_gmtxHeap, _FMR_IGNINT); 54 52 if (rc) 55 LIBCLOG_ERROR_RETURN (-EDOOFUS);53 LIBCLOG_ERROR_RETURN_INT(-EDOOFUS); 56 54 57 55 /* -
trunk/libc/src/kNIX/b_mmanSBrkGetModel.c
r2739 r2905 28 28 * Header Files * 29 29 *******************************************************************************/ 30 #include "kNIX.h" 30 31 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_MMAN 31 #include "kNIX.h"32 #include <errno.h>33 #include <sys/fmutex.h>34 32 #include <klibc/logstrict.h> 35 33 … … 43 41 __LIBCSBRKMODEL __libc_Back_mmanSBrkGetModel(void) 44 42 { 45 LIBCLOG_ENTER("\n" ,);43 LIBCLOG_ENTER("\n"); 46 44 int rc = _fmutex_request(&__libc_back_gmtxHeap, _FMR_IGNINT); 47 45 if (rc) -
trunk/libc/src/kNIX/b_mmanSBrkSetModel.c
r2739 r2905 25 25 */ 26 26 27 27 28 /******************************************************************************* 28 29 * Header Files * 29 30 *******************************************************************************/ 31 #include "kNIX.h" 30 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_MMAN 31 #include "kNIX.h"32 #include <errno.h>33 #include <sys/fmutex.h>34 33 #include <klibc/logstrict.h> 35 34 … … 45 44 __LIBCSBRKMODEL __libc_Back_mmanSBrkSetModel(__LIBCSBRKMODEL enmModel) 46 45 { 47 LIBCLOG_ENTER("enmModel=%d\n", );46 LIBCLOG_ENTER("enmModel=%d\n", enmModel); 48 47 int rc = _fmutex_request(&__libc_back_gmtxHeap, _FMR_IGNINT); 49 48 if (rc) 50 LIBCLOG_ERROR_RETURN (-EDOOFUS);49 LIBCLOG_ERROR_RETURN_INT(-EDOOFUS); 51 50 52 51 const __LIBCSBRKMODEL enmOldModel = __libc_back_genmSBrkModel; -
trunk/libc/src/kNIX/b_processGetResourceLimit.c
r2805 r2905 26 26 27 27 28 29 28 /******************************************************************************* 30 29 * Header Files * 31 30 *******************************************************************************/ 31 #include "kNIX.h" 32 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_PROCESS 33 #include "kNIX.h"34 #include <errno.h>35 #include <sys/resource.h>36 #include <klibc/backend.h>37 33 #include <klibc/logstrict.h> 38 34 … … 91 87 } 92 88 } 93 LIBCLOG_RETURN_MSG(0, "ret 0 *pLimit={.rlim_cur=%#l x, .rlim_max=%#lx}\n", pLimit->rlim_cur, pLimit->rlim_max);89 LIBCLOG_RETURN_MSG(0, "ret 0 *pLimit={.rlim_cur=%#llx, .rlim_max=%#llx}\n", pLimit->rlim_cur, pLimit->rlim_max); 94 90 } 95 91 -
trunk/libc/src/kNIX/b_processSetResourceLimit.c
r2748 r2905 30 30 * Header Files * 31 31 *******************************************************************************/ 32 #include "kNIX.h" 32 33 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_PROCESS 33 #include "kNIX.h"34 #include <errno.h>35 #include <sys/resource.h>36 #include <klibc/backend.h>37 34 #include <klibc/logstrict.h> 38 35 … … 48 45 int __libc_Back_processSetResourceLimit(int iResId, const struct rlimit *pLimit) 49 46 { 50 LIBCLOG_ENTER("iResId=%d pLimit=%p:{.rlim_cur=%#l x, .rlim_max=%#lx}\n",47 LIBCLOG_ENTER("iResId=%d pLimit=%p:{.rlim_cur=%#llx, .rlim_max=%#llx}\n", 51 48 iResId, pLimit, pLimit->rlim_cur, pLimit->rlim_max); 52 49 /** @todo Implement __libc_Back_processSetResourceLimit(). */ 53 LIBCLOG_ERROR_RETURN_ MSG(-ENOSYS);50 LIBCLOG_ERROR_RETURN_INT(-ENOSYS); 54 51 } 55 52 -
trunk/libc/src/kNIX/b_signalSendPid.c
r2805 r2905 29 29 * Header Files * 30 30 *******************************************************************************/ 31 #include "kNIX.h" 31 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_SIGNAL 32 #include "kNIX.h"33 #include <klibc/logstrict.h> 33 34 #ifdef __OS2__ /* later on NT. */ 34 35 # include "os2/b_signal.h" -
trunk/libc/src/kNIX/backend.h
r2733 r2905 32 32 __BEGIN_DECLS 33 33 34 /** Wait Event Semaphore.35 * This is an event semaphore which will never be posted (unless we wanna resolve36 * some nasty deadlock in the future) but is used to wait for a signal to arrive.37 * When a signal arrives the wait will be interrupted to allow for execution of38 * the exception and signal processing. DosWaitEventSem will return ERROR_INTERRUPT.39 */40 extern unsigned long __libc_back_ghevWait;41 34 42 35 /** … … 47 40 int __libc_native2errno(unsigned long rc); 48 41 49 /**50 * Initializes the various LIBC hooks using the given51 * specification string.52 */53 void __libc_back_hooksInit(const char *pszSpec, unsigned long hmod);54 42 55 43 __END_DECLS -
trunk/libc/src/kNIX/filehandles.c
r2904 r2905 4 4 * kNIX File Handles. 5 5 * 6 * Copyright (c) 200 6 knut st. osmundsen <bird@innotek.de>6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@anduin.net> 7 7 * 8 8 * … … 29 29 * Header Files * 30 30 *******************************************************************************/ 31 #include "kNIX.h" 31 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_INITTERM 32 #include "kNIX.h" 33 33 #include <klibc/logstrict.h> 34 35 /** @todo remove these: */ 34 36 #include <InnoTekLIBC/fork.h> 35 37 #include <InnoTekLIBC/sharedpm.h> 36 38 #include <InnoTekLIBC/tcpip.h> 37 #include "b_fs.h"38 #include "b_dir.h"39 39 40 40 -
trunk/libc/src/kNIX/fs.c
r2903 r2905 29 29 * Header Files * 30 30 *******************************************************************************/ 31 #include "kNIX.h" 31 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 32 #define _GNU_SOURCE33 #include "kNIX.h"34 #include <klibc/backend.h>35 33 #include <klibc/logstrict.h> 36 34 … … 95 93 } 96 94 95 96 /** 97 * Request the owner ship of the FS mutex. 98 * 99 * @returns 0 on success. 100 * @returns -1 and errno on failure. 101 */ 97 102 int __libc_back_fsMutexRequest(void) 98 103 { … … 104 109 105 110 111 /** 112 * Releases the owner ship of the FS mutex obtained by __libc_back_fsMutexRelease(). 113 */ 106 114 void __libc_back_fsMutexRelease(void) 107 115 { -
trunk/libc/src/kNIX/heap.c
r2902 r2905 30 30 * Header Files * 31 31 *******************************************************************************/ 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_HEAP33 32 #include "kNIX.h" 34 #ifdef __OS2__ 35 # define INCL_DOSERRORS 36 # define INCL_FSMACROS 37 # define INCL_EXAPIS 38 # include <os2emx.h> 39 #endif 40 #ifdef __NT__ 41 # include <klibc/nt/nt.h> 42 #endif 43 #include <errno.h> 44 #include <klibc/backend.h> 33 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_HEAP 45 34 #include <klibc/logstrict.h> 46 47 35 48 36 … … 55 43 FS_VAR_SAVE_LOAD(); 56 44 int rc = DosFreeMemEx((void *)ObjPtr); 57 LIBC_ASSERTM(!rc, vs"ObjPtr=%prc=%d\n", ObjPtr, rc); (void)rc;45 LIBC_ASSERTM(!rc, "ObjPtr=%tx rc=%d\n", ObjPtr, rc); (void)rc; 58 46 FS_RESTORE(); 59 47 … … 243 231 void *__libc_back_heapExpandBy(uintptr_t incr, __LIBCSBRKMODEL enmSBrkModel) 244 232 { 245 LIBCLOG_ENTER("incr=% penmSBrkModel=%d\n", incr, enmSBrkModel);233 LIBCLOG_ENTER("incr=%tx enmSBrkModel=%d\n", incr, enmSBrkModel); 246 234 const unsigned old_obj_count = __libc_back_gcHeapObjs; 247 235 … … 353 341 void *__libc_back_heapShrinkTo(uintptr_t new_brk) 354 342 { 355 LIBCLOG_ENTER("new_brk=% ld\n", new_brk);343 LIBCLOG_ENTER("new_brk=%tx\n", new_brk); 356 344 357 345 /* … … 448 436 void *__libc_back_heapShrinkBy(uintptr_t decr, __LIBCSBRKMODEL enmSBrkModel) 449 437 { 450 LIBCLOG_ENTER("decr=% ldenmSBrkModel=%d\n", decr, enmSBrkModel);438 LIBCLOG_ENTER("decr=%tx enmSBrkModel=%d\n", decr, enmSBrkModel); 451 439 if ( __libc_back_gcHeapObjs != 0 452 440 && __libc_back_gpHeapTopObj->brk - decr >= __libc_back_gpHeapTopObj->base) -
trunk/libc/src/kNIX/kNIX.h
r2904 r2905 30 30 31 31 #include "libc-alias.h" 32 #if def __OS2__32 #if defined(__OS2__) 33 33 # include <klibc/os2/os2.h> 34 34 # include "os2/kNIXConfig.h" … … 55 55 #include <klibc/thread.h> 56 56 #include <klibc/backend.h> 57 #ifdef __LIBC_LOG_GROUP58 # include <klibc/logstrict.h>59 #endif60 57 61 58 … … 64 61 /** File handle operations for 'files'. */ 65 62 extern const __LIBC_FHOPS __libc_back_gFileOps; 63 64 /** @name Directories 65 * @{ 66 */ 67 68 /** 69 * A directory handle. 70 */ 71 typedef struct __LIBC_FHDIR 72 { 73 /** The common fh core. */ 74 __LIBC_FH Core; 75 #ifdef __OS2__ 76 /** The directory handle. */ 77 HDIR hDir; 78 /** Set if the path is in the unix tree, else clear. 79 * This is for fchdir() handling. */ 80 unsigned fInUnixTree; 81 /** The find operation type. */ 82 unsigned fType; 83 union 84 { 85 /** Pointer to the old kind of buffer. */ 86 PFILEFINDBUF4 p4; 87 /** Pointer to the large file kind of buffer. */ 88 PFILEFINDBUF4L p4L; 89 /** Byte pointer used to advance the buffer entries. */ 90 uint8_t *pu8; 91 /** Void pointer. */ 92 void *pv; 93 } 94 /** Pointer to the find buffer. 95 * This is located in low memory. */ 96 uBuf, 97 /** Pointer to the current buffer position. 98 * This is invalid if cFiles is 0. */ 99 uCur; 100 /** The number of files left in the buffer. */ 101 ULONG cFiles; 102 /** The size of the find buffer. */ 103 unsigned cbBuf; 104 /** Current entry number (total, for seeking). */ 105 unsigned uCurEntry; 106 #endif /* __OS2__ */ 107 } __LIBC_FHDIR; 108 /** Pointer to the a directory handle. */ 109 typedef __LIBC_FHDIR *__LIBC_PFHDIR; 110 111 int __libc_Back_dirOpenNative(char *pszNativePath, unsigned fInUnixTree, unsigned fLibc, struct stat *pStat); 112 int __libc_back_dirInherit(int fh, const char *pszNativePath, unsigned fInUnixTree, unsigned fFlags, 113 ino_t Inode, dev_t Dev, unsigned uCurEntry); 114 ssize_t __libc_back_dirGetEntries(__LIBC_PFHDIR pFHDir, void *pvBuf, size_t cbBuf); 115 /** @} */ 116 117 66 118 67 119 /** @name Heap … … 166 218 */ 167 219 int __libc_back_sys_processGetResourceLimit(int iResId, struct rlimit *pLimit); 220 int __libc_back_native2errno(int rc); 221 void __libc_back_hooksInit(const char *pszSpec, uintptr_t hmod); 168 222 /** @} */ 169 223 … … 186 240 * Include the target specific parts. 187 241 */ 188 #if def __OS2__242 #if defined(__OS2__) 189 243 # include "os2/kNIX-os2.h" 190 244 #elif defined(__NT__) -
trunk/libc/src/kNIX/os2/kNIX-os2.h
r2903 r2905 4 4 * kNIX - The OS/2 specific bits of the Main header. 5 5 * 6 * Copyright (c) 200 6 knut st. osmundsen <bird-srcspam@anduin.net>6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@anduin.net> 7 7 * 8 8 * … … 219 219 int __libc_back_fsInheritPack(__LIBC_PSPMINHFS *ppFS, size_t *pcbFS, __LIBC_PSPMINHFS2 *ppFS2, size_t *pcbFS2); 220 220 221 222 /** Wait Event Semaphore. 223 * This is an event semaphore which will never be posted (unless we wanna resolve 224 * some nasty deadlock in the future) but is used to wait for a signal to arrive. 225 * When a signal arrives the wait will be interrupted to allow for execution of 226 * the exception and signal processing. DosWaitEventSem will return ERROR_INTERRUPT. 227 */ 228 extern unsigned long __libc_back_ghevWait; 229 221 230 __END_DECLS 222 231 -
trunk/libc/src/kNIX/os2/seterrno.c
r2732 r2905 1 /* sys/seterrno.c (emx+gcc) -- Copyright (c) 1992-1998 by Eberhard Mattes */ 1 /* $Id: $ */ 2 /** @file 3 * 4 * kNIX - Error convertion from OS/2 to errno.h. 5 * 6 * Copyright (c) 1992-1998 by Eberhard Mattes 7 * Copyright (c) 2006 knut st. osmundsen <bird@anduin.net> 8 * 9 * 10 * This file is part of kLIBC. 11 * 12 * kLIBC is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU Lesser General Public License as published 14 * by the Free Software Foundation; either version 2 of the License, or 15 * (at your option) any later version. 16 * 17 * kLIBC is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU Lesser General Public License for more details. 21 * 22 * You should have received a copy of the GNU Lesser General Public License 23 * along with kLIBC; if not, write to the Free Software 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 * 26 */ 2 27 3 #include "libc-alias.h" 4 #include <errno.h> 5 #include "syscalls.h" 6 #include " backend.h"28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 31 #include "kNIX.h" 7 32 8 static unsigned char const errno_tab[] = 33 34 /******************************************************************************* 35 * Global Variables * 36 *******************************************************************************/ 37 static unsigned char const g_auchOS2ToErrno[] = 9 38 { 10 39 EINVAL, EINVAL, ENOENT, ENOENT, EMFILE, /* 0..4 */ … … 78 107 79 108 80 void _sys_set_errno (unsigned long rc) 109 /** 110 * Converts a native error code to an error.h code. 111 * 112 * @returns errno.h error code. 113 * @param rc Native error code. 114 */ 115 int __libc_back_native2errno(int rc) 81 116 { 82 if (rc >= sizeof (errno_tab)) 83 errno = EINVAL; 84 else 85 errno = errno_tab[rc]; 117 if ((unsigned)rc < sizeof(g_auchOS2ToErrno)) 118 return g_auchOS2ToErrno[rc]; 119 return EINVAL; 86 120 } 87 121 88 int __libc_native2errno 122 int __libc_native2errno(unsigned long rc) 89 123 { 90 if (rc >= sizeof (errno_tab)) 91 return EINVAL; 92 return errno_tab[rc]; 124 return __libc_back_native2errno((int)rc); 93 125 } 94 126 -
trunk/libc/src/kNIX/thread.c
r2819 r2905 4 4 * kUNIX - Thread Management. 5 5 * 6 * Copyright (c) 2006 knut st. osmundsen <bird @innotek.de>6 * Copyright (c) 2006 knut st. osmundsen <bird-srcspam@innotek.de> 7 7 * 8 8 * … … 30 30 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_THREAD 31 31 #include "kNIX.h" 32 33 32 34 33 … … 219 218 { 220 219 LIBCLOG_ENTER("\n"); 220 221 221 /* 222 222 * No need to use the pre allocated here since the current thread will
Note:
See TracChangeset
for help on using the changeset viewer.