/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
/* Copyright 2015 Joyent, Inc. */
#ifndef _SYS_FILE_H
#define _SYS_FILE_H
#ifdef _KERNEL
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* fio locking:
* f_rwlock protects f_vnode and f_cred
* f_tlock protects the rest
*
* The purpose of locking in this layer is to keep the kernel
* from panicing if, for example, a thread calls close() while
* another thread is doing a read(). It is up to higher levels
* to make sure 2 threads doing I/O to the same file don't
* screw each other up.
*/
/*
* each open file.
*/
typedef struct file {
} file_t;
/*
* fpollinfo struct - used by poll caching to track who has polled the fd
*/
typedef struct fpollinfo {
} fpollinfo_t;
/* f_flag */
/* open-only modes */
/* integrity as specified for writes by */
/* FSYNC and FDSYNC flags */
/* f_flag2 (open-only) */
#ifdef _KERNEL
/*
* This is a flag that is set on f_flag2, but is never user-visible
*/
/*
* Fake flags for driver ioctl calls to inform them of the originating
*
*/
/*
* Large Files: The macro gets the offset maximum (refer to LFS API doc)
* corresponding to a file descriptor. We had the choice of storing
* this value in file descriptor. Right now we only have two
* offset maximums one if MAXOFF_T and other is MAXOFFSET_T. It is
* inefficient to store these two values in a separate member in
* file descriptor. To avoid wasting spaces we define this macro.
* The day there are more than two offset maximum we may want to
* rewrite this macro.
*/
/*
* Fake flag => internal ioctl call for layered drivers.
* Note that this flag deliberately *won't* fit into
* the f_flag field of a file_t.
*
*/
/*
* Fake flag => this time to specify that the open(9E)
* comes from another part of the kernel, not userland.
*
*/
#endif /* _KERNEL */
/* miscellaneous defines */
#ifndef L_SET
#endif /* L_SET */
/*
* For flock(3C). These really don't belong here but for historical reasons
* the interface defines them to be here.
*/
#if !defined(_STRICT_SYMBOLS)
extern int flock(int, int);
#endif
#if defined(_KERNEL)
/*
* Routines dealing with user per-open file flags and
* user open files.
*/
struct proc; /* forward reference for function prototype */
struct vnodeops;
struct vattr;
extern void releasef(int);
#ifndef _BOOT
#endif
extern int closeandsetf(int, file_t *);
extern int ufalloc_file(int, file_t *);
extern int ufalloc(int);
extern void finit(void);
extern int f_getfd_error(int, int *);
extern char f_getfd(int);
extern int f_setfd_error(int, int);
extern void f_setfd(int, char);
extern int f_getfl(int, int *);
extern int f_badfd(int, int *, int);
extern void close_exec(uf_info_t *);
extern void clear_stale_fd(void);
extern void clear_active_fd(int);
extern int fgetstartvp(int, char *, struct vnode **);
extern int fsetattrat(int, char *, int, struct vattr *);
extern void delfpollinfo(int);
extern void addfpollinfo(int);
extern int sock_getfasync(struct vnode *);
extern int files_can_change_zones(void);
#ifdef DEBUG
/* The following functions are only used in ASSERT()s */
extern void checkfpollinfo(void);
extern int infpollinfo(int);
#endif /* DEBUG */
#endif /* defined(_KERNEL) */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FILE_H */