Changeset 1972
- Timestamp:
- May 6, 2005, 5:36:47 AM (20 years ago)
- Location:
- trunk/src/emx
- Files:
-
- 9 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/ChangeLog.LIBC
-
Property cvs2svn:cvs-rev
changed from
1.43
to1.44
r1971 r1972 8 8 o Disabled the UF_ and SF_ defines in sys/stat.h since we don't have st_flags. 9 9 o Added mkfifo (stub). 10 o Added lutimes and futimes, replacing __utimes. 10 11 11 12 2005-05-01: knut st. osmundsen <bird-gccos2-spam@anduin.net> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/InnoTekLIBC/backend.h
-
Property cvs2svn:cvs-rev
changed from
1.21
to1.22
r1971 r1972 289 289 290 290 /** 291 * Sets the file access mode of a file.291 * Sets the file access mode of a symlink. 292 292 * 293 293 * @returns 0 on success. … … 297 297 */ 298 298 int __libc_Back_fsSymlinkModeSet(const char *pszPath, mode_t Mode); 299 300 /** 301 * Sets the file times of a symlink. 302 * 303 * @returns 0 on success. 304 * @returns Negative error code (errno.h) on failure. 305 * @param pszPath The path to the file to set the mode of. 306 * @param paTimes Two timevalue structures. If NULL the current time is used. 307 */ 308 int __libc_Back_fsSymlinkTimesSet(const char *pszPath, const struct timeval *paTimes); 299 309 300 310 /** … … 338 348 */ 339 349 int __libc_Back_fsFileModeSetFH(int fh, mode_t Mode); 350 351 /** 352 * Sets the file the times of a file. 353 * 354 * @returns 0 on success. 355 * @returns Negative error code (errno.h) on failure. 356 * @param pszPath The path to the file to set the times of. 357 * @param paTimes Two timevalue structures. If NULL the current time is used. 358 */ 359 int __libc_Back_fsFileTimesSet(const char *pszPath, const struct timeval *paTimes); 360 361 /** 362 * Sets the file the times of a file by filehandle. 363 * 364 * @returns 0 on success. 365 * @returns Negative error code (errno.h) on failure. 366 * @param fh Handle to file. 367 * @param paTimes Two timevalue structures. If NULL the current time is used. 368 */ 369 int __libc_Back_fsFileTimesSetFH(int fh, const struct timeval *paTimes); 340 370 341 371 /** -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/sys/time.h
-
Property cvs2svn:cvs-rev
changed from
1.9
to1.10
r1971 r1972 41 41 * @changed IBM TCP paranoia. 42 42 * @changed Added hrtime_t and gethrtime from SUN/HP/RTLinux. 43 * @todo Implement futimes() and lutimes().44 43 */ 45 44 … … 326 325 __BEGIN_DECLS 327 326 /** @todo int adjtime(const struct timeval *, struct timeval *); */ 328 /** @todo int futimes(int, const struct timeval *); */ 327 int futimes(int, const struct timeval *); 329 328 int getitimer(int, struct itimerval *); 330 329 int gettimeofday(struct timeval *, struct timezone *); 331 /** @todo int lutimes(const char *, const struct timeval *); */ 330 int lutimes(const char *, const struct timeval *); 332 331 int setitimer(int, const struct itimerval *, struct itimerval *); 333 332 int settimeofday(const struct timeval *, const struct timezone *); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/utime.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1971 r1972 1 /* utime.c (emx+gcc) -- Copyright (c) 1990-2000 by Eberhard Mattes */ 1 /* $Id: $ */ 2 /** @file 3 * 4 * LIBC - utime. 5 * 6 * Copyright (c) 2005 knut st. osmundsen <bird@anduin.net> 7 * 8 * 9 * This file is part of kBuild. 10 * 11 * kBuild is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * kBuild 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 General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with kBuild; 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" 4 #include <time.h>5 32 #include <sys/time.h> 6 #include <sys/utime.h> 7 #include <emx/time.h> 8 #include <emx/syscalls.h> 33 #include <utime.h> 34 #include <InnoTekLIBC/backend.h> 35 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_IO 36 #include <InnoTekLIBC/logstrict.h> 9 37 10 int _STD(utime) (const char *name, const struct utimbuf *times) 38 39 /** 40 * Sets the access and modification times of a file. 41 * 42 * @returns 0 on success. 43 * @returns -1 and errno on failure. 44 * 45 * @param pszPath The file which times to set. 46 * @param pTime Pointer to the access and modification times. If NULL current time is used. 47 */ 48 int _STD(utime)(const char *pszPath, const struct utimbuf *pTimes) 11 49 { 12 struct timeval tv[2]; 13 time_t tmp; 50 LIBCLOG_ENTER("pszPath=%p:{%s} pTimes=%p:{.actime=%d, .modtime=%d}\n", 51 (void *)pszPath, pszPath, (void *)pTimes, 52 pTimes ? pTimes->actime : ~0, pTimes ? pTimes->modtime : ~0); 53 int rc; 54 if (pTimes) 55 { 56 struct timeval aTimes[2]; 57 aTimes[0].tv_sec = pTimes->actime; 58 aTimes[0].tv_usec = 0; 59 aTimes[1].tv_sec = pTimes->modtime; 60 aTimes[1].tv_usec = 0; 61 rc = utimes(pszPath, &aTimes[0]); 62 } 63 else 64 rc = utimes(pszPath, NULL); 14 65 15 if (times == NULL) 16 { 17 tv[0].tv_sec = tv[1].tv_sec = time (NULL); 18 tv[0].tv_usec = tv[1].tv_usec = 0; 19 } 20 else 21 { 22 tv[0].tv_sec = times->actime; 23 tv[0].tv_usec = 0; 24 tv[1].tv_sec = times->modtime; 25 tv[1].tv_usec = 0; 26 } 27 if (!_tzset_flag) tzset (); 28 tmp = tv[0].tv_sec; _gmt2loc (&tmp); tv[0].tv_sec = tmp; 29 tmp = tv[1].tv_sec; _gmt2loc (&tmp); tv[1].tv_sec = tmp; 30 return __utimes (name, tv); 66 LIBCLOG_RETURN_INT(rc); 31 67 } 68 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/io/utimes.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1971 r1972 1 /* utimes.c (emx+gcc) -- Copyright (c) 1990-2000 by Eberhard Mattes */ 1 /* $Id: $ */ 2 /** @file 3 * 4 * LIBC - utimes. 5 * 6 * Copyright (c) 2005 knut st. osmundsen <bird@anduin.net> 7 * 8 * 9 * This file is part of kBuild. 10 * 11 * kBuild is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * kBuild 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 General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with kBuild; 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" 4 #include <time.h>5 32 #include <sys/time.h> 6 #include <emx/time.h> 7 #include <emx/syscalls.h> 33 #include <errno.h> 34 #include <InnoTekLIBC/backend.h> 35 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_IO 36 #include <InnoTekLIBC/logstrict.h> 8 37 9 int _STD(utimes) (const char *name, const struct timeval *tvp) 38 39 /** 40 * Sets the access and modification times of a file. 41 * 42 * @returns 0 on success. 43 * @returns -1 and errno on failure. 44 * 45 * @param pszPath The file which times to set. 46 * @param paTimes Pointer to an array containing the access and modification times in that order. 47 * If NULL current time is used. 48 */ 49 int _STD(utimes)(const char *pszPath, const struct timeval *paTimes) 10 50 { 11 struct timeval tv[2]; 12 time_t tmp; 51 LIBCLOG_ENTER("pszPath=%p:{%s} paTimes=%p:{{.tv_sec=%ld, .tv_usec=%ld}, {.tv_sec=%ld, .tv_usec=%ld}}\n", 52 (void *)pszPath, pszPath, (void *)paTimes, 53 paTimes ? paTimes[0].tv_sec : ~0, paTimes ? paTimes[0].tv_usec : ~0, 54 paTimes ? paTimes[1].tv_sec : ~0, paTimes ? paTimes[1].tv_usec : ~0); 55 int rc = __libc_Back_fsFileTimesSet(pszPath, paTimes); 56 if (!rc) 57 LIBCLOG_RETURN_INT(0); 58 errno = -rc; 59 LIBCLOG_RETURN_INT(-1); 60 } 13 61 14 if (tvp == NULL)15 {16 tv[0].tv_sec = tv[1].tv_sec = time (NULL);17 tv[0].tv_usec = tv[1].tv_usec = 0;18 }19 else20 {21 tv[0] = tvp[0];22 tv[1] = tvp[1];23 }24 if (!_tzset_flag) tzset ();25 tmp = tv[0].tv_sec; _gmt2loc (&tmp); tv[0].tv_sec = tmp;26 tmp = tv[1].tv_sec; _gmt2loc (&tmp); tv[1].tv_sec = tmp;27 return __utimes (name, tv);28 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/libc.def
-
Property cvs2svn:cvs-rev
changed from
1.109
to1.110
r1971 r1972 424 424 "___ulimit" @437 425 425 "___unwind2" @438 426 "__ _utimes" @439426 "__std_lutimes" @439 427 427 "___wait" @440 428 428 "___waitpid" @441 … … 1520 1520 "_fts_set_clientptr" @1525 1521 1521 "__std_mkfifo" @1526 1522 "___libc_Back_fsFileTimesSet" @1527 1523 "___libc_Back_fsFileTimesSetFH" @1528 1524 "___libc_Back_fsSymlinkTimesSet" @1529 1525 "__std_futimes" @1530 1526 "___nullstub_function" @1531 1527 "___nullstub_data" @1532 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/libc06b4.def
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r1971 r1972 422 422 "___ulimit" @437 423 423 "___unwind2" @438 424 "___utimes" @439424 "___utimes" = ___nullstub_function @439 425 425 "___wait" @440 426 426 "___waitpid" @441 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/misc/mknod.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r1971 r1972 41 41 42 42 /** 43 * Hardlinks a file. 44 * 45 * This is stub. It always fails. 43 * Create a filesystem node. 46 44 * 47 45 * @returns 0 on success. 48 46 * @returns -1 and errno on failure. 49 * @param oldpath Path to the old (or current if you prefere) file. 50 * @param newpath Path to the new file. 47 * @param path Path to the old 48 * @param mode The filemode and type. 49 * @param dev Device node id if applies. 51 50 */ 52 51 int _STD(mknod)(const char *path, mode_t mode, dev_t dev) … … 58 57 */ 59 58 int rc; 60 switch (S_IFMT )59 switch (S_IFMT & mode) 61 60 { 62 61 case S_IFDIR: 63 62 rc = mkdir(path, mode); 64 63 break; 65 #if 066 64 case S_IFIFO: 67 65 rc = mkfifo(path, mode); 68 66 break; 67 #if 0 69 68 case S_IFSOCK: 70 69 /* check if right prefix. */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/__utimes.c
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r1971 r1972 1 /* sys/utimes.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */ 2 3 #include "libc-alias.h" 4 #define INCL_FSMACROS 5 #include <os2emx.h> 6 #include <string.h> 7 #include <stdlib.h> 8 #include <errno.h> 9 #include <time.h> 10 #include <sys/time.h> 11 #include <emx/syscalls.h> 12 #include "syscalls.h" 13 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_IO 14 #include <InnoTekLIBC/logstrict.h> 15 #include <InnoTekLIBC/pathrewrite.h> 16 17 18 static void _sys_t2p(time_t sec, PFTIME time, PFDATE date) 19 { 20 struct tm *p; 21 USHORT tmp; 22 23 p = gmtime(&sec); 24 #if 0 /* This didn't work in GCC versions <= 2.4 */ 25 time->twosecs = p->tm_sec / 2; 26 time->minutes = p->tm_min; 27 time->hours = p->tm_hour; 28 date->day = p->tm_mday; 29 date->month = p->tm_mon + 1; 30 date->year = p->tm_year - 1980 + 1900; 31 #else 32 tmp = (p->tm_sec / 2) + (p->tm_min << 5) + (p->tm_hour << 11); 33 *(USHORT *)time = tmp; 34 tmp = p->tm_mday + ((p->tm_mon + 1) << 5) + ((p->tm_year - 80) << 9); 35 *(USHORT *)date = tmp; 36 #endif 37 } 38 39 40 int __utimes(const char *pszPath, const struct timeval *tvp) 41 { 42 LIBCLOG_ENTER("pszPath=%s tvp=%p {{%ld,%ld}, {%ld,%ld}}\n", pszPath, (void*)tvp, 43 tvp ? tvp[0].tv_sec : ~0, tvp ? tvp[0].tv_usec : ~0, 44 tvp ? tvp[1].tv_sec : ~0, tvp ? tvp[1].tv_usec : ~0); 45 int cch; 46 ULONG rc; 47 FILESTATUS3 info; 48 FS_VAR(); 49 50 /* 51 * Rewrite the specified file path. 52 */ 53 cch = __libc_PathRewrite(pszPath, NULL, 0); 54 if (cch > 0) 55 { 56 char *pszRewritten = alloca(cch); 57 if (!pszRewritten) 58 { 59 errno = ENOMEM; 60 LIBCLOG_RETURN_INT(-1); 61 } 62 cch = __libc_PathRewrite(pszPath, pszRewritten, cch); 63 if (cch > 0) 64 pszPath = pszRewritten; 65 /* else happens when someone changes the rules between the two calls. */ 66 else if (cch < 0) 67 { 68 errno = EAGAIN; /* non-standard, I'm sure. */ 69 LIBCLOG_RETURN_INT(-1); 70 } 71 } 72 73 /* 74 * Validate input. 75 */ 76 if ( (pszPath[0] == '/' || pszPath[0] == '\\') 77 && (pszPath[1] == 'p' || pszPath[1] == 'P') 78 && (pszPath[2] == 'i' || pszPath[2] == 'I') 79 && (pszPath[3] == 'p' || pszPath[3] == 'P') 80 && (pszPath[4] == 'e' || pszPath[4] == 'E') 81 && (pszPath[5] == '/' || pszPath[5] == '\\')) 82 { 83 errno = ENOENT; 84 return -1; 85 } 86 87 /* 88 * Query current path info. 89 */ 90 FS_SAVE_LOAD(); 91 rc = DosQueryPathInfo((PCSZ)pszPath, FIL_STANDARD, &info, sizeof(info)); 92 if (rc) 93 { 94 FS_RESTORE(); 95 _sys_set_errno(rc); 96 LIBCLOG_RETURN_INT(-1); 97 } 98 99 /* 100 * Apply the new times and update. 101 */ 102 _sys_t2p(tvp[0].tv_sec, &info.ftimeLastAccess, &info.fdateLastAccess); 103 _sys_t2p(tvp[1].tv_sec, &info.ftimeLastWrite, &info.fdateLastWrite); 104 rc = DosSetPathInfo((PCSZ)pszPath, FIL_STANDARD, &info, sizeof(info), 0); 105 FS_RESTORE(); 106 if (rc) 107 { 108 _sys_set_errno(rc); 109 LIBCLOG_RETURN_INT(-1); 110 } 111 LIBCLOG_RETURN_INT(0); 112 } 1 /* dead */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/sys/b_fs.h
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r1971 r1972 215 215 216 216 /** 217 * Sets the file times of a native file. 218 * 219 * @returns 0 on success. 220 * @returns Negative error code (errno.h) on failure. 221 * @param pszNativePath Path to the file to set the times of. 222 * @param paTimes Two timevalue structures. If NULL the current time is used. 223 */ 224 int __libc_back_fsNativeFileTimesSet(const char *pszNativePath, const struct timeval *paTimes); 225 226 /** 217 227 * Calc the Inode and Dev based on native path. 218 228 * -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.