ntdll: Remove futimes implementation from libport, it's only needed in ntdll.

This commit is contained in:
Alexandre Julliard 2012-10-30 11:50:42 +01:00
parent 7b704102a8
commit 487c50c1e7
4 changed files with 14 additions and 67 deletions

View File

@ -1560,6 +1560,9 @@ NTSTATUS WINAPI NtSetVolumeInformationFile(
static NTSTATUS set_file_times( int fd, const LARGE_INTEGER *mtime, const LARGE_INTEGER *atime )
{
NTSTATUS status = STATUS_SUCCESS;
#if defined(HAVE_FUTIMES) || defined(HAVE_FUTIMESAT)
struct timeval tv[2];
struct stat st;
@ -1590,8 +1593,17 @@ static NTSTATUS set_file_times( int fd, const LARGE_INTEGER *mtime, const LARGE_
tv[1].tv_sec = mtime->QuadPart / 10000000 - SECS_1601_TO_1970;
tv[1].tv_usec = (mtime->QuadPart % 10000000) / 10;
}
if (!futimes( fd, tv )) return STATUS_SUCCESS;
return FILE_GetNtStatus();
#ifdef HAVE_FUTIMES
if (futimes( fd, tv ) == -1) status = FILE_GetNtStatus();
#elif defined(HAVE_FUTIMESAT)
if (futimesat( fd, NULL, tv ) == -1) status = FILE_GetNtStatus();
#endif
#else /* HAVE_FUTIMES || HAVE_FUTIMESAT */
FIXME( "setting file times not supported\n" );
status = STATUS_NOT_IMPLEMENTED;
#endif
return status;
}
static inline void get_file_times( const struct stat *st, LARGE_INTEGER *mtime, LARGE_INTEGER *ctime,

View File

@ -257,11 +257,6 @@ extern int getopt_long_only (int ___argc, char *const *___argv,
int ffs( int x );
#endif
#ifndef HAVE_FUTIMES
struct timeval;
int futimes(int fd, const struct timeval *tv);
#endif
#ifndef HAVE_GETPAGESIZE
size_t getpagesize(void);
#endif /* HAVE_GETPAGESIZE */
@ -456,7 +451,6 @@ extern unsigned char interlocked_cmpxchg128( __int64 *dest, __int64 xchg_high,
#define ffs __WINE_NOT_PORTABLE(ffs)
#define fstatvfs __WINE_NOT_PORTABLE(fstatvfs)
#define futimes __WINE_NOT_PORTABLE(futimes)
#define getopt_long __WINE_NOT_PORTABLE(getopt_long)
#define getopt_long_only __WINE_NOT_PORTABLE(getopt_long_only)
#define getpagesize __WINE_NOT_PORTABLE(getpagesize)

View File

@ -5,7 +5,6 @@ MODULE = libwine_port.a
C_SRCS = \
ffs.c \
fstatvfs.c \
futimes.c \
getopt.c \
getopt1.c \
getpagesize.c \

View File

@ -1,58 +0,0 @@
/*
* futimes function
*
* Copyright 2004 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#ifndef HAVE_FUTIMES
#include <sys/types.h>
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifdef HAVE_UTIME_H
# include <utime.h>
#endif
#include <stdio.h>
#include <errno.h>
int futimes(int fd, const struct timeval tv[2])
{
#ifdef linux
char buffer[sizeof("/proc/self/fd/") + 3*sizeof(int)];
sprintf( buffer, "/proc/self/fd/%u", fd );
if (tv)
{
struct utimbuf ut;
ut.actime = tv[0].tv_sec + (tv[0].tv_usec + 500000) / 1000000;
ut.modtime = tv[1].tv_sec + (tv[1].tv_usec + 500000) / 1000000;
return utime( buffer, &ut );
}
else return utime( buffer, NULL );
#elif defined(HAVE_FUTIMESAT)
return futimesat( fd, NULL, tv );
#else
errno = ENOSYS;
return -1;
#endif
}
#endif /* HAVE_FUTIMES */