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 librararies 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);
69 return iscntl(isfd, ISCNTL_FSYNC);
77 for (i = 0; i < MAXISFD; i++)
91 * Get File Access Block.
93 if ((fab = _isfd_find(isfd)) == NULL) {
94 _setiserrno2(ENOTOPEN, '9', '0');
99 * Check that the open mode was ISINPUT, or ISINOUT.
101 if (fab->openmode != OM_INPUT && fab->openmode != OM_INOUT) {
102 _setiserrno2(ENOTOPEN, '9', '0');
109 * Get FCB corresponding to the isfhandle handle.
111 if ((fcb = _openfcb(&fab->isfhandle, &fab->errcode)) == NULL) {
117 if (fcb->datfd != -1)
118 (void)fsync(fcb->datfd);
120 if (fcb->indfd != -1)
121 (void)fsync(fcb->indfd);
123 if (fcb->varfd != -1)
124 (void)fsync(fcb->varfd);
126 _amseterrcode(&fab->errcode, ISOK);
131 _seterr_errcode(&fab->errcode);
133 return (ret); /* Successful write */