Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4668d54

Browse files
committed
Add fseeko for NetBSD.
1 parentd36caf1 commit4668d54

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

‎configure

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10543,9 +10543,10 @@ done
1054310543
1054410544
1054510545
10546-
# BSD/OShas a custom fseeko/ftello built on fsetpos/fgetpos
10546+
# BSD/OS& NetBSD use a custom fseeko/ftello built on fsetpos/fgetpos
1054710547
# We override the previous test that said fseeko/ftello didn't exist
10548-
case$host_osin bsdi*)
10548+
# OS tests are also done in include/c.h and port/fseeko.c
10549+
case$host_osin bsdi*|netbsd*)
1054910550
ac_cv_func_fseeko=yes
1055010551
esac
1055110552

‎configure.in

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $Header: /cvsroot/pgsql/configure.in,v 1.215 2002/10/24 03:03:37 momjian Exp $
2+
dnl $Header: /cvsroot/pgsql/configure.in,v 1.216 2002/10/24 03:11:05 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -837,9 +837,10 @@ fi
837837

838838
AC_REPLACE_FUNCS([fseeko gethostname getrusage inet_aton random srandom strcasecmp strdup strerror strtol strtoul])
839839

840-
# BSD/OShas a custom fseeko/ftello built on fsetpos/fgetpos
840+
# BSD/OS& NetBSD use a custom fseeko/ftello built on fsetpos/fgetpos
841841
# We override the previous test that said fseeko/ftello didn't exist
842-
case $host_os in bsdi*)
842+
# OS tests are also done in include/c.h and port/fseeko.c
843+
case $host_os in bsdi*|netbsd*)
843844
ac_cv_func_fseeko=yes
844845
esac
845846

‎src/include/c.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $Id: c.h,v 1.129 2002/10/23 23:37:47 momjian Exp $
15+
* $Id: c.h,v 1.130 2002/10/24 03:11:05 momjian Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -639,7 +639,7 @@ typedef NameData *Name;
639639
#include<unistd.h>
640640
#endif
641641

642-
#if defined(bsdi)
642+
#if defined(bsdi)|| defined(netbsd)
643643
intfseeko(FILE*stream,off_toffset,intwhence);
644644
off_tftello(FILE*stream);
645645
#endif

‎src/port/fseeko.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/port/fseeko.c,v 1.3 2002/10/23 21:39:27 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/port/fseeko.c,v 1.4 2002/10/24 03:11:05 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
1515

16-
#ifdef__bsdi__
16+
#if defined(bsdi)|| defined(netbsd)
1717

1818
#include<pthread.h>
1919
#include<stdio.h>
@@ -22,11 +22,11 @@
2222
#include<errno.h>
2323

2424
/*
25-
*On BSD/OS, off_t and fpos_t are the same. Standards say
26-
*off_t is an arithmetic type, but not necessarily integral,
25+
*On BSD/OS and NetBSD, off_t and fpos_t are the same. Standards
26+
*sayoff_t is an arithmetic type, but not necessarily integral,
2727
*while fpos_t might be neither.
2828
*
29-
*This is thread-safe using flockfile/funlockfile.
29+
*This is thread-safeon BSD/OSusing flockfile/funlockfile.
3030
*/
3131

3232
int
@@ -38,13 +38,17 @@ fseeko(FILE *stream, off_t offset, int whence)
3838
switch (whence)
3939
{
4040
caseSEEK_CUR:
41+
#ifdefbsdi
4142
flockfile(stream);
43+
#endif
4244
if (fgetpos(stream,&floc)!=0)
4345
gotofailure;
4446
floc+=offset;
4547
if (fsetpos(stream,&floc)!=0)
4648
gotofailure;
49+
#ifdefbsdi
4750
flockfile(stream);
51+
#endif
4852
return0;
4953
break;
5054
caseSEEK_SET:
@@ -53,13 +57,17 @@ fseeko(FILE *stream, off_t offset, int whence)
5357
return0;
5458
break;
5559
caseSEEK_END:
60+
#ifdefbsdi
5661
flockfile(stream);
62+
#endif
5763
if (fstat(fileno(stream),&filestat)!=0)
5864
gotofailure;
5965
floc=filestat.st_size;
6066
if (fsetpos(stream,&floc)!=0)
6167
gotofailure;
68+
#ifdefbsdi
6269
funlockfile(stream);
70+
#endif
6371
return0;
6472
break;
6573
default:
@@ -68,7 +76,9 @@ fseeko(FILE *stream, off_t offset, int whence)
6876
}
6977

7078
failure:
79+
#ifdefbsdi
7180
funlockfile(stream);
81+
#endif
7282
return-1;
7383
}
7484

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp