Commit 487c50c1 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 7b704102
...@@ -1560,6 +1560,9 @@ NTSTATUS WINAPI NtSetVolumeInformationFile( ...@@ -1560,6 +1560,9 @@ NTSTATUS WINAPI NtSetVolumeInformationFile(
static NTSTATUS set_file_times( int fd, const LARGE_INTEGER *mtime, const LARGE_INTEGER *atime ) 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 timeval tv[2];
struct stat st; struct stat st;
...@@ -1590,8 +1593,17 @@ static NTSTATUS set_file_times( int fd, const LARGE_INTEGER *mtime, const LARGE_ ...@@ -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_sec = mtime->QuadPart / 10000000 - SECS_1601_TO_1970;
tv[1].tv_usec = (mtime->QuadPart % 10000000) / 10; tv[1].tv_usec = (mtime->QuadPart % 10000000) / 10;
} }
if (!futimes( fd, tv )) return STATUS_SUCCESS; #ifdef HAVE_FUTIMES
return FILE_GetNtStatus(); 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, static inline void get_file_times( const struct stat *st, LARGE_INTEGER *mtime, LARGE_INTEGER *ctime,
......
...@@ -257,11 +257,6 @@ extern int getopt_long_only (int ___argc, char *const *___argv, ...@@ -257,11 +257,6 @@ extern int getopt_long_only (int ___argc, char *const *___argv,
int ffs( int x ); int ffs( int x );
#endif #endif
#ifndef HAVE_FUTIMES
struct timeval;
int futimes(int fd, const struct timeval *tv);
#endif
#ifndef HAVE_GETPAGESIZE #ifndef HAVE_GETPAGESIZE
size_t getpagesize(void); size_t getpagesize(void);
#endif /* HAVE_GETPAGESIZE */ #endif /* HAVE_GETPAGESIZE */
...@@ -456,7 +451,6 @@ extern unsigned char interlocked_cmpxchg128( __int64 *dest, __int64 xchg_high, ...@@ -456,7 +451,6 @@ extern unsigned char interlocked_cmpxchg128( __int64 *dest, __int64 xchg_high,
#define ffs __WINE_NOT_PORTABLE(ffs) #define ffs __WINE_NOT_PORTABLE(ffs)
#define fstatvfs __WINE_NOT_PORTABLE(fstatvfs) #define fstatvfs __WINE_NOT_PORTABLE(fstatvfs)
#define futimes __WINE_NOT_PORTABLE(futimes)
#define getopt_long __WINE_NOT_PORTABLE(getopt_long) #define getopt_long __WINE_NOT_PORTABLE(getopt_long)
#define getopt_long_only __WINE_NOT_PORTABLE(getopt_long_only) #define getopt_long_only __WINE_NOT_PORTABLE(getopt_long_only)
#define getpagesize __WINE_NOT_PORTABLE(getpagesize) #define getpagesize __WINE_NOT_PORTABLE(getpagesize)
......
...@@ -5,7 +5,6 @@ MODULE = libwine_port.a ...@@ -5,7 +5,6 @@ MODULE = libwine_port.a
C_SRCS = \ C_SRCS = \
ffs.c \ ffs.c \
fstatvfs.c \ fstatvfs.c \
futimes.c \
getopt.c \ getopt.c \
getopt1.c \ getopt1.c \
getpagesize.c \ getpagesize.c \
......
/*
* 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 */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment