Changeset 3695 for branches/libc-0.6
- Timestamp:
- Mar 16, 2011, 12:30:51 AM (14 years ago)
- Location:
- branches/libc-0.6/src/emx
- Files:
-
- 1 deleted
- 6 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/libc-0.6/src/emx/include/InnoTekLIBC/backend.h
r3102 r3695 157 157 */ 158 158 void __libc_Back_fsSync(void); 159 160 /** 161 * Query filesystem configuration information by path. 162 * 163 * @returns 0 on success. 164 * @returns Negative error code (errno.h) on failure. 165 * @param pszPath Path to query info about. 166 * @param iName Which path config variable to query. 167 * @param plValue Where to return the value. 168 * @sa __libc_Back_ioPathConf, fpathconf, pathconf, sysconf. 169 */ 170 int __libc_Back_fsPathConf(const char *pszPath, int iName, long *plValue); 159 171 160 172 /** … … 507 519 */ 508 520 int __libc_Back_ioFHToPath(int fh, char *pszPath, size_t cchPath); 521 522 /** 523 * Query filesystem configuration information by file handle. 524 * 525 * @returns 0 on success. 526 * @returns Negative error code (errno.h) on failure. 527 * @param fh The handle to query config info about. 528 * @param iName Which path config variable to query. 529 * @param plValue Where to return the configuration value. 530 * @sa __libc_Back_fsPathConf, fpathconf, pathconf, sysconf. 531 */ 532 int __libc_Back_ioPathConf(int fh, int iName, long *plValue); 509 533 510 534 /** @} */ -
branches/libc-0.6/src/emx/include/emx/io.h
r2522 r3695 322 322 /** Does the file system provide sufficient EA support for UNIX attributes? */ 323 323 unsigned fUnixEAs : 1; 324 /** _PC_CHOWN_RESTRICTED - Is chown and chgrp restricted the typical unix way. */ 325 unsigned fChOwnRestricted : 1; 326 /** _PC_NO_TRUNC - Indicates whether too long names will cause errors or be truncated. */ 327 unsigned fNoNameTrunc : 1; 328 /** _PC_FILESIZEBITS - The bitsize of the type required to store the max file size. */ 329 unsigned cFileSizeBits : 7; 330 /** _PC_PATH_MAX - The maximum path length. */ 331 unsigned short cchMaxPath; 332 /** _PC_NAME_MAX - The maximum path length. */ 333 unsigned short cchMaxName; 334 /** _PC_SYMLINK_MAX - The maximum symlink length. */ 335 unsigned short cchMaxSymlink; 336 /** _PC_LINK_MAX - The maximum number of hard links per file. */ 337 unsigned short cMaxLinks; 338 /** _PC_MAX_CANON - The maximum number of bytes in a terminal canonical input queue. */ 339 unsigned short cchMaxTermCanon; 340 /** _PC_MAX_INPUT - The maximum number of bytes in a canonical input queue. */ 341 unsigned short cchMaxTermInput; 342 /** _PC_PIPE_BUF - The maximum number of bytes that is guaranteed to be atomic when writing to a pipe. */ 343 unsigned cbPipeBuf; 344 /** _PC_ALLOC_SIZE_MIN - The (smallest) block allocation size of the file system. */ 345 unsigned cbBlock; 346 /** _PC_REC_XFER_ALIGN - The recommended buffer alignment for transfers. */ 347 unsigned short uXferAlign; 348 /** _PC_REC_INCR_XFER_SIZE - The increments to walk between the min and max transfer sizes. */ 349 unsigned short cbXferIncr; 350 /** _PC_REC_MAX_XFER_SIZE - The maximum recommended transfer size. */ 351 unsigned long cbXferMax; 352 /** _PC_REC_MIN_XFER_SIZE - The minimum recommended transfer size. */ 353 unsigned long cbXferMin; 324 354 /** Device number of the device the filesystem resides on. 325 355 * On OS/2 the device number is derived from the driveletter. */ -
branches/libc-0.6/src/emx/src/lib/libc.def
r3102 r3695 1961 1961 1962 1962 1963 "___libc_Back_fsPathConf" @1959 1964 "___libc_Back_ioPathConf" @1960 -
branches/libc-0.6/src/emx/src/lib/misc/pathconf.c
r151 r3695 1 /* pathconf.c (emx+gcc) -- Copyright (c) 1994-1995 by Eberhard Mattes */ 1 /* $Id: $ */ 2 /** @file 3 * 4 * LIBC - pathconf(). 5 * 6 * Copyright (c) 2011 knut st. osmundsen <bird@innotek.de> 7 * 8 * 9 * This file is part of InnoTek LIBC. 10 * 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * InnoTek LIBC is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * along with InnoTek LIBC; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * 25 */ 2 26 27 28 /******************************************************************************* 29 * Header Files * 30 *******************************************************************************/ 3 31 #include "libc-alias.h" 32 #include <errno.h> 4 33 #include <unistd.h> 5 #include <limits.h> 6 #include <errno.h> 34 #include <InnoTekLIBC/backend.h> 35 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 36 #include <InnoTekLIBC/logstrict.h> 7 37 8 /* Return the POSIX.1 minimum values, for now. */9 38 10 long _STD(pathconf) (const char *path, int name)39 long _STD(pathconf)(const char *pszPath, int iName) 11 40 { 12 switch (name) 13 { 14 case _PC_LINK_MAX: 15 return _POSIX_LINK_MAX; 41 LIBCLOG_ENTER("pszPath=%p:{%s} iName=%d\n", pszPath, pszPath, iName); 42 long lValue; 43 int rc = __libc_Back_fsPathConf(pszPath, iName, &lValue); 44 if (!rc) 45 LIBCLOG_RETURN_LONG(lValue); 46 errno = -rc; 47 LIBCLOG_ERROR_RETURN_LONG(-1L); 48 } 16 49 17 case _PC_MAX_CANON:18 return _POSIX_MAX_CANON;19 20 case _PC_MAX_INPUT:21 return _POSIX_MAX_INPUT;22 23 case _PC_NAME_MAX:24 return _POSIX_NAME_MAX;25 26 case _PC_PATH_MAX:27 return _POSIX_PATH_MAX;28 29 case _PC_PIPE_BUF:30 return _POSIX_PIPE_BUF;31 32 case _PC_CHOWN_RESTRICTED:33 return 1;34 35 case _PC_NO_TRUNC:36 return 1; /* TODO */37 38 case _PC_VDISABLE:39 return 0;40 41 default:42 errno = EINVAL;43 return -1;44 }45 } -
branches/libc-0.6/src/emx/src/lib/sys/b_fs.h
r2538 r3695 466 466 int __libc_back_fsInfoSupportUnixEAs(const char *pszNativePath); 467 467 468 int __libc_back_fsInfoPathConf(__LIBC_PFSINFO pFsInfo, int iName, long *plValue); 469 468 470 __END_DECLS 469 471 -
branches/libc-0.6/src/emx/src/lib/sys/b_fsInfoPathConf.c
r3687 r3695 25 25 */ 26 26 27 #include "kNIX.h"28 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS29 #include <klibc/logstrict.h>30 27 #include <unistd.h> 31 28 #include <limits.h> 29 #include <errno.h> 30 #include "syscalls.h" 31 #include "b_fs.h" 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 33 #include <InnoTekLIBC/logstrict.h> 32 34 33 35 /** … … 117 119 } 118 120 121 -
branches/libc-0.6/src/emx/src/lib/sys/b_fsPathConf.c
r3687 r3695 25 25 */ 26 26 27 #include "kNIX.h" 27 #include "syscalls.h" 28 #include "b_fs.h" 29 #include <InnoTekLIBC/backend.h> 28 30 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 29 #include < klibc/logstrict.h>31 #include <InnoTekLIBC/logstrict.h> 30 32 31 33 /** … … 52 54 if (!rc) 53 55 { 54 __LIBC_PFSINFO *pFsInfo = __libc_back_fsInfoObjByPath(pszNativePath);55 rc = __libc_back_fs infoPathConf(pFsInfo, iName, plValue);56 __LIBC_PFSINFO pFsInfo = __libc_back_fsInfoObjByPath(szNativePath); 57 rc = __libc_back_fsInfoPathConf(pFsInfo, iName, plValue); 56 58 __libc_back_fsInfoObjRelease(pFsInfo); 57 59 } -
branches/libc-0.6/src/emx/src/lib/sys/b_ioPathConf.c
r3687 r3695 25 25 */ 26 26 27 #include "kNIX.h" 27 #include "syscalls.h" 28 #include <InnoTekLIBC/backend.h> 28 29 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_FS 29 #include <klibc/logstrict.h> 30 #include <InnoTekLIBC/logstrict.h> 31 #include "b_fs.h" 30 32 31 33 /** … … 48 50 */ 49 51 __LIBC_PFH pFH; 50 int rc = __libc_FH Get(fh, &pFH);52 int rc = __libc_FHEx(fh, &pFH); 51 53 if (rc == 0) 52 {53 54 rc = __libc_back_fsInfoPathConf(pFH->pFsInfo, iName, plValue); 54 __libc_FHPut(pFH);55 }56 55 LIBCLOG_MIX_RETURN_INT(rc); 57 56 } -
branches/libc-0.6/src/emx/src/lib/sys/fs.c
r3289 r3695 337 337 * Setup the the executable path rewrite rule. 338 338 */ 339 PTIB pTib; 339 PTIB pTib; 340 340 PPIB pPib; 341 341 DosGetInfoBlocks(&pTib, &pPib); 342 342 rc = DosQueryModuleName(pPib->pib_hmte, sizeof(__libc_gszExecPath), &__libc_gszExecPath[0]); 343 if (!rc) 343 if (!rc) 344 344 { 345 345 char *psz = strchr(&__libc_gszExecPath[0], '\0'); 346 while ( psz > &__libc_gszExecPath[0] 346 while ( psz > &__libc_gszExecPath[0] 347 347 && *psz != '\\' 348 348 && *psz != '/' … … 365 365 if (DosQuerySysInfo(QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrive, sizeof(ulBootDrive))) 366 366 ulBootDrive = 'C' - 'A' - 1; /* A = 1 */ 367 __libc_gszTmpDir[0] = __libc_gszSystemRoot[0] = __libc_gszSystemDrive[0] 367 __libc_gszTmpDir[0] = __libc_gszSystemRoot[0] = __libc_gszSystemDrive[0] 368 368 = (char)ulBootDrive + 'A' - 1; 369 369 … … 1800 1800 PFSQBUFFER2 pfsqb = (PFSQBUFFER2)achBuffer; 1801 1801 1802 /* init the structure */ 1803 pFsInfo->fZeroNewBytes = 0; 1804 pFsInfo->fUnixEAs = 0; 1805 pFsInfo->Dev = Dev; 1806 pFsInfo->szName[0] = '\0'; 1807 pFsInfo->szMountpoint[0] = minor(Dev); 1808 pFsInfo->szMountpoint[1] = ':'; 1809 pFsInfo->szMountpoint[2] = '\0'; 1810 pFsInfo->szMountpoint[3] = '\0'; 1802 /* init the structure with defaults. */ 1803 pFsInfo->fZeroNewBytes = 0; 1804 pFsInfo->fUnixEAs = 0; 1805 pFsInfo->fChOwnRestricted = 1; 1806 pFsInfo->fNoNameTrunc = 1; 1807 pFsInfo->cFileSizeBits = 64; 1808 pFsInfo->cchMaxPath = CCHMAXPATH; 1809 pFsInfo->cchMaxName = CCHMAXPATHCOMP; 1810 pFsInfo->cchMaxSymlink = CCHMAXPATH; 1811 pFsInfo->cMaxLinks = 1; 1812 pFsInfo->cchMaxTermCanon = MAX_CANON; 1813 pFsInfo->cchMaxTermInput = MAX_INPUT; 1814 pFsInfo->cbPipeBuf = _POSIX_PIPE_BUF; 1815 pFsInfo->cbBlock = 512; 1816 pFsInfo->cbXferIncr = 0x1000; 1817 pFsInfo->cbXferMax = 0xf000; 1818 pFsInfo->cbXferMin = 0x1000; 1819 pFsInfo->uXferAlign = 0x1000; 1820 pFsInfo->Dev = Dev; 1821 pFsInfo->szName[0] = '\0'; 1822 pFsInfo->szMountpoint[0] = minor(Dev); 1823 pFsInfo->szMountpoint[1] = ':'; 1824 pFsInfo->szMountpoint[2] = '\0'; 1825 pFsInfo->szMountpoint[3] = '\0'; 1811 1826 1812 1827 /* query fs info */ … … 1816 1831 if (!rc) 1817 1832 strncat(pFsInfo->szName, (const char *)&pfsqb->szName[pfsqb->cbName + 1], sizeof(pFsInfo->szName) - 1); 1818 if ( !strcmp(pFsInfo->szName, "JFS") 1819 || !strcmp(pFsInfo->szName, "HPFS") 1820 || !strcmp(pFsInfo->szName, "FAT")) 1833 if (!strcmp(pFsInfo->szName, "HPFS")) 1821 1834 { 1822 1835 pFsInfo->fZeroNewBytes = 1; 1823 1836 pFsInfo->fUnixEAs = 1; 1837 /** @todo detect HPFS386? */ 1838 } 1839 else if (!strcmp(pFsInfo->szName, "JFS")) 1840 { 1841 pFsInfo->fZeroNewBytes = 1; 1842 pFsInfo->fUnixEAs = 1; 1843 } 1844 else if (!strcmp(pFsInfo->szName, "FAT")) 1845 { 1846 pFsInfo->fZeroNewBytes = 1; 1847 pFsInfo->fUnixEAs = 1; 1848 pFsInfo->cchMaxName = 8+1+3; 1824 1849 } 1825 1850 else if (!strcmp(pFsInfo->szName, "LAN")) … … 1827 1852 /* should find a way of getting the remote fs... */ 1828 1853 pFsInfo->fZeroNewBytes = 1; /* for performance reasons, assume it zeros. */ 1829 pFsInfo->fUnixEAs = 0; 1854 pFsInfo->cbXferMin = 0x200; 1855 pFsInfo->cbXferIncr = 0x200; 1830 1856 } 1831 1857 else if (!strcmp(pFsInfo->szName, "RAMFS")) 1832 {1833 1858 pFsInfo->fZeroNewBytes = 0; 1834 pFsInfo->fUnixEAs = 1; /* but it doesn't zero */1835 }1836 1859 /*else if (!strcmp(pFsInfo->szName, "FAT32")) 1837 { 1838 pFsInfo->fZeroNewBytes = 0; 1839 pFsInfo->fUnixEAs = 0; 1840 }*/ 1841 else 1842 { 1843 pFsInfo->fZeroNewBytes = 0; 1844 pFsInfo->fUnixEAs = 0; 1845 } 1860 { } */ 1846 1861 1847 1862 LIBCLOG_MSG2("fsInfoObjUpdate: dev:%#x mp:%s fsd:%s fZeroNewBytes=%d fUnixEAs=%d\n",
Note:
See TracChangeset
for help on using the changeset viewer.