configure: Remove some no longer needed configure checks.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
bc20705c29
commit
21cec48570
|
@ -7502,7 +7502,6 @@ for ac_header in \
|
||||||
gsm.h \
|
gsm.h \
|
||||||
gsm/gsm.h \
|
gsm/gsm.h \
|
||||||
ieeefp.h \
|
ieeefp.h \
|
||||||
inet/mib2.h \
|
|
||||||
libproc.h \
|
libproc.h \
|
||||||
link.h \
|
link.h \
|
||||||
linux/cdrom.h \
|
linux/cdrom.h \
|
||||||
|
@ -7539,7 +7538,6 @@ for ac_header in \
|
||||||
scsi/scsi_ioctl.h \
|
scsi/scsi_ioctl.h \
|
||||||
scsi/sg.h \
|
scsi/sg.h \
|
||||||
stdint.h \
|
stdint.h \
|
||||||
stropts.h \
|
|
||||||
sys/attr.h \
|
sys/attr.h \
|
||||||
sys/auxv.h \
|
sys/auxv.h \
|
||||||
sys/cdio.h \
|
sys/cdio.h \
|
||||||
|
@ -7551,7 +7549,6 @@ for ac_header in \
|
||||||
sys/link.h \
|
sys/link.h \
|
||||||
sys/mman.h \
|
sys/mman.h \
|
||||||
sys/modem.h \
|
sys/modem.h \
|
||||||
sys/msg.h \
|
|
||||||
sys/mtio.h \
|
sys/mtio.h \
|
||||||
sys/param.h \
|
sys/param.h \
|
||||||
sys/poll.h \
|
sys/poll.h \
|
||||||
|
@ -7571,7 +7568,6 @@ for ac_header in \
|
||||||
sys/strtio.h \
|
sys/strtio.h \
|
||||||
sys/syscall.h \
|
sys/syscall.h \
|
||||||
sys/sysinfo.h \
|
sys/sysinfo.h \
|
||||||
sys/tihdr.h \
|
|
||||||
sys/time.h \
|
sys/time.h \
|
||||||
sys/timeout.h \
|
sys/timeout.h \
|
||||||
sys/times.h \
|
sys/times.h \
|
||||||
|
@ -18014,9 +18010,7 @@ for ac_func in \
|
||||||
port_create \
|
port_create \
|
||||||
posix_fadvise \
|
posix_fadvise \
|
||||||
prctl \
|
prctl \
|
||||||
pread \
|
|
||||||
proc_pidinfo \
|
proc_pidinfo \
|
||||||
pwrite \
|
|
||||||
readlink \
|
readlink \
|
||||||
sched_yield \
|
sched_yield \
|
||||||
setproctitle \
|
setproctitle \
|
||||||
|
@ -18329,17 +18323,12 @@ if test "$ac_res" != no; then :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
for ac_func in \
|
for ac_func in getaddrinfo
|
||||||
getaddrinfo \
|
|
||||||
getnameinfo \
|
|
||||||
getservbyport \
|
|
||||||
|
|
||||||
do :
|
do :
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo"
|
||||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
if test "x$ac_cv_func_getaddrinfo" = xyes; then :
|
||||||
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
#define HAVE_GETADDRINFO 1
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
12
configure.ac
12
configure.ac
|
@ -467,7 +467,6 @@ AC_CHECK_HEADERS(\
|
||||||
gsm.h \
|
gsm.h \
|
||||||
gsm/gsm.h \
|
gsm/gsm.h \
|
||||||
ieeefp.h \
|
ieeefp.h \
|
||||||
inet/mib2.h \
|
|
||||||
libproc.h \
|
libproc.h \
|
||||||
link.h \
|
link.h \
|
||||||
linux/cdrom.h \
|
linux/cdrom.h \
|
||||||
|
@ -504,7 +503,6 @@ AC_CHECK_HEADERS(\
|
||||||
scsi/scsi_ioctl.h \
|
scsi/scsi_ioctl.h \
|
||||||
scsi/sg.h \
|
scsi/sg.h \
|
||||||
stdint.h \
|
stdint.h \
|
||||||
stropts.h \
|
|
||||||
sys/attr.h \
|
sys/attr.h \
|
||||||
sys/auxv.h \
|
sys/auxv.h \
|
||||||
sys/cdio.h \
|
sys/cdio.h \
|
||||||
|
@ -516,7 +514,6 @@ AC_CHECK_HEADERS(\
|
||||||
sys/link.h \
|
sys/link.h \
|
||||||
sys/mman.h \
|
sys/mman.h \
|
||||||
sys/modem.h \
|
sys/modem.h \
|
||||||
sys/msg.h \
|
|
||||||
sys/mtio.h \
|
sys/mtio.h \
|
||||||
sys/param.h \
|
sys/param.h \
|
||||||
sys/poll.h \
|
sys/poll.h \
|
||||||
|
@ -536,7 +533,6 @@ AC_CHECK_HEADERS(\
|
||||||
sys/strtio.h \
|
sys/strtio.h \
|
||||||
sys/syscall.h \
|
sys/syscall.h \
|
||||||
sys/sysinfo.h \
|
sys/sysinfo.h \
|
||||||
sys/tihdr.h \
|
|
||||||
sys/time.h \
|
sys/time.h \
|
||||||
sys/timeout.h \
|
sys/timeout.h \
|
||||||
sys/times.h \
|
sys/times.h \
|
||||||
|
@ -2188,9 +2184,7 @@ AC_CHECK_FUNCS(\
|
||||||
port_create \
|
port_create \
|
||||||
posix_fadvise \
|
posix_fadvise \
|
||||||
prctl \
|
prctl \
|
||||||
pread \
|
|
||||||
proc_pidinfo \
|
proc_pidinfo \
|
||||||
pwrite \
|
|
||||||
readlink \
|
readlink \
|
||||||
sched_yield \
|
sched_yield \
|
||||||
setproctitle \
|
setproctitle \
|
||||||
|
@ -2223,11 +2217,7 @@ dnl Check for -lresolv for Solaris
|
||||||
AC_SEARCH_LIBS(inet_aton, resolv)
|
AC_SEARCH_LIBS(inet_aton, resolv)
|
||||||
|
|
||||||
dnl **** Check for functions which may rely on -lsocket on Solaris.
|
dnl **** Check for functions which may rely on -lsocket on Solaris.
|
||||||
AC_CHECK_FUNCS(\
|
AC_CHECK_FUNCS(getaddrinfo)
|
||||||
getaddrinfo \
|
|
||||||
getnameinfo \
|
|
||||||
getservbyport \
|
|
||||||
)
|
|
||||||
|
|
||||||
dnl Check for clock_gettime which may be in -lrt
|
dnl Check for clock_gettime which may be in -lrt
|
||||||
case $host_os in
|
case $host_os in
|
||||||
|
|
|
@ -147,9 +147,6 @@
|
||||||
/* Define to 1 if you have the `getifaddrs' function. */
|
/* Define to 1 if you have the `getifaddrs' function. */
|
||||||
#undef HAVE_GETIFADDRS
|
#undef HAVE_GETIFADDRS
|
||||||
|
|
||||||
/* Define to 1 if you have the `getnameinfo' function. */
|
|
||||||
#undef HAVE_GETNAMEINFO
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <getopt.h> header file. */
|
/* Define to 1 if you have the <getopt.h> header file. */
|
||||||
#undef HAVE_GETOPT_H
|
#undef HAVE_GETOPT_H
|
||||||
|
|
||||||
|
@ -159,9 +156,6 @@
|
||||||
/* Define to 1 if you have the `getrandom' function. */
|
/* Define to 1 if you have the `getrandom' function. */
|
||||||
#undef HAVE_GETRANDOM
|
#undef HAVE_GETRANDOM
|
||||||
|
|
||||||
/* Define to 1 if you have the `getservbyport' function. */
|
|
||||||
#undef HAVE_GETSERVBYPORT
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <gettext-po.h> header file. */
|
/* Define to 1 if you have the <gettext-po.h> header file. */
|
||||||
#undef HAVE_GETTEXT_PO_H
|
#undef HAVE_GETTEXT_PO_H
|
||||||
|
|
||||||
|
@ -198,9 +192,6 @@
|
||||||
/* Define to 1 if you have the `if_nameindex' function. */
|
/* Define to 1 if you have the `if_nameindex' function. */
|
||||||
#undef HAVE_IF_NAMEINDEX
|
#undef HAVE_IF_NAMEINDEX
|
||||||
|
|
||||||
/* Define to 1 if you have the <inet/mib2.h> header file. */
|
|
||||||
#undef HAVE_INET_MIB2_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
#undef HAVE_INTTYPES_H
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
|
@ -519,9 +510,6 @@
|
||||||
/* Define to 1 if you have the `prctl' function. */
|
/* Define to 1 if you have the `prctl' function. */
|
||||||
#undef HAVE_PRCTL
|
#undef HAVE_PRCTL
|
||||||
|
|
||||||
/* Define to 1 if you have the `pread' function. */
|
|
||||||
#undef HAVE_PREAD
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `proc_pidinfo' function. */
|
/* Define to 1 if you have the `proc_pidinfo' function. */
|
||||||
#undef HAVE_PROC_PIDINFO
|
#undef HAVE_PROC_PIDINFO
|
||||||
|
|
||||||
|
@ -540,9 +528,6 @@
|
||||||
/* Define to 1 if you have the <pwd.h> header file. */
|
/* Define to 1 if you have the <pwd.h> header file. */
|
||||||
#undef HAVE_PWD_H
|
#undef HAVE_PWD_H
|
||||||
|
|
||||||
/* Define to 1 if you have the `pwrite' function. */
|
|
||||||
#undef HAVE_PWRITE
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <QuickTime/ImageCompression.h> header file. */
|
/* Define to 1 if you have the <QuickTime/ImageCompression.h> header file. */
|
||||||
#undef HAVE_QUICKTIME_IMAGECOMPRESSION_H
|
#undef HAVE_QUICKTIME_IMAGECOMPRESSION_H
|
||||||
|
|
||||||
|
@ -627,9 +612,6 @@
|
||||||
/* Define to 1 if you have the <string.h> header file. */
|
/* Define to 1 if you have the <string.h> header file. */
|
||||||
#undef HAVE_STRING_H
|
#undef HAVE_STRING_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <stropts.h> header file. */
|
|
||||||
#undef HAVE_STROPTS_H
|
|
||||||
|
|
||||||
/* Define to 1 if `direction' is a member of `struct ff_effect'. */
|
/* Define to 1 if `direction' is a member of `struct ff_effect'. */
|
||||||
#undef HAVE_STRUCT_FF_EFFECT_DIRECTION
|
#undef HAVE_STRUCT_FF_EFFECT_DIRECTION
|
||||||
|
|
||||||
|
@ -794,9 +776,6 @@
|
||||||
/* Define to 1 if you have the <sys/mount.h> header file. */
|
/* Define to 1 if you have the <sys/mount.h> header file. */
|
||||||
#undef HAVE_SYS_MOUNT_H
|
#undef HAVE_SYS_MOUNT_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/msg.h> header file. */
|
|
||||||
#undef HAVE_SYS_MSG_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/mtio.h> header file. */
|
/* Define to 1 if you have the <sys/mtio.h> header file. */
|
||||||
#undef HAVE_SYS_MTIO_H
|
#undef HAVE_SYS_MTIO_H
|
||||||
|
|
||||||
|
@ -866,9 +845,6 @@
|
||||||
/* Define to 1 if you have the <sys/thr.h> header file. */
|
/* Define to 1 if you have the <sys/thr.h> header file. */
|
||||||
#undef HAVE_SYS_THR_H
|
#undef HAVE_SYS_THR_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/tihdr.h> header file. */
|
|
||||||
#undef HAVE_SYS_TIHDR_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/timeout.h> header file. */
|
/* Define to 1 if you have the <sys/timeout.h> header file. */
|
||||||
#undef HAVE_SYS_TIMEOUT_H
|
#undef HAVE_SYS_TIMEOUT_H
|
||||||
|
|
||||||
|
|
|
@ -194,30 +194,6 @@ extern int getopt_long_only (int ___argc, char *const *___argv,
|
||||||
int lstat(const char *file_name, struct stat *buf);
|
int lstat(const char *file_name, struct stat *buf);
|
||||||
#endif /* HAVE_LSTAT */
|
#endif /* HAVE_LSTAT */
|
||||||
|
|
||||||
#ifndef HAVE_POLL
|
|
||||||
struct pollfd
|
|
||||||
{
|
|
||||||
int fd;
|
|
||||||
short events;
|
|
||||||
short revents;
|
|
||||||
};
|
|
||||||
#define POLLIN 0x01
|
|
||||||
#define POLLPRI 0x02
|
|
||||||
#define POLLOUT 0x04
|
|
||||||
#define POLLERR 0x08
|
|
||||||
#define POLLHUP 0x10
|
|
||||||
#define POLLNVAL 0x20
|
|
||||||
int poll( struct pollfd *fds, unsigned int count, int timeout );
|
|
||||||
#endif /* HAVE_POLL */
|
|
||||||
|
|
||||||
#ifndef HAVE_PREAD
|
|
||||||
ssize_t pread( int fd, void *buf, size_t count, off_t offset );
|
|
||||||
#endif /* HAVE_PREAD */
|
|
||||||
|
|
||||||
#ifndef HAVE_PWRITE
|
|
||||||
ssize_t pwrite( int fd, const void *buf, size_t count, off_t offset );
|
|
||||||
#endif /* HAVE_PWRITE */
|
|
||||||
|
|
||||||
#ifndef HAVE_READLINK
|
#ifndef HAVE_READLINK
|
||||||
int readlink( const char *path, char *buf, size_t size );
|
int readlink( const char *path, char *buf, size_t size );
|
||||||
#endif /* HAVE_READLINK */
|
#endif /* HAVE_READLINK */
|
||||||
|
|
|
@ -4,9 +4,6 @@ C_SRCS = \
|
||||||
getopt.c \
|
getopt.c \
|
||||||
lstat.c \
|
lstat.c \
|
||||||
mkstemps.c \
|
mkstemps.c \
|
||||||
poll.c \
|
|
||||||
pread.c \
|
|
||||||
pwrite.c \
|
|
||||||
readlink.c \
|
readlink.c \
|
||||||
spawn.c \
|
spawn.c \
|
||||||
symlink.c
|
symlink.c
|
||||||
|
|
101
libs/port/poll.c
101
libs/port/poll.c
|
@ -1,101 +0,0 @@
|
||||||
/*
|
|
||||||
* poll function
|
|
||||||
*
|
|
||||||
* Copyright 2008 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_POLL
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TIME_H
|
|
||||||
#include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* we can't include winsock2.h here so we have to duplicate the definitions for Windows */
|
|
||||||
#if defined(__MINGW32__) || defined(_MSC_VER)
|
|
||||||
|
|
||||||
#define FD_SETSIZE 64
|
|
||||||
|
|
||||||
struct __ms_timeval
|
|
||||||
{
|
|
||||||
long tv_sec;
|
|
||||||
long tv_usec;
|
|
||||||
};
|
|
||||||
#define timeval __ms_timeval
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
unsigned int fd_count;
|
|
||||||
int fd_array[FD_SETSIZE]; /* an array of SOCKETs */
|
|
||||||
} fd_set;
|
|
||||||
|
|
||||||
#define FD_ZERO(set) ((set)->fd_count = 0)
|
|
||||||
#define FD_ISSET(fd, set) __WSAFDIsSet((fd), (set))
|
|
||||||
#define FD_SET(fd, set) do { if ((set)->fd_count < FD_SETSIZE) (set)->fd_array[(set)->fd_count++]=(fd); } while(0)
|
|
||||||
|
|
||||||
int __stdcall select(int,fd_set*,fd_set*,fd_set*,const struct timeval*);
|
|
||||||
int __stdcall __WSAFDIsSet(int,fd_set*);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int poll( struct pollfd *fds, unsigned int count, int timeout )
|
|
||||||
{
|
|
||||||
fd_set read_set, write_set, except_set;
|
|
||||||
unsigned int i;
|
|
||||||
int maxfd = -1, ret;
|
|
||||||
|
|
||||||
FD_ZERO( &read_set );
|
|
||||||
FD_ZERO( &write_set );
|
|
||||||
FD_ZERO( &except_set );
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
if (fds[i].fd == -1) continue;
|
|
||||||
if (fds[i].events & (POLLIN|POLLPRI)) FD_SET( fds[i].fd, &read_set );
|
|
||||||
if (fds[i].events & POLLOUT) FD_SET( fds[i].fd, &write_set );
|
|
||||||
FD_SET( fds[i].fd, &except_set ); /* POLLERR etc. are always selected */
|
|
||||||
if (fds[i].fd > maxfd) maxfd = fds[i].fd;
|
|
||||||
}
|
|
||||||
if (timeout != -1)
|
|
||||||
{
|
|
||||||
struct timeval tv;
|
|
||||||
tv.tv_sec = timeout / 1000;
|
|
||||||
tv.tv_usec = timeout % 1000;
|
|
||||||
ret = select( maxfd + 1, &read_set, &write_set, &except_set, &tv );
|
|
||||||
}
|
|
||||||
else ret = select( maxfd + 1, &read_set, &write_set, &except_set, NULL );
|
|
||||||
|
|
||||||
if (ret >= 0)
|
|
||||||
{
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
fds[i].revents = 0;
|
|
||||||
if (fds[i].fd == -1) continue;
|
|
||||||
if (FD_ISSET( fds[i].fd, &read_set )) fds[i].revents |= POLLIN;
|
|
||||||
if (FD_ISSET( fds[i].fd, &write_set )) fds[i].revents |= POLLOUT;
|
|
||||||
if (FD_ISSET( fds[i].fd, &except_set )) fds[i].revents |= POLLERR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* HAVE_POLL */
|
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* pread function
|
|
||||||
*
|
|
||||||
* Copyright 1996 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"
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
# include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* FIXME: this is not thread-safe */
|
|
||||||
|
|
||||||
#ifndef HAVE_PREAD
|
|
||||||
ssize_t pread( int fd, void *buf, size_t count, off_t offset )
|
|
||||||
{
|
|
||||||
ssize_t ret;
|
|
||||||
off_t old_pos;
|
|
||||||
|
|
||||||
if ((old_pos = lseek( fd, 0, SEEK_CUR )) == -1) return -1;
|
|
||||||
if (lseek( fd, offset, SEEK_SET ) == -1) return -1;
|
|
||||||
if ((ret = read( fd, buf, count )) == -1)
|
|
||||||
{
|
|
||||||
int err = errno; /* save errno */
|
|
||||||
lseek( fd, old_pos, SEEK_SET );
|
|
||||||
errno = err;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (lseek( fd, old_pos, SEEK_SET ) == -1) return -1;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif /* HAVE_PREAD */
|
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* pwrite function
|
|
||||||
*
|
|
||||||
* Copyright 1996 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"
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
# include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* FIXME: this is not thread-safe */
|
|
||||||
|
|
||||||
#ifndef HAVE_PWRITE
|
|
||||||
ssize_t pwrite( int fd, const void *buf, size_t count, off_t offset )
|
|
||||||
{
|
|
||||||
ssize_t ret;
|
|
||||||
off_t old_pos;
|
|
||||||
|
|
||||||
if ((old_pos = lseek( fd, 0, SEEK_CUR )) == -1) return -1;
|
|
||||||
if (lseek( fd, offset, SEEK_SET ) == -1) return -1;
|
|
||||||
if ((ret = write( fd, buf, count )) == -1)
|
|
||||||
{
|
|
||||||
int err = errno; /* save errno */
|
|
||||||
lseek( fd, old_pos, SEEK_SET );
|
|
||||||
errno = err;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (lseek( fd, old_pos, SEEK_SET ) == -1) return -1;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif /* HAVE_PWRITE */
|
|
Loading…
Reference in New Issue