X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/2d21ac55c334faf3a56e5634905ed6987fc787d4..39236c6e673c41db228275375ab7fdb0f837b292:/bsd/sys/filedesc.h diff --git a/bsd/sys/filedesc.h b/bsd/sys/filedesc.h index b9839f3e9..b5b80a6bc 100644 --- a/bsd/sys/filedesc.h +++ b/bsd/sys/filedesc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2012 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -66,7 +66,6 @@ #include -#ifdef __APPLE_API_UNSTABLE /* * This structure is used for the management of descriptors. It may be * shared by multiple processes. @@ -84,6 +83,8 @@ #define NDFILE 25 /* 125 bytes */ #define NDEXTENT 50 /* 250 bytes in 256-byte alloc. */ +#ifdef BSD_KERNEL_PRIVATE + struct klist; struct filedesc { @@ -95,8 +96,6 @@ struct filedesc { int fd_lastfile; /* high-water mark of fd_ofiles */ int fd_freefile; /* approx. next free file */ u_short fd_cmask; /* mask for file creation */ - u_long fd_refcnt; /* reference count */ - int fd_knlistsize; /* size of knlist */ struct klist *fd_knlist; /* list of attached knotes */ u_long fd_knhashmask; /* size of knhash */ @@ -114,13 +113,18 @@ struct filedesc { /* * Per-process open flags. */ -#define UF_EXCLOSE 0x01 /* auto-close on exec */ +#define UF_EXCLOSE 0x01 /* auto-close on exec */ +#define UF_FORKCLOSE 0x02 /* auto-close on fork */ #define UF_RESERVED 0x04 /* open pending / in progress */ #define UF_CLOSING 0x08 /* close in progress */ #ifdef KERNEL #define UF_RESVWAIT 0x10 /* close in progress */ -#define UF_VALID_FLAGS (UF_EXCLOSE| UF_RESERVED | UF_CLOSING | UF_RESVWAIT) +#define UF_INHERIT 0x20 /* "inherit-on-exec" */ + +#define UF_VALID_FLAGS \ + (UF_EXCLOSE | UF_FORKCLOSE | UF_RESERVED | UF_CLOSING |\ + UF_RESVWAIT | UF_INHERIT) #endif /* KERNEL */ /* @@ -142,16 +146,20 @@ extern int fdavail(proc_t p, int n); #define fdflags(p, fd) \ (&(p)->p_fd->fd_ofileflags[(fd)]) extern int falloc(proc_t p, struct fileproc **resultfp, int *resultfd, vfs_context_t ctx); -extern void ffree(struct file *fp); #ifdef __APPLE_API_PRIVATE +typedef struct fileproc *(*fp_allocfn_t)(void *); +extern int falloc_withalloc(proc_t p, struct fileproc **resultfp, + int *resultfd, vfs_context_t ctx, + fp_allocfn_t fp_zalloc, void *crarg); + extern struct filedesc *fdcopy(proc_t p, struct vnode *uth_cdir); extern void fdfree(proc_t p); -extern void fdexec(proc_t p); +extern void fdexec(proc_t p, short flags); #endif /* __APPLE_API_PRIVATE */ #endif /* KERNEL */ -#endif /* __APPLE_API_UNSTABLE */ +#endif /* BSD_KERNEL_PRIVATE */ #endif /* !_SYS_FILEDESC_H_ */