4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
30 #pragma ident "%Z%%M% %I% %E% SMI"
40 #include <stdio_ext.h>
46 * _flockget and _flockrel are only called by the
47 * FLOCKFILE/FUNLOCKFILE macros in mtlib.h.
51 * compute the lock's position, acquire it and return its pointer
57 rmutex_t
*rl
= IOB_LCK(iop
);
60 cancel_safe_mutex_lock(rl
);
65 ftrylockfile(FILE *iop
)
67 rmutex_t
*rl
= IOB_LCK(iop
);
70 return (mutex_trylock(rl
));
71 return (0); /* can't happen? */
77 rmutex_t
*rl
= IOB_LCK(iop
);
80 (void) mutex_lock(rl
);
84 funlockfile(FILE *iop
)
86 rmutex_t
*rl
= IOB_LCK(iop
);
89 (void) mutex_unlock(rl
);
93 __fsetlocking(FILE *iop
, int type
)
97 ret
= GET_IONOLOCK(iop
) ? FSETLOCKING_BYCALLER
: FSETLOCKING_INTERNAL
;
101 case FSETLOCKING_QUERY
:
104 case FSETLOCKING_INTERNAL
:
108 case FSETLOCKING_BYCALLER
: