Changeset 3060 for trunk/src/lib


Ignore:
Timestamp:
Sep 21, 2017, 5:11:07 PM (8 years ago)
Author:
bird
Message:

kmk,lib: ported kmk_touch to windows (nt).

Location:
trunk/src/lib
Files:
1 added
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/Makefile.kmk

    r2994 r3060  
    5353       nt/ntstat.c \
    5454       nt/ntunlink.c \
     55       nt/ntutimes.c \
    5556       nt/fts-nt.c \
    5657       nt/kFsCache.c \
  • trunk/src/lib/nt/nthlp.h

    r3009 r3060  
    8989
    9090
     91static __inline void birdNtTimeToTimeVal(__int64 iNtTime, BirdTimeVal_T *pTimeVal)
     92{
     93    iNtTime -= BIRD_NT_EPOCH_OFFSET_UNIX_100NS;
     94    pTimeVal->tv_sec  = iNtTime / 10000000;
     95    pTimeVal->tv_usec = (iNtTime % 10000000) / 10;
     96}
     97
     98
     99static __inline __int64 birdNtTimeFromTimeVal(BirdTimeVal_T const *pTimeVal)
     100{
     101    __int64 iNtTime = pTimeVal->tv_sec * 10000000;
     102    iNtTime += pTimeVal->tv_usec * 10;
     103    iNtTime += BIRD_NT_EPOCH_OFFSET_UNIX_100NS;
     104    return iNtTime;
     105}
     106
     107
    91108#endif
    92109
  • trunk/src/lib/nt/nttypes.h

    r2702 r3060  
    55
    66/*
    7  * Copyright (c) 2005-2013 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
     7 * Copyright (c) 2005-2017 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
    88 *
    99 * Permission is hereby granted, free of charge, to any person obtaining a
     
    3434#include <sys/types.h>
    3535
     36typedef struct BirdTimeVal
     37{
     38    __int64       tv_sec;
     39    __int32       tv_usec;
     40    __int32       tv_padding0;
     41} BirdTimeVal_T;
     42
    3643typedef struct BirdTimeSpec
    3744{
     
    4754#endif
    4855
    49 
  • trunk/src/lib/nt/ntunlink.c

    r3009 r3060  
    55
    66/*
    7  * Copyright (c) 2005-2013 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
     7 * Copyright (c) 2005-2017 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
    88 *
    99 * Permission is hereby granted, free of charge, to any person obtaining a
     
    3333*   Header Files                                                               *
    3434*******************************************************************************/
    35 #include <stdio.h>
    36 #include <errno.h>
    37 #include <malloc.h>
     35#include "ntunlink.h"
    3836
    3937#include "ntstuff.h"
  • trunk/src/lib/nt/ntunlink.h

    r3009 r3060  
    3333
    3434#include "nttypes.h"
     35#include <wchar.h>
    3536
    3637int birdUnlink(const char *pszFile);
  • trunk/src/lib/nt/ntutimes.h

    r3049 r3060  
    11/* $Id$ */
    22/** @file
    3  * MSC + NT unlink and variations.
     3 * MSC + NT utimes and lutimes.
    44 */
    55
    66/*
    7  * Copyright (c) 2005-2013 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
     7 * Copyright (c) 2005-2017 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
    88 *
    99 * Permission is hereby granted, free of charge, to any person obtaining a
     
    2929 */
    3030
    31 #ifndef ___nt_ntunlink_h
    32 #define ___nt_ntunlink_h
     31#ifndef ___nt_ntutimes_h
     32#define ___nt_ntutimes_h
    3333
    3434#include "nttypes.h"
    3535
    36 int birdUnlink(const char *pszFile);
    37 int birdUnlinkW(const wchar_t *pwszFile);
    38 int birdUnlinkEx(void *hRoot, const char *pszFile);
    39 int birdUnlinkExW(void *hRoot, const wchar_t *pwszFile);
    40 int birdUnlinkForced(const char *pszFile);
    41 int birdUnlinkForcedW(const wchar_t *pwszFile);
    42 int birdUnlinkForcedEx(void *hRoot, const char *pszFile);
    43 int birdUnlinkForcedExW(void *hRoot, const wchar_t *pszFile);
    44 int birdUnlinkForcedFast(const char *pszFile);
    45 int birdUnlinkForcedFastW(const wchar_t *pwszFile);
    46 int birdUnlinkForcedFastEx(void *hRoot, const char *pszFile);
    47 int birdUnlinkForcedFastExW(void *hRoot, const wchar_t *pwszFile);
     36int birdUtimes(const char *pszFile, BirdTimeVal_T paTimes[2]);
     37int birdLUtimes(const char *pszFile, BirdTimeVal_T paTimes[2]);
    4838
    49 #undef  unlink
    50 #define unlink(a_pszPath)     birdUnlinkForced(a_pszPath)
     39#undef  utimes
     40#define utimes(a_pszPath, a_paTimes)    birdUtimes(a_pszPath, a_paTimes)
     41#undef  lutimes
     42#define lutimes(a_pszPath, a_paTimes)   birdLUtimes(a_pszPath, a_paTimes)
    5143
    5244#endif
Note: See TracChangeset for help on using the changeset viewer.