8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/port/fseeko.c,v 1.9 2003/01/02 23:22:49 momjian Exp $
11
+ * $Header: /cvsroot/pgsql/src/port/fseeko.c,v 1.10 2003/01/11 19:38:23 momjian Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
21
21
22
22
#include "c.h"
23
23
24
+ #ifdef bsdi
24
25
#include <pthread.h>
26
+ #endif
25
27
#include <stdio.h>
26
28
#include <sys/types.h>
27
29
#include <sys/stat.h>
@@ -44,13 +46,17 @@ fseeko(FILE *stream, off_t offset, int whence)
44
46
switch (whence )
45
47
{
46
48
case SEEK_CUR :
49
+ #ifdef bsdi
47
50
flockfile (stream );
51
+ #endif
48
52
if (fgetpos (stream ,& floc )!= 0 )
49
53
gotofailure ;
50
54
floc += offset ;
51
55
if (fsetpos (stream ,& floc )!= 0 )
52
56
gotofailure ;
57
+ #ifdef bsdi
53
58
funlockfile (stream );
59
+ #endif
54
60
return 0 ;
55
61
break ;
56
62
case SEEK_SET :
@@ -59,13 +65,17 @@ fseeko(FILE *stream, off_t offset, int whence)
59
65
return 0 ;
60
66
break ;
61
67
case SEEK_END :
68
+ #ifdef bsdi
62
69
flockfile (stream );
70
+ #endif
63
71
if (fstat (fileno (stream ),& filestat )!= 0 )
64
72
gotofailure ;
65
73
floc = filestat .st_size ;
66
74
if (fsetpos (stream ,& floc )!= 0 )
67
75
gotofailure ;
76
+ #ifdef bsdi
68
77
funlockfile (stream );
78
+ #endif
69
79
return 0 ;
70
80
break ;
71
81
default :
@@ -74,7 +84,9 @@ fseeko(FILE *stream, off_t offset, int whence)
74
84
}
75
85
76
86
failure :
87
+ #ifdef bsdi
77
88
funlockfile (stream );
89
+ #endif
78
90
return -1 ;
79
91
}
80
92