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 * Copyright (c) 1988 by Sun Microsystems, Inc.
36 * Sync all kernel buffers to the disk.
38 * Note: issync() flushes changed kernel buffers that are local to
39 * the application that issued the call.
41 * See sync(2) UNIX manual for what actually happens if sync() is called.
44 #include "isam_impl.h"
55 return iscntl(ALLISFD, ISCNTL_FSYNC);
65 return iscntl(isfd, ISCNTL_FSYNC);
73 for (i = 0; i < MAXISFD; i++)
79 int _isfsync(int isfd)
86 * Get File Access Block.
88 if ((fab = _isfd_find(isfd)) == NULL) {
89 _setiserrno2(ENOTOPEN, '9', '0');
94 * Check that the open mode was ISINPUT, or ISINOUT.
96 if (fab->openmode != OM_INPUT && fab->openmode != OM_INOUT) {
97 _setiserrno2(ENOTOPEN, '9', '0');
104 * Get FCB corresponding to the isfhandle handle.
106 if ((fcb = _openfcb(&fab->isfhandle, &fab->errcode)) == NULL) {
112 if (fcb->datfd != -1)
113 (void)fsync(fcb->datfd);
115 if (fcb->indfd != -1)
116 (void)fsync(fcb->indfd);
118 if (fcb->varfd != -1)
119 (void)fsync(fcb->varfd);
121 _amseterrcode(&fab->errcode, ISOK);
126 _seterr_errcode(&fab->errcode);
128 return (ret); /* Successful write */