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: iscntl.c /main/3 1995/10/23 11:36:59 rswiston $ */
29 static char sccsid[] = "@(#)iscntl.c 1.8 94/11/17";
32 * Copyright (c) 1988 by Sun Microsystems, Inc.
39 * Generic control function
42 #if defined(linux) || defined(CSRG_BASED)
47 #include "isam_impl.h"
51 * err = iscntl(isfd, args)
55 * iscntl(isfd, ISCNTL_RPCS_TO_SET, tout) - Set timeout for short operations
56 * iscntl(isfd, ISCNTL_RPCL_TO_SET, tout) - Set timeout for long operations
57 * iscntl(isfd, ISCNTL_RPCS_TO_GET) - Get timeout for short operations
58 * iscntl(isfd, ISCNTL_RPCL_TO_GET) - Get timeout for long operations
59 * iscntl(isfd, ISCNTL_TCP_TO_SET) - Set TCP reconnect timeout
60 * iscntl(isfd, ISCNTL_TCP_TO_GET) - Get TCP reconnect timeout
62 * iscntl(isfd, ISCNTL_APPLMAGIC_WRITE, string) - Write application magic
63 * iscntl(isfd, ISCNTL_APPLMAGIC_READ, buf) - Read application magic
65 * iscntl(ALLISFD, ISCNTL_FDLIMIT_SET, n) - Set limit on UNIX fd use
66 * iscntl(ALLISFD, ISCNTL_FDLIMIT_GET) - Set limit on UNIX fd use
68 * oldfunc = iscntl(ALLISFD, ISCNTL_FATAL, func) - Set fatal error handler
69 * int func(msg) - Apllication handler
70 * if 0 is returned, NetISAM will use openlog("NetISAM") and
71 * syslog(ERR_LOG, msg) to log the error.
73 * iscntl(ALLISFD, ISCNTL_MASKSIGNALS, bool) 1 mask, 0 don't mask
75 * iscntl(isfd, ISCNTL_FSYNC) - synchronize a file's in-core state
80 typedef int (* intfunc)();
82 #if defined(linux) || defined(CSRG_BASED)
84 iscntl(int isfd, int func, ...)
87 iscntl(isfd, func, va_alist)
93 extern int (*_isfatal_error_set_func())();
97 #if defined(linux) || defined(CSRG_BASED)
104 case ISCNTL_MASKSIGNALS:
105 ret = _issignals_cntl(va_arg(pvar, int));
109 ret = (int)_isfatal_error_set_func(va_arg(pvar, intfunc));
112 case ISCNTL_FDLIMIT_SET:
113 ret = _watchfd_max_set(va_arg(pvar, int));
116 case ISCNTL_FDLIMIT_GET:
117 ret = _watchfd_max_get();
120 case ISCNTL_APPLMAGIC_WRITE:
121 ret = _isapplmw(isfd, (va_arg(pvar, char *)));
124 case ISCNTL_APPLMAGIC_READ:
125 ret = _isapplmr(isfd, (va_arg(pvar, char *)));
129 ret = _isfsync(isfd);
133 _setiserrno2(EBADARG, '9', '0');