2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
24 /*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
25 /*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
26 /*%% (c) Copyright 1993, 1994 Novell, Inc. */
27 /*%% $XConsortium: issync.c /main/3 1995/10/23 11:45:20 rswiston $ */
29 static char sccsid[] = "@(#)issync.c 1.7 89/07/17 Copyr 1988 Sun Micro";
32 * Copyright (c) 1988 by Sun Microsystems, Inc.
39 * Sync all kernel buffers to the disk.
41 * Note: issync() flushes changed kernel buffers that are local to
42 * the application that issued the call.
44 * See sync(2) UNIX manual for what actually happens if sync() is called.
47 #include "isam_impl.h"
58 return iscntl(ALLISFD, ISCNTL_FSYNC);
68 return iscntl(isfd, ISCNTL_FSYNC);
76 for (i = 0; i < MAXISFD; i++)
82 int _isfsync(int isfd)
89 * Get File Access Block.
91 if ((fab = _isfd_find(isfd)) == NULL) {
92 _setiserrno2(ENOTOPEN, '9', '0');
97 * Check that the open mode was ISINPUT, or ISINOUT.
99 if (fab->openmode != OM_INPUT && fab->openmode != OM_INOUT) {
100 _setiserrno2(ENOTOPEN, '9', '0');
107 * Get FCB corresponding to the isfhandle handle.
109 if ((fcb = _openfcb(&fab->isfhandle, &fab->errcode)) == NULL) {
115 if (fcb->datfd != -1)
116 (void)fsync(fcb->datfd);
118 if (fcb->indfd != -1)
119 (void)fsync(fcb->indfd);
121 if (fcb->varfd != -1)
122 (void)fsync(fcb->varfd);
124 _amseterrcode(&fab->errcode, ISOK);
129 _seterr_errcode(&fab->errcode);
131 return (ret); /* Successful write */