Changeset 2914
- Timestamp:
- Dec 27, 2006, 7:56:09 PM (19 years ago)
- Location:
- trunk/libc
- Files:
-
- 2 added
- 7 deleted
- 43 edited
- 1 copied
- 8 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/libc/include/klibc/backend.h
r2913 r2914 295 295 296 296 /** 297 * Removes a newdirectory.297 * Removes a directory. 298 298 * 299 299 * @returns 0 on success. … … 654 654 */ 655 655 int __libc_Back_miscLoadAvg(double *pardAvgs, unsigned cAvgs); 656 657 /** 658 * Get the console size if the current session is associated with a console. 659 * 660 * @returns 0 on success. 661 * @returns Negative error code (errno.h) on failure. 662 * @param pcRows Where to store the row count. 663 * @param pcColumns Where to store the column count. 664 */ 665 int __libc_Back_miscConsoleSize(int *pcRows, int *pcColumns); 656 666 657 667 /** @} */ -
trunk/libc/include/klibc/os2/os2.h
r2805 r2914 38 38 39 39 #include <os2emx.h> 40 #include <os2thunk.h> 40 41 41 42 #endif -
trunk/libc/src/kNIX/Makefile.kmk
r2913 r2914 34 34 libc_kNIX_TEMPLATE = libcsub 35 35 libc_kNIX_SOURCES = \ 36 $(PATH_LIBC_SRC)/kNIX/b_fsPathResolve.c \ 37 $(PATH_LIBC_SRC)/kNIX/b_fsSymlinkModeSet.c \ 38 $(PATH_LIBC_SRC)/kNIX/b_fsSymlinkCreate.c \ 39 $(PATH_LIBC_SRC)/kNIX/b_fsFileTimesSet.c \ 40 $(PATH_LIBC_SRC)/kNIX/b_fsDirRemove.c \ 41 $(PATH_LIBC_SRC)/kNIX/b_fsFileModeSet.c \ 42 $(PATH_LIBC_SRC)/kNIX/b_fsFileStat.c \ 36 43 $(PATH_LIBC_SRC)/kNIX/b_fsSymlinkRead.c \ 37 44 $(PATH_LIBC_SRC)/kNIX/b_fsSymlinkStat.c \ … … 67 74 $(PATH_LIBC_SRC)/kNIX/os2/b_fsDirCurrentSet.c \ 68 75 $(PATH_LIBC_SRC)/kNIX/os2/b_fsDirCurrentSetFH.c \ 69 $(PATH_LIBC_SRC)/kNIX/os2/b_fs DirRemove.c \76 $(PATH_LIBC_SRC)/kNIX/os2/b_fsNativeDirRemove.c \ 70 77 $(PATH_LIBC_SRC)/kNIX/os2/b_fsDriveDefaultGet.c \ 71 78 $(PATH_LIBC_SRC)/kNIX/os2/b_fsDriveDefaultSet.c \ 72 $(PATH_LIBC_SRC)/kNIX/os2/b_fsFileModeSet.c \73 79 $(PATH_LIBC_SRC)/kNIX/os2/b_fsFileModeSetFH.c \ 74 $(PATH_LIBC_SRC)/kNIX/os2/b_fsFileStat.c \75 80 $(PATH_LIBC_SRC)/kNIX/os2/b_fsFileStatFH.c \ 76 $(PATH_LIBC_SRC)/kNIX/os2/b_fsFileTimesSet.c \77 81 $(PATH_LIBC_SRC)/kNIX/os2/b_fsFileTimesSetFH.c \ 78 82 $(PATH_LIBC_SRC)/kNIX/os2/b_fsNativeFileModeSet.c \ 79 83 $(PATH_LIBC_SRC)/kNIX/os2/b_fsNativeFileStat.c \ 80 84 $(PATH_LIBC_SRC)/kNIX/os2/b_fsNativeFileTimesSet.c \ 81 $(PATH_LIBC_SRC)/kNIX/os2/b_fsPathResolve.c \82 85 $(PATH_LIBC_SRC)/kNIX/os2/b_fsRename.c \ 83 86 $(PATH_LIBC_SRC)/kNIX/os2/b_fsStat.c \ 84 $(PATH_LIBC_SRC)/kNIX/os2/b_fsSymlinkCreate.c \85 $(PATH_LIBC_SRC)/kNIX/os2/b_fsSymlinkModeSet.c \86 87 $(PATH_LIBC_SRC)/kNIX/os2/b_fsSync.c \ 87 88 $(PATH_LIBC_SRC)/kNIX/os2/b_fsUnlink.c \ … … 92 93 $(PATH_LIBC_SRC)/kNIX/os2/b_ldrSymbol.c \ 93 94 $(PATH_LIBC_SRC)/kNIX/os2/b_miscLoadAvg.c \ 95 $(PATH_LIBC_SRC)/kNIX/os2/b_miscConsoleSize.c \ 94 96 $(PATH_LIBC_SRC)/kNIX/os2/b_mmanProtect.c \ 95 97 $(PATH_LIBC_SRC)/kNIX/os2/b_nativeSymlinkCreate.c \ … … 153 155 $(PATH_LIBC_SRC)/kNIX/os2/resource.c \ 154 156 $(PATH_LIBC_SRC)/kNIX/os2/safesems.c \ 155 $(PATH_LIBC_SRC)/kNIX/os2/scrsize.c \ 156 $(PATH_LIBC_SRC)/kNIX/os2/seterrno.c \ 157 $(PATH_LIBC_SRC)/kNIX/os2/__libc_back_native2errno.c \ 157 158 $(PATH_LIBC_SRC)/kNIX/os2/sharedpm.c \ 158 159 $(PATH_LIBC_SRC)/kNIX/os2/signals.c \ -
trunk/libc/src/kNIX/b_fsDirRemove.c
r2913 r2914 25 25 */ 26 26 27 28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 31 #include "libc-alias.h" 32 #define INCL_FSMACROS 33 #define INCL_ERRORS 34 #include <os2emx.h> 35 #include "b_fs.h" 36 #include <errno.h> 37 #include <sys/stat.h> 38 #include <InnoTekLIBC/backend.h> 27 #include "kNIX.h" 39 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 40 #include <InnoTekLIBC/logstrict.h> 41 29 #include <klibc/logstrict.h> 42 30 43 31 /** 44 * Removes a newdirectory.32 * Removes a directory. 45 33 * 46 34 * @returns 0 on success. … … 50 38 int __libc_Back_fsDirRemove(const char *pszPath) 51 39 { 52 LIBCLOG_ENTER("pszPath=%s\n", pszPath); 53 FS_VAR(); 40 LIBCLOG_ENTER("pszPath=%p:{%s}\n", (void *)pszPath, pszPath); 54 41 55 42 /* 56 * Resolve the path. 57 * (Symlinks should cause failure, so don't resolve last component.) 43 * Resolve the path and execute the operation on the native path. 58 44 */ 59 45 char szNativePath[PATH_MAX]; 60 46 int rc = __libc_back_fsResolve(pszPath, BACKFS_FLAGS_RESOLVE_FULL_SYMLINK | BACKFS_FLAGS_RESOLVE_DIR, &szNativePath[0], NULL); 61 if ( rc)62 LIBCLOG_RETURN_INT(rc);47 if (!rc) 48 rc = __libc_back_fsNativeDirRemove(szNativePath); 63 49 64 /* 65 * Do It. 66 */ 67 FS_SAVE_LOAD(); 68 rc = DosDeleteDir((PCSZ)&szNativePath[0]); 69 FS_RESTORE(); 70 if (!rc) 71 LIBCLOG_RETURN_INT(rc); 72 73 74 /* 75 * OS/2 returns access denied when the directory 76 * contains files or it is not a directory. Check for 77 * directory/other and return failure accordingly. 78 */ 79 if (rc == ERROR_ACCESS_DENIED) 80 { 81 struct stat s; 82 rc = __libc_back_fsNativeFileStat(&szNativePath[0], &s); 83 if (!rc) 84 rc = S_ISDIR(s.st_mode) ? -ENOTEMPTY : -ENOTDIR; 85 } 86 else 87 rc = -__libc_native2errno(rc); 88 LIBCLOG_ERROR_RETURN_INT(rc); 50 LIBCLOG_MIX_RETURN_INT(rc); 89 51 } 90 52 -
trunk/libc/src/kNIX/b_fsFileModeSet.c
r2913 r2914 25 25 */ 26 26 27 /******************************************************************************* 28 * Header Files * 29 *******************************************************************************/ 30 #include "b_fs.h" 31 #include <sys/stat.h> 32 #include <InnoTekLIBC/backend.h> 27 #include "kNIX.h" 33 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 34 #include <InnoTekLIBC/logstrict.h> 35 29 #include <klibc/logstrict.h> 36 30 37 31 /** -
trunk/libc/src/kNIX/b_fsFileStat.c
r2913 r2914 2 2 /** @file 3 3 * 4 * kNIX - stat .4 * kNIX - stat(). 5 5 * 6 6 * Copyright (c) 2004 knut st. osmundsen <bird-src-spam@innotek.de> … … 25 25 */ 26 26 27 28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 31 #include "b_fs.h" 32 #include <sys/stat.h> 33 #include <InnoTekLIBC/backend.h> 27 #include "kNIX.h" 34 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 35 #include <InnoTekLIBC/logstrict.h> 36 29 #include <klibc/logstrict.h> 37 30 38 31 /** -
trunk/libc/src/kNIX/b_fsFileTimesSet.c
r2913 r2914 25 25 */ 26 26 27 /******************************************************************************* 28 * Header Files * 29 *******************************************************************************/ 30 #include "b_fs.h" 31 #include <sys/stat.h> 32 #include <InnoTekLIBC/backend.h> 27 #include "kNIX.h" 33 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 34 #include <InnoTekLIBC/logstrict.h> 35 29 #include <klibc/logstrict.h> 36 30 37 31 /** -
trunk/libc/src/kNIX/b_fsPathResolve.c
r2913 r2914 4 4 * kNIX - realpath. 5 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird-src-spam@innotek.de>6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@innotek.de> 7 7 * 8 8 * … … 25 25 */ 26 26 27 28 29 /******************************************************************************* 30 * Header Files * 31 *******************************************************************************/ 32 #include "libc-alias.h" 33 #define INCL_BASE 34 #include <os2emx.h> 35 #include "b_fs.h" 36 #include <errno.h> 37 #include <string.h> 38 #include <InnoTekLIBC/backend.h> 27 #include "kNIX.h" 39 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 40 #include <InnoTekLIBC/logstrict.h> 41 29 #include <klibc/logstrict.h> 42 30 43 31 … … 91 79 } 92 80 93 -
trunk/libc/src/kNIX/b_fsSymlinkCreate.c
r2913 r2914 25 25 */ 26 26 27 28 29 /******************************************************************************* 30 * Header Files * 31 *******************************************************************************/ 32 #include "b_fs.h" 33 #include <string.h> 34 #include <errno.h> 35 #include <InnoTekLIBC/backend.h> 27 #include "kNIX.h" 36 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 37 #include <InnoTekLIBC/logstrict.h> 38 29 #include <klibc/logstrict.h> 39 30 40 31 /** -
trunk/libc/src/kNIX/b_fsSymlinkModeSet.c
r2913 r2914 25 25 */ 26 26 27 /******************************************************************************* 28 * Header Files * 29 *******************************************************************************/ 30 #include "b_fs.h" 31 #include <sys/stat.h> 32 #include <InnoTekLIBC/backend.h> 27 #include "kNIX.h" 33 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 34 #include <InnoTekLIBC/logstrict.h> 35 29 #include <klibc/logstrict.h> 36 30 37 31 /** -
trunk/libc/src/kNIX/kNIX.h
r2913 r2914 28 28 #define __kNIX_h__ 29 29 30 #define _GNU_SOURCE 30 31 31 32 #include "libc-alias.h" … … 41 42 #include <errno.h> 42 43 #include <malloc.h> 44 #include <share.h> 45 #include <signal.h> 43 46 #include <string.h> 44 #include <signal.h>45 47 #include <process.h> 46 48 #include <sys/builtin.h> … … 48 50 #include <sys/fmutex.h> 49 51 #include <sys/fcntl.h> 52 #include <sys/mman.h> 50 53 #include <sys/mount.h> 51 54 #include <sys/resource.h> … … 205 208 int __libc_back_fsUnixAttribsGet(int hFile, const char *pszNativePath, struct stat *pStat); 206 209 int __libc_back_fsUnixAttribsGetMode(int hFile, const char *pszNativePath, mode_t *pMode); 210 int __libc_back_fsNativeDirRemove(const char *pszNativePath); 207 211 int __libc_back_fsNativeSymlinkCreate(const char *pszTarget, char *pszNativePath); 208 212 int __libc_back_fsNativeSymlinkRead(const char *pszNativePath, char *pachBuf, size_t cchBuf); -
trunk/libc/src/kNIX/os2/DosEx.c
r2913 r2914 877 877 if (rc) 878 878 { 879 rc = -__libc_ native2errno(rc);879 rc = -__libc_back_native2errno(rc); 880 880 LIBCLOG_ERROR_RETURN_INT(rc); 881 881 } … … 1012 1012 pEntry->u.MemAlloc.pv, pEntry->u.MemAlloc.cb, pEntry->u.MemAlloc.flFlags, rc); 1013 1013 if (rc) 1014 return -__libc_ native2errno(rc);1014 return -__libc_back_native2errno(rc); 1015 1015 return 0; 1016 1016 } … … 1036 1036 LIBC_ASSERTM(!rc, "DosGetSharedMem(%p,%#lx) -> rc=%d\n", pEntry->u.MemOpen.pv, pEntry->u.MemOpen.flFlags, rc); 1037 1037 if (rc) 1038 return -__libc_ native2errno(rc);1038 return -__libc_back_native2errno(rc); 1039 1039 } 1040 1040 return 0; … … 1074 1074 LIBC_ASSERTM_FAILED("DosCreateMutexSem(,,%#lx,0) -> rc=%d\n", flFlags, rc); 1075 1075 pBundle->cUsed = i; 1076 rc = -__libc_ native2errno(rc);1076 rc = -__libc_back_native2errno(rc); 1077 1077 break; 1078 1078 } … … 1138 1138 LIBC_ASSERTM(!rc, "DosOpenMutexSem(,%#lx) -> rc=%d\n", pEntry->u.MutexOpen.hmtx, rc); 1139 1139 if (rc) 1140 return -__libc_ native2errno(rc);1140 return -__libc_back_native2errno(rc); 1141 1141 } 1142 1142 return 0; … … 1177 1177 LIBC_ASSERTM_FAILED("DosCreateEventSem(,,%#lx,%d) -> rc=%d\n", flFlags, cPostings > 0, rc); 1178 1178 pBundle->cUsed = i; 1179 rc = -__libc_ native2errno(rc);1179 rc = -__libc_back_native2errno(rc); 1180 1180 break; 1181 1181 } … … 1240 1240 LIBC_ASSERTM(!rc, "DosOpenEventSem(,%#lx) -> rc=%d\n", pEntry->u.EventOpen.hev, rc); 1241 1241 if (rc) 1242 return -__libc_ native2errno(rc);1242 return -__libc_back_native2errno(rc); 1243 1243 } 1244 1244 return 0; … … 1266 1266 LIBC_ASSERTM(!rc, "DosQueryModuleName(%#lx,%d,%p) -> rc=%d \n", pEntry->u.LoadModule.hmte, sizeof(szName), szName, rc); 1267 1267 if (rc) 1268 return -__libc_ native2errno(rc);1268 return -__libc_back_native2errno(rc); 1269 1269 } 1270 1270 … … 1278 1278 LIBC_ASSERTM(!rc, "DosLoadModule(,,'%s',) -> rc=%d (hmte=%#lx)\n", szName, rc, pEntry->u.LoadModule.hmte); 1279 1279 if (rc) 1280 return -__libc_ native2errno(rc);1280 return -__libc_back_native2errno(rc); 1281 1281 } 1282 1282 return 0; -
trunk/libc/src/kNIX/os2/__libc_back_native2errno.c
r2905 r2914 120 120 } 121 121 122 int __libc_native2errno(unsigned long rc)123 {124 return __libc_back_native2errno((int)rc);125 }126 -
trunk/libc/src/kNIX/os2/__select.c
r2913 r2914 65 65 if (!rc || rc == ERROR_TIMEOUT || rc == ERROR_SEM_TIMEOUT) 66 66 return 0; 67 errno = __libc_ native2errno(rc);67 errno = __libc_back_native2errno(rc); 68 68 return -1; 69 69 } -
trunk/libc/src/kNIX/os2/b_fsDirCurrentGet.c
r2913 r2914 4 4 * kNIX - getcwd. 5 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird-src-spam@innotek.de>6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@innotek.de> 7 7 * 8 8 * … … 29 29 * Header Files * 30 30 *******************************************************************************/ 31 #include "libc-alias.h" 32 #define INCL_FSMACROS 33 #include <os2emx.h> 34 #include "b_fs.h" 35 #include <string.h> 36 #include <errno.h> 37 #include <InnoTekLIBC/backend.h> 38 #include <InnoTekLIBC/libc.h> 31 #include "kNIX.h" 39 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 40 #include < InnoTekLIBC/logstrict.h>33 #include <klibc/logstrict.h> 41 34 42 35 … … 45 38 *******************************************************************************/ 46 39 static void slashify(char *psz); 40 47 41 48 42 /** … … 144 138 /* release the fs lock. */ 145 139 __libc_back_fsMutexRelease(); 146 if (!__libc_gfNoUnix) 147 { 148 szNativePath[2] = '/'; 149 slashify(&szNativePath[3]); 150 } 140 szNativePath[2] = '/'; 141 slashify(&szNativePath[3]); 151 142 pszSrc = &szNativePath[0]; 152 143 } … … 177 168 } 178 169 179 -
trunk/libc/src/kNIX/os2/b_fsDirCurrentSet.c
r2913 r2914 25 25 */ 26 26 27 28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 31 #include "libc-alias.h" 32 #define INCL_FSMACROS 33 #include <os2emx.h> 34 #include "b_fs.h" 35 #include <InnoTekLIBC/backend.h> 27 #include "kNIX.h" 36 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 37 #include <InnoTekLIBC/logstrict.h> 38 29 #include <klibc/logstrict.h> 39 30 40 31 /** -
trunk/libc/src/kNIX/os2/b_fsDirCurrentSetFH.c
r2913 r2914 29 29 * Header Files * 30 30 *******************************************************************************/ 31 #include "libc-alias.h" 32 #define INCL_FSMACROS 33 #include <os2emx.h> 34 #include "b_fs.h" 35 #include "b_dir.h" 36 #include <errno.h> 37 #include <emx/io.h> 38 #include <InnoTekLIBC/backend.h> 31 #include "kNIX.h" 39 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 40 #include < InnoTekLIBC/logstrict.h>33 #include <klibc/logstrict.h> 41 34 42 35 … … 52 45 { 53 46 LIBCLOG_ENTER("fh=%d fDrive=%d\n", fh, fDrive); 54 FS_VAR();55 47 56 48 /* … … 58 50 */ 59 51 __LIBC_PFH pFH; 60 int rc = __libc_FH Ex(fh, &pFH);52 int rc = __libc_FHGet(fh, &pFH); 61 53 if (rc) 62 54 LIBCLOG_ERROR_RETURN_INT(rc); 63 55 if ((pFH->fFlags & __LIBC_FH_TYPEMASK) != F_DIR) 56 { 57 __libc_FHPut(pFH); 64 58 LIBCLOG_ERROR_RETURN_INT(-ENOTDIR); 59 } 65 60 __LIBC_PFHDIR pFHDir = (__LIBC_PFHDIR)pFH; 66 61 … … 70 65 rc = __libc_back_fsMutexRequest(); 71 66 if (rc) 67 { 68 __libc_FHPut(pFH); 72 69 LIBCLOG_ERROR_RETURN_INT(rc); 70 } 73 71 74 72 /* … … 79 77 * when in the unix compartement or when fDrive is set. 80 78 */ 81 FS_ SAVE_LOAD();79 FS_VAR_SAVE_LOAD(); 82 80 rc = DosSetCurrentDir((PCSZ)pFHDir->Core.pszNativePath); 83 81 if (!rc) … … 101 99 102 100 __libc_back_fsMutexRelease(); 103 if (!rc) 104 LIBCLOG_RETURN_INT(rc); 105 LIBCLOG_ERROR_RETURN_INT(rc); 101 __libc_FHPut(pFH); 102 LIBCLOG_MIX_RETURN_INT(rc); 106 103 } 107 104 -
trunk/libc/src/kNIX/os2/b_fsDriveDefaultGet.c
r2913 r2914 25 25 */ 26 26 27 28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 31 #include "libc-alias.h" 32 #define INCL_FSMACROS 33 #include <os2emx.h> 34 #include "b_fs.h" 35 #include <InnoTekLIBC/backend.h> 27 #include "kNIX.h" 36 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 37 #include <InnoTekLIBC/logstrict.h> 38 29 #include <klibc/logstrict.h> 39 30 40 31 /** … … 68 59 } 69 60 70 -
trunk/libc/src/kNIX/os2/b_fsDriveDefaultSet.c
r2913 r2914 25 25 */ 26 26 27 28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 31 #include "libc-alias.h" 32 #define INCL_FSMACROS 33 #include <os2emx.h> 34 #include "b_fs.h" 35 #include <InnoTekLIBC/backend.h> 27 #include "kNIX.h" 36 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 37 #include < InnoTekLIBC/logstrict.h>29 #include <klibc/logstrict.h> 38 30 39 31 … … 70 62 71 63 __libc_back_fsMutexRelease(); 72 73 if (!rc) 74 LIBCLOG_RETURN_INT(rc); 75 LIBCLOG_ERROR_RETURN_INT(rc); 64 LIBCLOG_MIX_RETURN_INT(rc); 76 65 } 77 66 -
trunk/libc/src/kNIX/os2/b_fsFileModeSetFH.c
r2913 r2914 25 25 */ 26 26 27 28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 31 #include "libc-alias.h" 32 #define INCL_FSMACROS 33 #define INCL_ERRORS 34 #include <os2emx.h> 35 #include "b_fs.h" 36 #include <string.h> 37 #include <errno.h> 38 #include <sys/types.h> 39 #include <sys/stat.h> 40 #include <sys/fcntl.h> 41 #include <emx/io.h> 42 #include <emx/syscalls.h> 43 #include <limits.h> 44 #include "syscalls.h" 45 #include <InnoTekLIBC/libc.h> 46 #include <InnoTekLIBC/backend.h> 27 #include "kNIX.h" 47 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 48 #include <InnoTekLIBC/logstrict.h> 49 29 #include <klibc/logstrict.h> 50 30 51 31 … … 65 45 * Get filehandle. 66 46 */ 67 PLIBCFH pFH;68 int rc = __libc_FH Ex(fh, &pFH);47 __LIBC_PFH pFH; 48 int rc = __libc_FHGet(fh, &pFH); 69 49 if (rc) 70 50 LIBCLOG_ERROR_RETURN_INT(rc); … … 78 58 case F_SOCKET: 79 59 case F_PIPE: /* treat as socket for now */ 60 __libc_FHPut(pFH); 80 61 LIBCLOG_ERROR_RETURN_INT(-EINVAL); 81 62 /* ignore */ 82 63 case F_DEV: 64 __libc_FHPut(pFH); 83 65 LIBCLOG_RETURN_INT(0); 84 66 … … 86 68 case F_DIR: 87 69 if (__predict_false(!pFH->pszNativePath)) 88 LIBCLOG_ERROR_RETURN_INT(-EINVAL); 89 rc = __libc_back_fsNativeFileModeSet(pFH->pszNativePath, Mode); 70 rc = -EINVAL; 71 else 72 rc = __libc_back_fsNativeFileModeSet(pFH->pszNativePath, Mode); 73 __libc_FHPut(pFH); 90 74 if (rc) 91 75 LIBCLOG_ERROR_RETURN_INT(rc); … … 113 97 if (rc) 114 98 { 99 __libc_FHPut(pFH); 115 100 FS_RESTORE(); 116 101 rc = -__libc_native2errno(rc); … … 121 106 * If in unix mode we'll have to update/add the MODE too. 122 107 */ 123 if ( !__libc_gfNoUnix 124 && pFH->pFsInfo 108 if ( pFH->pFsInfo 125 109 && pFH->pFsInfo->fUnixEAs) 126 110 { … … 179 163 if (__predict_false(rc != 0)) 180 164 { 165 __libc_FHPut(pFH); 181 166 FS_RESTORE(); 182 167 LIBCLOG_ERROR_RETURN_INT(rc); … … 195 180 if (rc) 196 181 { 182 __libc_FHPut(pFH); 197 183 rc = -__libc_native2errno(rc); 198 184 LIBCLOG_ERROR_RETURN_INT(rc); … … 204 190 * Non-standard handle - fail. 205 191 */ 192 __libc_FHPut(pFH); 206 193 LIBCLOG_ERROR_RETURN_INT(-EOPNOTSUPP); 207 194 } 208 195 196 __libc_FHPut(pFH); 209 197 LIBCLOG_RETURN_INT(0); 210 198 } -
trunk/libc/src/kNIX/os2/b_fsFileStatFH.c
r2913 r2914 129 129 */ 130 130 /* Times: FAT might not return create and access time. */ 131 pStat->st_ctime = pStat->st_mtime = _ sys_p2t(info.fsts4.ftimeLastWrite, info.fsts4.fdateLastWrite);131 pStat->st_ctime = pStat->st_mtime = __libc_back_timeFileTime2Unix(info.fsts4.ftimeLastWrite, info.fsts4.fdateLastWrite); 132 132 if ( FTIMEZEROP(info.fsts4.ftimeCreation) 133 133 && FDATEZEROP(info.fsts4.fdateCreation)) 134 134 pStat->st_birthtime = pStat->st_mtime; 135 135 else 136 pStat->st_birthtime = _ sys_p2t(info.fsts4.ftimeCreation, info.fsts4.fdateCreation);136 pStat->st_birthtime = __libc_back_timeFileTime2Unix(info.fsts4.ftimeCreation, info.fsts4.fdateCreation); 137 137 if ( FTIMEZEROP(info.fsts4.ftimeLastAccess) 138 138 && FDATEZEROP(info.fsts4.fdateLastAccess)) 139 139 pStat->st_atime = pStat->st_mtime; 140 140 else 141 pStat->st_atime = _ sys_p2t(info.fsts4.ftimeLastAccess, info.fsts4.fdateLastAccess);141 pStat->st_atime = __libc_back_timeFileTime2Unix(info.fsts4.ftimeLastAccess, info.fsts4.fdateLastAccess); 142 142 143 143 #if OFF_MAX > LONG_MAX -
trunk/libc/src/kNIX/os2/b_fsNativeDirRemove.c
r2913 r2914 25 25 */ 26 26 27 28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 31 #include "libc-alias.h" 32 #define INCL_FSMACROS 33 #define INCL_ERRORS 34 #include <os2emx.h> 35 #include "b_fs.h" 36 #include <errno.h> 37 #include <sys/stat.h> 38 #include <InnoTekLIBC/backend.h> 27 #include "kNIX.h" 39 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 40 #include <InnoTekLIBC/logstrict.h> 41 29 #include <klibc/logstrict.h> 42 30 43 31 /** 44 * Removes a newdirectory.32 * Removes a directory. 45 33 * 46 34 * @returns 0 on success. 47 * @returns -1 and errnoon failure.48 * @param psz Path Path to the directory which is to be removed.35 * @returns Negated error code on failure. 36 * @param pszNativePath Native path to the directory which is to be removed. 49 37 */ 50 int __libc_ Back_fsDirRemove(const char *pszPath)38 int __libc_back_fsNativeDirRemove(const char *pszNativePath) 51 39 { 52 LIBCLOG_ENTER("psz Path=%s\n", pszPath);40 LIBCLOG_ENTER("pszNativePath=%p:{%s}\n", (void *)pszNativePath, pszNativePath); 53 41 FS_VAR(); 54 42 55 43 /* 56 * Resolve the path. 57 * (Symlinks should cause failure, so don't resolve last component.) 58 */ 59 char szNativePath[PATH_MAX]; 60 int rc = __libc_back_fsResolve(pszPath, BACKFS_FLAGS_RESOLVE_FULL_SYMLINK | BACKFS_FLAGS_RESOLVE_DIR, &szNativePath[0], NULL); 61 if (rc) 62 LIBCLOG_RETURN_INT(rc); 63 64 /* 65 * Do It. 44 * Try 66 45 */ 67 46 FS_SAVE_LOAD(); 68 rc = DosDeleteDir((PCSZ)&szNativePath[0]);47 int rc = DosDeleteDir((PCSZ)pszNativePath); 69 48 FS_RESTORE(); 70 49 if (!rc) 71 50 LIBCLOG_RETURN_INT(rc); 72 73 51 74 52 /* … … 80 58 { 81 59 struct stat s; 82 rc = __libc_back_fsNativeFileStat( &szNativePath[0], &s);60 rc = __libc_back_fsNativeFileStat(pszNativePath, &s); 83 61 if (!rc) 84 62 rc = S_ISDIR(s.st_mode) ? -ENOTEMPTY : -ENOTDIR; -
trunk/libc/src/kNIX/os2/b_fsNativeFileStat.c
r2913 r2914 25 25 */ 26 26 27 28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 31 #include "libc-alias.h" 32 #define INCL_BASE 33 #define INCL_FSMACROS 34 #include <os2emx.h> 35 #include "b_fs.h" 36 #include <string.h> 37 #include <errno.h> 38 #include <sys/types.h> 39 #include <sys/stat.h> 40 #include <stdlib.h> 41 #include <limits.h> 42 #include "syscalls.h" 43 #include <InnoTekLIBC/libc.h> 44 #include <InnoTekLIBC/pathrewrite.h> 27 #include "kNIX.h" 45 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 46 #include <InnoTekLIBC/logstrict.h> 47 29 #include <klibc/logstrict.h> 48 30 49 31 /** … … 138 120 */ 139 121 /* Times: FAT might not return create and access time. */ 140 pStat->st_mtime = pStat->st_ctime = _ sys_p2t(info.fsts4.ftimeLastWrite, info.fsts4.fdateLastWrite);122 pStat->st_mtime = pStat->st_ctime = __libc_back_timeFileTime2Unix(info.fsts4.ftimeLastWrite, info.fsts4.fdateLastWrite); 141 123 if ( FTIMEZEROP(info.fsts4.ftimeCreation) 142 124 && FDATEZEROP(info.fsts4.fdateCreation)) 143 125 pStat->st_birthtime = pStat->st_mtime; 144 126 else 145 pStat->st_birthtime = _ sys_p2t(info.fsts4.ftimeCreation, info.fsts4.fdateCreation);127 pStat->st_birthtime = __libc_back_timeFileTime2Unix(info.fsts4.ftimeCreation, info.fsts4.fdateCreation); 146 128 if ( FTIMEZEROP(info.fsts4.ftimeLastAccess) 147 129 && FDATEZEROP(info.fsts4.fdateLastAccess)) 148 130 pStat->st_atime = pStat->st_mtime; 149 131 else 150 pStat->st_atime = _ sys_p2t(info.fsts4.ftimeLastAccess, info.fsts4.fdateLastAccess);132 pStat->st_atime = __libc_back_timeFileTime2Unix(info.fsts4.ftimeLastAccess, info.fsts4.fdateLastAccess); 151 133 152 134 #if OFF_MAX > LONG_MAX -
trunk/libc/src/kNIX/os2/b_fsNativeFileTimesSet.c
r2913 r2914 25 25 */ 26 26 27 28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 31 #include "libc-alias.h" 32 #define INCL_BASE 33 #define INCL_FSMACROS 34 #include <os2emx.h> 35 #include "b_fs.h" 36 #include "b_time.h" 37 #include <string.h> 38 #include <errno.h> 39 #include <stdlib.h> 40 #include <limits.h> 41 #include <sys/types.h> 42 #include <sys/stat.h> 43 #include <sys/timeb.h> 44 #include "syscalls.h" 45 #include <emx/syscalls.h> 46 #include <emx/time.h> 47 #include <InnoTekLIBC/libc.h> 27 #include "kNIX.h" 48 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 49 #include <InnoTekLIBC/logstrict.h> 50 29 #include <klibc/logstrict.h> 51 30 52 31 /** … … 89 68 time_t aTimes[2]; /* seconds since 1970 */ 90 69 if (!paTimes) 91 { 92 struct timeb TimeBuf; 93 __ftime(&TimeBuf); 94 aTimes[0] = TimeBuf.time; 95 aTimes[1] = TimeBuf.time; 96 } 70 aTimes[0] = aTimes[1] = fibGetUnixSeconds(); 97 71 else 98 72 { 99 if (!_ tzset_flag)73 if (!__libc_gfTZInfoOk) 100 74 tzset(); 101 75 aTimes[0] = paTimes[0].tv_sec; -
trunk/libc/src/kNIX/os2/b_ioFileControl.c
r2913 r2914 100 100 /* failure! */ 101 101 if (rc > 0) 102 rc = -__libc_ native2errno(rc);102 rc = -__libc_back_native2errno(rc); 103 103 *prc = -1; 104 104 LIBCLOG_ERROR_RETURN_INT(rc); -
trunk/libc/src/kNIX/os2/b_ioFileOpen.c
r2913 r2914 2 2 /** @file 3 3 * 4 * kNIX - open .5 * 6 * Copyright (c) 2003-200 5knut st. osmundsen <bird-src-spam@innotek.de>4 * kNIX - open, OS/2. 5 * 6 * Copyright (c) 2003-2006 knut st. osmundsen <bird-src-spam@innotek.de> 7 7 * Copyright (c) 1992-1996 by Eberhard Mattes 8 8 * … … 30 30 * Header Files * 31 31 *******************************************************************************/ 32 #include "libc-alias.h" 33 #define INCL_DOSERRORS 34 #define INCL_FSMACROS 35 #include <os2emx.h> 36 #include "b_fs.h" 37 #include "b_dir.h" 38 #include <string.h> 39 #include <errno.h> 40 #include <limits.h> 41 #include <share.h> 42 #include <sys/stat.h> 43 #include <sys/fcntl.h> 44 #include <emx/umalloc.h> 45 #include <emx/syscalls.h> 46 #include <emx/io.h> 47 #include "syscalls.h" 48 #include <InnoTekLIBC/backend.h> 49 #include <InnoTekLIBC/libc.h> 32 #include "kNIX.h" 50 33 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO 51 #include < InnoTekLIBC/logstrict.h>34 #include <klibc/logstrict.h> 52 35 53 36 #define SH_MASK 0x70 … … 66 49 * for the opened file. 67 50 */ 68 int __libc_Back_ioFileOpen(const char *pszFile, unsigned fLibc, int fShare, off_t cbInitial, mode_t Mode, PLIBCFH *ppFH)51 int __libc_Back_ioFileOpen(const char *pszFile, unsigned fLibc, int fShare, off_t cbInitial, mode_t Mode, __LIBC_PFH *ppFH) 69 52 { 70 53 LIBCLOG_ENTER("pszFile=%p:{%s} fLibc=%#x fShare=%#x cbInitial=%lld Mode=0%o ppFH=%p\n", … … 157 140 ino_t Inode = 0; 158 141 PEAOP2 pEaOp2 = NULL; 159 if (!__libc_gfNoUnix) 142 /* 143 * Stat the file to see if it's there, and if it is what kind of file it is. 144 * For some of the file types there are race conditions involved, but we don't care. 145 */ 146 struct stat st; 147 rc = __libc_back_fsNativeFileStat(szNativePath, &st); 148 if (!rc) 160 149 { 161 150 /* 162 * Stat the file to see if it's there, and if it is what kind of file it is.163 * For some of the file types there are race conditions involved, but we don't care.151 * If we're truncating a file and no Mode bits are specified, we'll 152 * use the ones from the original file. 164 153 */ 165 struct stat st; 166 rc = __libc_back_fsNativeFileStat(szNativePath, &st); 167 if (!rc) 168 { 169 /* 170 * If we're truncating a file and no Mode bits are specified, we'll 171 * use the ones from the original file. 172 */ 173 /** @todo Check if O_TRUNC and the OS/2 semantics really match.. I don't think O_TRUNC mean replace really. */ 174 Mode &= ALLPERMS; 175 if (!Mode && (fLibc & (O_CREAT | O_TRUNC)) == O_TRUNC) 176 Mode = st.st_mode; 177 178 /* 179 * Take action based on the type of file we're facing. 180 */ 181 switch (st.st_mode & S_IFMT) 182 { 183 /* 184 * Regular file: Presently we don't have to do anything special. 185 */ 186 case S_IFREG: 154 /** @todo Check if O_TRUNC and the OS/2 semantics really match.. I don't think O_TRUNC mean replace really. */ 155 Mode &= ALLPERMS; 156 if (!Mode && (fLibc & (O_CREAT | O_TRUNC)) == O_TRUNC) 157 Mode = st.st_mode; 158 159 /* 160 * Take action based on the type of file we're facing. 161 */ 162 switch (st.st_mode & S_IFMT) 163 { 164 /* 165 * Regular file: Presently we don't have to do anything special. 166 */ 167 case S_IFREG: 168 { 169 /** @todo handle st_flags. */ 170 break; 171 } 172 173 /* 174 * Directory: Open it as a directory. 175 */ 176 case S_IFDIR: 177 { 178 /** @todo add ppFH to the argument list of __libc_Back_dirOpenNative() */ 179 rc = __libc_Back_dirOpenNative(szNativePath, fInUnixTree, fLibc, &st); 180 if (rc >= 0) 187 181 { 188 /** @todo handle st_flags. */ 189 break; 182 if (ppFH) 183 __libc_FHGet(rc, ppFH); 184 LIBCLOG_RETURN_INT(rc); 190 185 } 191 192 /* 193 * Directory: Open it as a directory. 194 */ 195 case S_IFDIR: 196 { 197 rc = __libc_Back_dirOpenNative(szNativePath, fInUnixTree, fLibc, &st); 198 if (rc >= 0) 199 { 200 if (ppFH) 201 *ppFH = __libc_FH(rc); 202 LIBCLOG_RETURN_INT(rc); 203 } 204 LIBCLOG_ERROR_RETURN_INT(rc); 205 break; 206 } 207 208 /* 209 * Named Pipe: Open / create the named pipe. 210 */ 211 case S_IFIFO: 212 { 213 /** @todo implement named pipes. */ 214 LIBCLOG_ERROR_RETURN_INT(-ENOTSUP); 215 } 216 217 /* 218 * Character device or Block device: 219 * Translate the major/minor to an OS/2 device name and open that. 220 */ 221 case S_IFCHR: 222 case S_IFBLK: 223 { 224 /** @todo assign major & minor numbers and do translations. */ 225 LIBCLOG_ERROR_RETURN_INT(-ENOTSUP); 226 } 227 228 /* 229 * Symbolic link: These cannot be opened by open(). 230 */ 231 case S_IFLNK: 232 LIBCLOG_ERROR_RETURN_INT(-EMLINK); 233 234 235 /* 236 * Local socket: Open the local socket. 237 */ 238 case S_IFSOCK: 239 { 240 /** @todo integrate sockets with libc. */ 241 LIBCLOG_ERROR_RETURN_INT(-ENOTSUP); 242 } 243 244 /* 245 * Stat cannot return anything else. 246 */ 247 default: 248 __libc_Back_panic(0, NULL, "Invalid file type returned in st_mode=%x for '%s'\n", st.st_mode, szNativePath); 249 break; 250 } 251 } 252 /* else: didn't find it, just go ahead. */ 253 254 /* 255 * Create Unix attributes for a file which is potentially created / replaced. 256 */ 257 Mode &= ~__libc_gfsUMask; 258 Mode &= ACCESSPERMS; 259 Mode |= S_IFREG; 260 if ( (flOpenFlags & (OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_REPLACE_IF_EXISTS)) 261 && __libc_back_fsInfoSupportUnixEAs(szNativePath)) 262 { 263 pEaOp2 = alloca(sizeof(EAOP2) + sizeof(__libc_gFsUnixAttribsCreateFEA2List)); 264 struct __LIBC_FSUNIXATTRIBSCREATEFEA2LIST *pFEas = (struct __LIBC_FSUNIXATTRIBSCREATEFEA2LIST *)(pEaOp2 + 1); 265 *pFEas = __libc_gFsUnixAttribsCreateFEA2List; 266 Dev = __libc_back_fsUnixAttribsInit(pFEas, szNativePath, Mode); 267 Inode = pFEas->u64INO; 268 pEaOp2->fpGEA2List = NULL; 269 pEaOp2->fpFEA2List = (PFEA2LIST)pFEas; 270 pEaOp2->oError = 0; 271 } 272 } 273 else 274 { 275 /* Normalize the mode mask and calc the file attributes. */ 276 Mode &= ~__libc_gfsUMask; 277 Mode &= ACCESSPERMS; 278 Mode |= S_IFREG; 186 LIBCLOG_ERROR_RETURN_INT(rc); 187 break; 188 } 189 190 /* 191 * Named Pipe: Open / create the named pipe. 192 */ 193 case S_IFIFO: 194 { 195 /** @todo implement named pipes. */ 196 LIBCLOG_ERROR_RETURN_INT(-ENOTSUP); 197 } 198 199 /* 200 * Character device or Block device: 201 * Translate the major/minor to an OS/2 device name and open that. 202 */ 203 case S_IFCHR: 204 case S_IFBLK: 205 { 206 /** @todo assign major & minor numbers and do translations. */ 207 LIBCLOG_ERROR_RETURN_INT(-ENOTSUP); 208 } 209 210 /* 211 * Symbolic link: These cannot be opened by open(). 212 */ 213 case S_IFLNK: 214 LIBCLOG_ERROR_RETURN_INT(-EMLINK); 215 216 /* 217 * Local socket: Open the local socket. 218 */ 219 case S_IFSOCK: 220 { 221 /** @todo integrate sockets with libc. */ 222 LIBCLOG_ERROR_RETURN_INT(-ENOTSUP); 223 } 224 225 /* 226 * Stat cannot return anything else. 227 */ 228 default: 229 __libc_Back_panic(0, NULL, "Invalid file type returned in st_mode=%x for '%s'\n", st.st_mode, szNativePath); 230 break; 231 } 232 } 233 /* else: didn't find it, just go ahead. */ 234 235 /* 236 * Create Unix attributes for a file which is potentially created / replaced. 237 */ 238 Mode &= ~__libc_gfsUMask; 239 Mode &= ACCESSPERMS; 240 Mode |= S_IFREG; 241 if ( (flOpenFlags & (OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_REPLACE_IF_EXISTS)) 242 && __libc_back_fsInfoSupportUnixEAs(szNativePath)) 243 { 244 pEaOp2 = alloca(sizeof(EAOP2) + sizeof(__libc_gFsUnixAttribsCreateFEA2List)); 245 struct __LIBC_FSUNIXATTRIBSCREATEFEA2LIST *pFEas = (struct __LIBC_FSUNIXATTRIBSCREATEFEA2LIST *)(pEaOp2 + 1); 246 *pFEas = __libc_gFsUnixAttribsCreateFEA2List; 247 Dev = __libc_back_fsUnixAttribsInit(pFEas, szNativePath, Mode); 248 Inode = pFEas->u64INO; 249 pEaOp2->fpGEA2List = NULL; 250 pEaOp2->fpFEA2List = (PFEA2LIST)pFEas; 251 pEaOp2->oError = 0; 279 252 } 280 253 … … 402 375 rc = rcOpenFailed; 403 376 else 404 rc = -__libc_ native2errno(rc);377 rc = -__libc_back_native2errno(rc); 405 378 LIBCLOG_ERROR_RETURN_INT(rc); 406 379 } -
trunk/libc/src/kNIX/os2/b_ldrClose.c
r2913 r2914 2 2 /** @file 3 3 * 4 * kNIX - dlclose .4 * kNIX - dlclose, OS/2. 5 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird-src-spam@innotek.de>6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@innotek.de> 7 7 * 8 8 * … … 29 29 * Header Files * 30 30 *******************************************************************************/ 31 #include "libc-alias.h" 32 #define INCL_BASE 33 #define INCL_EXAPIS 34 #define INCL_FSMACROS 35 #include <os2emx.h> 36 #include <InnoTekLIBC/backend.h> 31 #include "kNIX.h" 37 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_LDR 38 #include < InnoTekLIBC/logstrict.h>33 #include <klibc/logstrict.h> 39 34 40 35 … … 46 41 * @param pvModule Module handle. 47 42 */ 48 int 43 int __libc_Back_ldrClose(void *pvModule) 49 44 { 50 45 LIBCLOG_ENTER("pvModule=%p\n", pvModule); … … 58 53 } 59 54 60 61 -
trunk/libc/src/kNIX/os2/b_ldrOpen.c
r2913 r2914 2 2 /** @file 3 3 * 4 * kNIX - dlopen .4 * kNIX - dlopen, OS/2. 5 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird-src-spam@innotek.de>6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@innotek.de> 7 7 * 8 8 * … … 25 25 */ 26 26 27 28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 31 #include "libc-alias.h" 32 #define INCL_BASE 33 #define INCL_FSMACROS 34 #define INCL_EXAPIS 35 #include <os2emx.h> 36 #include <InnoTekLIBC/backend.h> 27 #include "kNIX.h" 37 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_LDR 38 #include <InnoTekLIBC/logstrict.h> 39 29 #include <klibc/logstrict.h> 40 30 41 31 /** … … 66 56 } 67 57 68 69 -
trunk/libc/src/kNIX/os2/b_ldrSymbol.c
r2913 r2914 2 2 /** @file 3 3 * 4 * kNIX - dlsym .4 * kNIX - dlsym, OS/2. 5 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird-src-spam@innotek.de>6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-src-spam@innotek.de> 7 7 * 8 8 * … … 25 25 */ 26 26 27 28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 31 #include "libc-alias.h" 32 #define INCL_BASE 33 #define INCL_FSMACROS 34 #include <os2emx.h> 35 #include <InnoTekLIBC/backend.h> 27 #include "kNIX.h" 36 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_LDR 37 #include <InnoTekLIBC/logstrict.h> 38 29 #include <klibc/logstrict.h> 39 30 40 31 /** … … 68 59 } 69 60 70 71 -
trunk/libc/src/kNIX/os2/b_miscLoadAvg.c
r2913 r2914 4 4 * kNIX - System Load Averages. 5 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net>6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@anduin.net> 7 7 * 8 8 * … … 29 29 * Header Files * 30 30 *******************************************************************************/ 31 #include "libc-alias.h" 32 #include <stdlib.h> 33 #include <errno.h> 31 #include "kNIX.h" 34 32 #include <math.h> 35 #include <emx/umalloc.h> 36 #include <InnoTekLIBC/backend.h> 37 #include <InnoTekLIBC/sharedpm.h> 38 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC 39 #include <InnoTekLIBC/logstrict.h> 40 41 #define INCL_DOSPROFILE 42 #define INCL_DOSERRORS 43 #define INCL_FSMACROS 44 #include <os2emx.h> 45 33 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_MISC 34 #include <klibc/logstrict.h> 46 35 47 36 /* … … 55 44 * Internal Functions * 56 45 *******************************************************************************/ 46 static int miscUpdateLoadAvg(__LIBC_PSPMLOADAVG pLoadAvg, unsigned uTimestamp); 57 47 58 48 /** -
trunk/libc/src/kNIX/os2/b_mmanProtect.c
r2913 r2914 2 2 /** @file 3 3 * 4 * kNIX - mprotect() .4 * kNIX - mprotect(), OS/2. 5 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net>6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@anduin.net> 7 7 * 8 8 * … … 25 25 */ 26 26 27 28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 31 #include "libc-alias.h" 32 #define INCL_FSMACROS 33 #define INCL_BASE 34 #include <os2emx.h> 35 #include "b_mman.h" 36 #include <string.h> 37 #include <errno.h> 38 #include <sys/mman.h> 39 #include <InnoTekLIBC/backend.h> 40 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_MMAN 41 #include <InnoTekLIBC/logstrict.h> 42 43 27 #include "kNIX.h" 28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_MMAN 29 #include <klibc/logstrict.h> 44 30 45 31 /** … … 114 100 { 115 101 FS_RESTORE(); 116 rc = -__libc_ native2errno(rc);102 rc = -__libc_back_native2errno(rc); 117 103 LIBCLOG_ERROR_RETURN_MSG(rc, "ret %d (pvChunk=%p)\n", rc, pvChunk); 118 104 } … … 147 133 { 148 134 FS_RESTORE(); 149 rc = -__libc_ native2errno(rc);135 rc = -__libc_back_native2errno(rc); 150 136 LIBCLOG_ERROR_RETURN_MSG(rc, "ret %d (pvChunk=%p)\n", rc, pvChunk); 151 137 } … … 168 154 { 169 155 FS_RESTORE(); 170 rc = -__libc_ native2errno(rc);156 rc = -__libc_back_native2errno(rc); 171 157 LIBCLOG_ERROR_RETURN_MSG(rc, "ret %d (pvChunk=%p)\n", rc, pvChunk); 172 158 } -
trunk/libc/src/kNIX/os2/b_nativeSymlinkCreate.c
r2913 r2914 29 29 * Header Files * 30 30 *******************************************************************************/ 31 #include "libc-alias.h" 32 #define INCL_FSMACROS 33 #define INCL_ERRORS 34 #include <os2emx.h> 35 #include "b_fs.h" 36 #include "syscalls.h" 37 #include <errno.h> 38 #include <string.h> 39 #include <sys/stat.h> 40 #include <InnoTekLIBC/libc.h> 41 #include <InnoTekLIBC/backend.h> 31 #include "kNIX.h" 42 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 43 #include < InnoTekLIBC/logstrict.h>33 #include <klibc/logstrict.h> 44 34 45 35 … … 106 96 107 97 /* 108 * This call isn't available in Non-Unix mode - we don't handle symlinks there.109 */110 if (__predict_false(__libc_gfNoUnix != 0))111 LIBCLOG_ERROR_RETURN(-ENOSYS, "ret -ENOSYS - __libc_gfNoUnix=%d\n", __libc_gfNoUnix);112 113 /*114 98 * Do we have UnixEAs on this path? 115 99 */ … … 160 144 rc = -EEXIST; 161 145 else 162 rc = -__libc_ native2errno(rc);146 rc = -__libc_back_native2errno(rc); 163 147 LIBCLOG_ERROR_RETURN_INT(rc); 164 148 } -
trunk/libc/src/kNIX/os2/b_panic.c
r2913 r2914 2 2 /** @file 3 3 * 4 * kNIX - panic .5 * 6 * Copyright (c) 2005 knut st. osmundsen <bird@anduin.net>4 * kNIX - panic, OS/2. 5 * 6 * Copyright (c) 2005-2006 knut st. osmundsen <bird@anduin.net> 7 7 * 8 8 * … … 30 30 * Header Files * 31 31 *******************************************************************************/ 32 #include "kNIX.h" 32 33 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_NOGROUP 33 #define INCL_BASE 34 #define INCL_ERRORS 35 #define INCL_FSMACROS 36 #define INCL_DOSUNDOCUEMENTED 37 #define _GNU_SOURCE 38 #include <string.h> 39 #include <InnotekLIBC/backend.h> 40 #include <InnotekLIBC/sharedpm.h> 41 #include <InnotekLIBC/logstrict.h> 42 #include <os2emx.h> 34 #include <klibc/logstrict.h> 43 35 44 36 -
trunk/libc/src/kNIX/os2/b_processCredentials.c
r2913 r2914 4 4 * kNIX - [sg]et.*[ug]id(). 5 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net>6 * Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@anduin.net> 7 7 * 8 8 * … … 30 30 * Header Files * 31 31 *******************************************************************************/ 32 #include "libc-alias.h" 33 #include "syscalls.h" 34 #include <errno.h> 35 #include <InnoTekLIBC/sharedpm.h> 36 #include <InnoTekLIBC/backend.h> 32 #include "kNIX.h" 37 33 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_PROCESS 38 #include < InnoTekLIBC/logstrict.h>34 #include <klibc/logstrict.h> 39 35 40 36 … … 174 170 LIBCLOG_ENTER("\n"); 175 171 pid_t sid; 176 if (pid == 0 || pid == _sys_pid)172 if (pid == 0 || pid == fibGetPid()) 177 173 sid = __libc_spmGetId(__LIBC_SPMID_SID); 178 174 else … … 195 191 LIBCLOG_ENTER("pid=%d\n", pid); 196 192 pid_t pgrp; 197 if (pid == 0 || pid == _sys_pid)193 if (pid == 0 || pid == fibGetPid()) 198 194 pgrp = __libc_spmGetId(__LIBC_SPMID_PGRP); 199 195 else -
trunk/libc/src/kNIX/os2/b_processSetPriority.c
r2913 r2914 119 119 rc = DosSetPriority(PRTYS_PROCESS, Args.uClass, Args.uLevel, pid); 120 120 if (rc) 121 rc = __libc_ native2errno(rc);121 rc = __libc_back_native2errno(rc); 122 122 } 123 123 } … … 204 204 rc = -EPERM; 205 205 else 206 rc = -__libc_ native2errno(rc);206 rc = -__libc_back_native2errno(rc); 207 207 } 208 208 else -
trunk/libc/src/kNIX/os2/b_processWait.c
r2913 r2914 275 275 return 0; 276 276 LIBC_ASSERTM_FAILED("_fmutex_request -> %d\n", rc); 277 return -__libc_ native2errno(rc);277 return -__libc_back_native2errno(rc); 278 278 } 279 279 -
trunk/libc/src/kNIX/os2/b_signalTimer.c
r2913 r2914 496 496 rc = -EAGAIN; 497 497 else 498 rc = -__libc_ native2errno(rc);498 rc = -__libc_back_native2errno(rc); 499 499 } 500 500 LIBCLOG_ERROR_RETURN_INT(rc); -
trunk/libc/src/kNIX/os2/b_time.c
r2910 r2914 29 29 *******************************************************************************/ 30 30 #include "kNIX.h" 31 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_TIME 32 #include <klibc/logstrict.h> 31 33 32 34 /** … … 41 43 struct tm Tm; 42 44 gmtime_r(&Time, &Tm); 43 #if 0 /* This didn't work in GCC versions <= 2.4 */ 44 time->twosecs = Tm.tm_sec / 2; 45 time->minutes = Tm.tm_min; 46 time->hours = Tm.tm_hour; 47 date->day = Tm.tm_mday; 48 date->month = Tm.tm_mon + 1; 49 date->year = Tm.tm_year - 1980 + 1900; 50 #else 51 USHORT us = (Tm.tm_sec / 2) + (Tm.tm_min << 5) + (Tm.tm_hour << 11); 52 *(PUSHORT)pTime = us; 53 us = Tm.tm_mday + ((Tm.tm_mon + 1) << 5) + ((Tm.tm_year - 80) << 9); 54 *(PUSHORT)pDate = us; 55 #endif 45 pTime->twosecs = Tm.tm_sec / 2; 46 pTime->minutes = Tm.tm_min; 47 pTime->hours = Tm.tm_hour; 48 pDate->day = Tm.tm_mday; 49 pDate->month = Tm.tm_mon + 1; 50 pDate->year = Tm.tm_year - 1980 + 1900; 56 51 } 57 52 53 54 /** 55 * Converts file time (local) to UCT unix time. 56 * 57 * @returns UCT unix time. 58 * @param Time File time. 59 * @param Date File date. 60 */ 61 time_t __libc_back_timeFileTime2Unix(FTIME Time, FDATE Date) 62 { 63 struct tm Tm = {0}; 64 Tm.tm_sec = Time.twosecs * 2; 65 Tm.tm_min = Time.minutes; 66 Tm.tm_hour = Time.hours; 67 Tm.tm_mday = Date.day; 68 Tm.tm_mon = Date.month ? Date.month - 1 : 0; 69 Tm.tm_year = Date.year + 1980 - 1900; 70 time_t UnixTime = mktime(&Tm); LIBC_ASSERT(UnixTime != -1); 71 int rc = _loc2gmt(&UnixTime, -1); (void)rc; LIBC_ASSERT(rc != -1); 72 return UnixTime; 73 } 74 -
trunk/libc/src/kNIX/os2/b_timeHighResNano.c
r2913 r2914 2 2 /** @file 3 3 * 4 * kNIX - gethrtime() .4 * kNIX - gethrtime(), OS/2. 5 5 * 6 * Copyright (c) 2005 knut st. osmundsen <bird@anduin.net>6 * Copyright (c) 2005-2006 knut st. osmundsen <bird@anduin.net> 7 7 * 8 8 * … … 25 25 */ 26 26 27 28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 31 #define INCL_FSMACROS 32 #define INCL_BASE 33 #include <os2emx.h> 34 #include <InnoTekLIBC/backend.h> 35 27 #include "kNIX.h" 36 28 37 29 /** -
trunk/libc/src/kNIX/os2/fhOS2File.c
r2805 r2914 29 29 * Header Files * 30 30 *******************************************************************************/ 31 # define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_OS2FILE32 # include <klibc/os2/os2.h>33 #include "../kNIX.h"31 #include "kNIX.h" 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_OS2FILE 33 #include <klibc/logstrict.h> 34 34 35 35 … … 134 134 static int fhOs2FileWrite(__LIBC_PFH pFH, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten) 135 135 { 136 LIBCLOG_ENTER("pFH=%p:{.fh=%d} pvBuf=%p cbToWrite=%zu pcbWritten=%p\n", pFH, pFH->fh, pvBuf, cbToWrite, pcbWritte);136 LIBCLOG_ENTER("pFH=%p:{.fh=%d} pvBuf=%p cbToWrite=%zu pcbWritten=%p\n", pFH, pFH->fh, pvBuf, cbToWrite, (void *)pcbWritten); 137 137 FS_VAR_SAVE_LOAD(); 138 138 FSCW_VAR(); … … 322 322 static int fhOS2FileSizeSet(__LIBC_PFH pFH, off_t cbFile, int fZero) 323 323 { 324 LIBCLOG_ENTER(" fh=%d cbFile=%lld fZero=%d\n", fh, cbFile, fZero);324 LIBCLOG_ENTER("pFH=%p cbFile=%lld fZero=%d\n", (void *)pFH, cbFile, fZero); 325 325 FS_VAR_SAVE_LOAD(); 326 326 -
trunk/libc/src/kNIX/os2/kNIX-os2.h
r2913 r2914 28 28 #define __os2_kNIX_os2_h__ 29 29 30 #include "../backend.h" /** @todo remove backend.h! */31 30 #include <InnoTekLIBC/sharedpm.h> 32 31 … … 237 236 * @{ */ 238 237 void __libc_back_timeUnix2FileTime(time_t Time, PFTIME pTime, PFDATE pDate); 238 time_t __libc_back_timeFileTime2Unix(FTIME Time, FDATE Date); 239 /** @} */ 240 241 int __libc_back_priorityUnixFromOS2(int iPrio); 242 int __libc_back_priorityOS2FromUnix(int iNice); 243 244 void __libc_back_processWaitNotifyTerm(void); 245 void __libc_back_processWaitNotifyExec(pid_t pid); 246 void __libc_back_processWaitNotifyChild(siginfo_t *pSigInfo); 247 void __libc_back_processWaitNotifyNoWait(int fNoWaitStatus); 248 249 250 /** @name Signals on OS/2. 251 * @{ 252 */ 253 254 /** Signal set for the signals which are pending on a process scope. 255 * These signals are blocked by all threads and waiting to be delivered 256 * to a thread. */ 257 extern sigset_t __libc_gSignalPending; 258 259 int __libc_back_signalInit(void); 260 int __libc_back_signalInitExe(void *pvRegRec); 261 int __libc_back_signalSemRequest(void); 262 void __libc_back_signalSemRelease(void); 263 unsigned __libc_back_signalSemIsOwner(void); 264 void __libc_back_signalPokeThread(__LIBC_PTHREAD pThrd); 265 void __libc_back_signalPokeProcess(void); 266 int __libc_back_signalReschedule(__LIBC_PTHREAD pThrd); 267 int __libc_back_signalQueueSelf(int iSignalNo, siginfo_t *pSigInfo); 268 int __libc_back_signalSuspend(void); 269 int __libc_back_signalAccept(__LIBC_PTHREAD pThrd, int iSignalNo, sigset_t *pSigSet, siginfo_t *pSigInfo); 270 int __libc_back_signalWait(__LIBC_PTHREAD pThrd, volatile int *pfDone, const struct timespec *pTimeout); 271 int __libc_back_signalSendPidOther(pid_t pid, int iSignalNo, const siginfo_t *pSigInfo); 272 int __libc_back_signalAction(int iSignalNo, const struct sigaction *pSigAct, struct sigaction *pSigActOld); 273 int __libc_back_signalRaisePoked(void *pvXcptParams, int tidPoker); 274 void __libc_back_signalOS2V1Handler16bit(unsigned short uSignal, unsigned short uArg); 275 void __libc_back_signalOS2V1Handler32bit(unsigned uSignal, unsigned uArg); 276 int __libc_back_signalInheritPack(__LIBC_PSPMINHSIG *ppSig, size_t *pcbSig); 277 void __libc_back_signalTimerNotifyTerm(void); 278 int __libc_back_signalRaiseInternal(__LIBC_PTHREAD pThrd, int iSignalNo, const siginfo_t *pSigInfo, void *pvQueued, unsigned fFlags); 279 239 280 /** @} */ 240 281 -
trunk/libc/src/kNIX/os2/libcfork.c
r2913 r2914 670 670 if (rc) 671 671 { 672 rc = -__libc_ native2errno(rc);672 rc = -__libc_back_native2errno(rc); 673 673 LIBCLOG_ERROR_RETURN_INT(rc); 674 674 } … … 1312 1312 { 1313 1313 LIBC_ASSERTM_FAILED("DosExecPgm(,,,%s,,,%s..) failed with rc=%d, szErr=%s\n", szPgm, fibGetCmdLine(), rc, szErr); 1314 rc = -__libc_ native2errno(rc);1314 rc = -__libc_back_native2errno(rc); 1315 1315 } 1316 1316 } … … 1318 1318 { 1319 1319 LIBC_ASSERTM_FAILED("DosQueryModuleName(%lx,,) failed with rc=%d\n", fibGetExeHandle(), rc); 1320 rc = -__libc_ native2errno(rc);1320 rc = -__libc_back_native2errno(rc); 1321 1321 } 1322 1322 … … 1493 1493 PAG_READ | PAG_WRITE | PAG_COMMIT); 1494 1494 if (rc) 1495 forkChlFatalError(pForkHandle, -__libc_ native2errno(rc), NULL);1495 forkChlFatalError(pForkHandle, -__libc_back_native2errno(rc), NULL); 1496 1496 } 1497 1497 else … … 1920 1920 LIBC_ASSERTM_FAILED("DosQueryMem(%p, ..:{%x}, ..:{%x}) failed with rc=%d\n", pvStart, cbRange, 1921 1921 PAG_READ | PAG_WRITE | PAG_EXECUTE | PAG_GUARD | PAG_COMMIT | PAG_DECOMMIT | PAG_FREE, rc); 1922 rc = -__libc_ native2errno(rc);1922 rc = -__libc_back_native2errno(rc); 1923 1923 LIBCLOG_RETURN_INT(rc); 1924 1924 } … … 1977 1977 { 1978 1978 LIBC_ASSERTM_FAILED("DosQueryMemState(%p,..:{0x1000},..) failed with rc=%d\n", pvState, rc); 1979 rc = -__libc_ native2errno(rc);1979 rc = -__libc_back_native2errno(rc); 1980 1980 LIBCLOG_RETURN_INT(rc); 1981 1981 } … … 2326 2326 { 2327 2327 LIBC_ASSERTM_FAILED("DosResetEventSem(%#lx,) -> %d\n", hevWait, rc); 2328 rc = -__libc_ native2errno(rc);2328 rc = -__libc_back_native2errno(rc); 2329 2329 LIBCLOG_RETURN_INT(rc); 2330 2330 } … … 2333 2333 { 2334 2334 LIBC_ASSERTM_FAILED("DosPostEventSem(%#lx) -> %d\n", hevSignal, rc); 2335 rc = -__libc_ native2errno(rc);2335 rc = -__libc_back_native2errno(rc); 2336 2336 LIBCLOG_RETURN_INT(rc); 2337 2337 } … … 2340 2340 { 2341 2341 LIBC_ASSERTM_FAILED("DosReleaseMutexSem(%#lx) -> %d\n", pForkHandle->hmtx, rc); 2342 rc = -__libc_ native2errno(rc);2342 rc = -__libc_back_native2errno(rc); 2343 2343 LIBCLOG_RETURN_INT(rc); 2344 2344 } … … 2385 2385 { 2386 2386 LIBC_ASSERTM_FAILED("DosWaitEventSem(%#lx, %lu) -> %d\n", hevWait, pForkHandle->cmsecTimeout, rc); 2387 rc = -__libc_ native2errno(rc);2387 rc = -__libc_back_native2errno(rc); 2388 2388 LIBCLOG_RETURN_INT(rc); 2389 2389 } … … 2392 2392 { 2393 2393 LIBC_ASSERTM_FAILED("DosRequestMutexSem(%#lx, %lu) -> %d\n", pForkHandle->hmtx, pForkHandle->cmsecTimeout, rc); 2394 rc = -__libc_ native2errno(rc);2394 rc = -__libc_back_native2errno(rc); 2395 2395 LIBCLOG_RETURN_INT(rc); 2396 2396 } … … 2399 2399 { 2400 2400 LIBC_ASSERTM_FAILED("DosPostEventSem(%#lx) -> %d\n", hevSignal, rc); 2401 rc = -__libc_ native2errno(rc);2401 rc = -__libc_back_native2errno(rc); 2402 2402 LIBCLOG_RETURN_INT(rc); 2403 2403 } … … 2533 2533 forkBthDumpMemFlags(pChunk->pv); 2534 2534 LIBC_ASSERTM_FAILED("DosSetMem(%p, %08x, %08lx) failed with rc=%d\n", pChunk->pv, pChunk->cbVirt, flFlags, rc); 2535 rc = -__libc_ native2errno(rc);2535 rc = -__libc_back_native2errno(rc); 2536 2536 break; 2537 2537 } -
trunk/libc/src/kNIX/os2/priority.c
r2913 r2914 28 28 * Header Files * 29 29 *******************************************************************************/ 30 #include "libc-alias.h" 31 #include "priority.h" 32 #include <InnoTekLIBC/backend.h> 30 #include "kNIX.h" 33 31 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_PROCESS 34 #include < InnoTekLIBC/logstrict.h>32 #include <klibc/logstrict.h> 35 33 36 #define INCL_DOSPROCESS37 #include <os2emx.h>38 34 39 35 /** @page Priority Convertion Matrix -
trunk/libc/src/kNIX/os2/resource.c
r2913 r2914 26 26 */ 27 27 28 29 /******************************************************************************* 30 * Header Files * 31 *******************************************************************************/ 32 #include <klibc/os2/os2.h> 33 #include "../kNIX.h" 34 28 #include "kNIX.h" 35 29 36 30 /** -
trunk/libc/src/kNIX/os2/safesems.c
r2913 r2914 2 2 /** @file 3 3 * 4 * kNIX - Internal Signal-Safe Semaphores .5 * 6 * Copyright (c) 2005 knut st. osmundsen <bird@anduin.net>4 * kNIX - Internal Signal-Safe Semaphores, OS/2. 5 * 6 * Copyright (c) 2005-2006 knut st. osmundsen <bird@anduin.net> 7 7 * 8 8 * … … 25 25 */ 26 26 27 28 27 /******************************************************************************* 29 28 * Header Files * 30 29 *******************************************************************************/ 31 #define INCL_DOSSEMAPHORES 32 #define INCL_DOSEXCEPTIONS 33 #define INCL_DOSERRORS 34 #define INCL_DOSPROCESS 35 #define INCL_FSMACROS 36 #define INCL_EXAPIS 37 #include <os2emx.h> 38 #include <sys/errno.h> 39 #include "syscalls.h" 40 #include <sys/builtin.h> 41 #include <klibc/fib.h> 42 #include <InnoTekLIBC/thread.h> 43 #include <InnoTekLIBC/backend.h> 30 #include "kNIX.h" 44 31 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IPC 45 #include < InnoTekLIBC/logstrict.h>32 #include <klibc/logstrict.h> 46 33 47 34 … … 80 67 { 81 68 LIBCLOG_ENTER("pmtx=%p fShared=%d\n", (void *)pmtx, fShared); 69 FS_VAR_SAVE_LOAD(); 70 82 71 pmtx->hmtx = NULLHANDLE; 83 72 pmtx->fShared = fShared; … … 85 74 if (rc) 86 75 rc = -__libc_native2errno(rc); 76 77 FS_RESTORE(); 87 78 LIBCLOG_RETURN_MSG(rc, "ret %d hmtx=%#lx\n", rc, pmtx->hmtx); 88 79 } … … 99 90 { 100 91 LIBCLOG_ENTER("pmtx=%p:{.hmtx=%#lx}\n", (void *)pmtx, pmtx->hmtx); 92 FS_VAR_SAVE_LOAD(); 93 101 94 int rc = DosOpenMutexSemEx(NULL, &pmtx->hmtx); 102 95 if (rc) 103 96 rc = -__libc_native2errno(rc); 97 98 FS_RESTORE(); 104 99 LIBCLOG_RETURN_INT(rc); 105 100 } … … 116 111 { 117 112 LIBCLOG_ENTER("pmtx=%p:{.hmtx=%#lx}\n", (void *)pmtx, pmtx->hmtx); 113 FS_VAR_SAVE_LOAD(); 114 118 115 int rc = DosCloseMutexSemEx(pmtx->hmtx); 119 116 if (rc) 120 117 rc = -__libc_native2errno(rc); 118 119 FS_RESTORE(); 121 120 LIBCLOG_RETURN_INT(rc); 122 121 } … … 273 272 { 274 273 LIBCLOG_ENTER("pmtx=%p:{.hmtx=%#lx}\n", (void *)pmtx, pmtx->hmtx); 274 FS_VAR_SAVE_LOAD(); 275 275 ULONG ul = 0; 276 276 int rc; 277 FS_VAR();278 277 279 278 /* 280 279 * Release the semaphore. 281 280 */ 282 FS_SAVE_LOAD();283 281 rc = DosReleaseMutexSem(pmtx->hmtx); 284 282 if (__predict_false(rc != NO_ERROR)) … … 306 304 { 307 305 LIBCLOG_ENTER("phev=%p pmtx=%p:{.hmtx=%#lx} fShared=%d\n", (void *)pev, (void *)pmtx, pmtx->hmtx, fShared); 306 FS_VAR_SAVE_LOAD(); 308 307 309 308 pev->hev = NULLHANDLE; … … 316 315 rc = -__libc_native2errno(rc); 317 316 317 FS_RESTORE(); 318 318 LIBCLOG_RETURN_MSG(rc, "ret %d pev->hev=%#lx\n", rc, pev->hev); 319 319 } … … 334 334 LIBCLOG_ENTER("pev=%p:{.hev=%#lx .cWaiters=%d .pmtx=%p .fShared=%d}\n", 335 335 (void *)pev, pev->hev, pev->cWaiters, (void *)pev->pmtx, pev->fShared); 336 FS_VAR_SAVE_LOAD(); 336 337 337 338 int rc = DosOpenEventSemEx(NULL, &pev->hev); … … 339 340 rc = -__libc_native2errno(rc); 340 341 342 FS_RESTORE(); 341 343 LIBCLOG_RETURN_INT(rc); 342 344 } … … 354 356 LIBCLOG_ENTER("pev=%p:{.hev=%#lx .cWaiters=%d .pmtx=%p .fShared=%d}\n", 355 357 (void *)pev, pev->hev, pev->cWaiters, (void *)pev->pmtx, pev->fShared); 358 FS_VAR_SAVE_LOAD(); 356 359 357 360 int rc = DosCloseEventSemEx(pev->hev); … … 359 362 rc = -__libc_native2errno(rc); 360 363 364 FS_RESTORE(); 361 365 LIBCLOG_RETURN_INT(rc); 362 366 } -
trunk/libc/src/kNIX/os2/sharedpm.c
r2913 r2914 52 52 * Header Files * 53 53 *******************************************************************************/ 54 #include "libc-alias.h" 55 56 #define NO_EXAPIS_MAPPINGS 57 #define INCL_BASE 58 #define INCL_FSMACROS 59 #define INCL_FPCWMACROS 60 #define INCL_ERRORS 61 #define INCL_DOSINFOSEG 62 #include <os2emx.h> 63 #include <stdlib.h> 64 #include <stddef.h> 65 #include <string.h> 66 #include <errno.h> 67 #include <stdio.h> 68 #include <sys/types.h> 69 #include <sys/ipc.h> 70 #include <emx/startup.h> 71 #include <386/builtin.h> 72 #include <InnoTekLIBC/sharedpm.h> 73 #include <InnoTekLIBC/fork.h> 74 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_SPM 75 #include <InnoTekLIBC/logstrict.h> 76 #include "b_process.h" 77 #include "b_signal.h" 78 #include "syscalls.h" 54 #include "kNIX.h" 55 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_SPM 56 #include <klibc/logstrict.h> 79 57 80 58 … … 2130 2108 /* @todo recover from owner died. */ 2131 2109 LIBC_ASSERTM_FAILED("DosRequestMutexSem(%lu) failed with rc=%d!\n", ghmtxSPM, rc); 2132 rc = -__libc_ native2errno(rc);2110 rc = -__libc_back_native2errno(rc); 2133 2111 } 2134 2112 … … 2256 2234 LIBC_ASSERTM_FAILED("Failed to open mutex. rc=%d rc2=%d\n", rc, rc2); 2257 2235 ghmtxSPM = NULLHANDLE; 2258 rc = -__libc_ native2errno(rc);2236 rc = -__libc_back_native2errno(rc); 2259 2237 LIBCLOG_RETURN_INT(rc); 2260 2238 } … … 2379 2357 gpSPMSelf = NULL; 2380 2358 FS_RESTORE(); 2381 rc = -__libc_ native2errno(rc);2359 rc = -__libc_back_native2errno(rc); 2382 2360 LIBCLOG_RETURN_INT(rc); 2383 2361 } -
trunk/libc/src/kNIX/os2/signals.c
r2913 r2914 662 662 } 663 663 LIBC_ASSERTM_FAILED("DosSetSigHandler failed with rc=%d\n", rc); 664 rc = -__libc_ native2errno(rc);664 rc = -__libc_back_native2errno(rc); 665 665 LIBCLOG_ERROR_RETURN_INT(rc); 666 666 } … … 2255 2255 if (!rc) 2256 2256 LIBCLOG_RETURN_INT(0); 2257 rc = -__libc_ native2errno(rc);2257 rc = -__libc_back_native2errno(rc); 2258 2258 LIBCLOG_ERROR_RETURN_INT(rc); 2259 2259 } … … 2353 2353 if (!rc) 2354 2354 LIBCLOG_RETURN_INT(0); 2355 rc = -__libc_ native2errno(rc);2355 rc = -__libc_back_native2errno(rc); 2356 2356 LIBCLOG_ERROR_RETURN_INT(rc); 2357 2357 } … … 3098 3098 { 3099 3099 LIBC_ASSERTM_FAILED("DosSetSigHandler failed with rc=%d\n", rc); 3100 rc = -__libc_ native2errno(rc);3100 rc = -__libc_back_native2errno(rc); 3101 3101 } 3102 3102 ULONG cTimes = 0; -
trunk/libc/src/kNIX/os2/syscalls.h
r2913 r2914 39 39 EXTERN unsigned long _sys_clock0_ms INIT (0); 40 40 EXTERN long _sys_ino INIT (0x100000); 41 EXTERN int _sys_pid;42 EXTERN int _sys_ppid; 41 /*EXTERN int _sys_pid; 42 EXTERN int _sys_ppid;*/ 43 43 44 44 /** Virtual address limit and high memory indicator. … … 52 52 EXTERN unsigned long _sys_gcbVirtualAddressLimit; 53 53 54 55 56 #if defined (_OS2EMX_H)57 58 long _sys_p2t(FTIME t, FDATE d);59 60 #endif /* _OS2EMX_H */61 54 62 55 void _sys_get_clock (unsigned long *ms); -
trunk/libc/src/kNIX/os2/sysv_sem.c
r2732 r2914 369 369 if (!rc) 370 370 LIBCLOG_RETURN_INT(rc); 371 rc = -__libc_ native2errno(rc);371 rc = -__libc_back_native2errno(rc); 372 372 LIBCLOG_ERROR_RETURN_INT(rc); 373 373 } -
trunk/libc/src/kNIX/os2/sysv_shm.c
r2732 r2914 474 474 FS_RESTORE(); 475 475 if (error) { 476 error = __libc_ native2errno(error);476 error = __libc_back_native2errno(error); 477 477 goto done2; 478 478 } … … 718 718 FS_RESTORE(); 719 719 if (error) 720 return -__libc_ native2errno(error);720 return -__libc_back_native2errno(error); 721 721 722 722 /* … … 1003 1003 if (!rc) 1004 1004 LIBCLOG_ERROR_RETURN_INT(rc); 1005 rc = -__libc_ native2errno(rc);1005 rc = -__libc_back_native2errno(rc); 1006 1006 LIBCLOG_RETURN_INT(rc); 1007 1007 } -
trunk/libc/src/kNIX/os2/tcpip.c
r2913 r2914 97 97 else 98 98 LIBC_ASSERTM_FAILED("DosQueryModuleName(%#lx,,) -> %d\n", hmodLoad, rc); 99 rc = -__libc_ native2errno(rc);99 rc = -__libc_back_native2errno(rc); 100 100 } 101 101 else -
trunk/libc/src/libc/misc/Makefile.kmk
r2907 r2914 145 145 $(PATH_LIBC_SRC)/libc/misc/_getdrive.c \ 146 146 $(PATH_LIBC_SRC)/libc/misc/_realrealpath.c \ 147 $(PATH_LIBC_SRC)/libc/misc/_scrsize.c \ 147 148 $(PATH_LIBC_SRC)/libc/misc/_uflags.c \ 148 149
Note:
See TracChangeset
for help on using the changeset viewer.