#include <vm/vm_map.h>
#include <vm/vm_protos.h>
-#define f_flag f_fglob->fg_flag
-#define f_type f_fglob->fg_ops->fo_type
-#define f_msgcount f_fglob->fg_msgcount
-#define f_cred f_fglob->fg_cred
-#define f_ops f_fglob->fg_ops
-#define f_offset f_fglob->fg_offset
-#define f_data f_fglob->fg_data
+#define f_flag fp_glob->fg_flag
+#define f_ops fp_glob->fg_ops
+#define f_data fp_glob->fg_data
/*
* Used to construct the list of memory objects
static void pshm_cache_add(pshm_info_t *entry);
static void pshm_cache_delete(pshm_info_t *entry);
-static int pshm_read(struct fileproc *fp, struct uio *uio, int flags, vfs_context_t ctx);
-static int pshm_write(struct fileproc *fp, struct uio *uio, int flags, vfs_context_t ctx);
-static int pshm_ioctl(struct fileproc *fp, u_long com, caddr_t data, vfs_context_t ctx);
-static int pshm_select(struct fileproc *fp, int which, void *wql, vfs_context_t ctx);
static int pshm_closefile(struct fileglob *fg, vfs_context_t ctx);
-static int pshm_kqfilter(struct fileproc *fp, struct knote *kn,
- struct kevent_internal_s *kev, vfs_context_t ctx);
-
static int pshm_access(pshm_info_t *pinfo, int mode, kauth_cred_t cred, proc_t p);
int pshm_cache_purge_all(proc_t p);
static int pshm_unlink_internal(pshm_info_t *pinfo);
static const struct fileops pshmops = {
- .fo_type = DTYPE_PSXSHM,
- .fo_read = pshm_read,
- .fo_write = pshm_write,
- .fo_ioctl = pshm_ioctl,
- .fo_select = pshm_select,
- .fo_close = pshm_closefile,
- .fo_kqfilter = pshm_kqfilter,
- .fo_drain = NULL,
+ .fo_type = DTYPE_PSXSHM,
+ .fo_read = fo_no_read,
+ .fo_write = fo_no_write,
+ .fo_ioctl = fo_no_ioctl,
+ .fo_select = fo_no_select,
+ .fo_close = pshm_closefile,
+ .fo_drain = fo_no_drain,
+ .fo_kqfilter = fo_no_kqfilter,
};
/*
pshmnode_t *new_pnode = NULL;
struct fileproc *fp = NULL;
int fmode;
- int cmode = uap->mode;
+ mode_t cmode = (mode_t)uap->mode;
bool incache = false;
bool have_label = false;
AUDIT_ARG(fflags, uap->oflag);
- AUDIT_ARG(mode, uap->mode);
+ AUDIT_ARG(mode, cmode);
/*
* Allocate data structures we need. We parse the userspace name into
user_map = current_map();
- if (fp->f_type != DTYPE_PSXSHM) {
+ if (FILEGLOB_DTYPE(fp->fp_glob) != DTYPE_PSXSHM) {
return EINVAL;
}
static int
pshm_access(pshm_info_t *pinfo, int mode, kauth_cred_t cred, __unused proc_t p)
{
- int mode_req = ((mode & FREAD) ? S_IRUSR : 0) |
+ mode_t mode_req = ((mode & FREAD) ? S_IRUSR : 0) |
((mode & FWRITE) ? S_IWUSR : 0);
/* Otherwise, user id 0 always gets access. */
if (file_pos >= map_pos + pshmobj->pshmo_size) {
continue;
}
- map_size = pshmobj->pshmo_size - (file_pos - map_pos);
+ map_size = (vm_map_size_t)(pshmobj->pshmo_size - (file_pos - map_pos));
if (map_size > user_size) {
map_size = user_size;
}
switch (kret) {
case KERN_SUCCESS:
- *retval = (user_start_addr + pageoff);
+ *retval = (user_addr_t)(user_start_addr + pageoff);
return 0;
case KERN_INVALID_ADDRESS:
case KERN_NO_SPACE:
return error;
}
-static int
-pshm_read(__unused struct fileproc *fp, __unused struct uio *uio,
- __unused int flags, __unused vfs_context_t ctx)
-{
- return ENOTSUP;
-}
-
-static int
-pshm_write(__unused struct fileproc *fp, __unused struct uio *uio,
- __unused int flags, __unused vfs_context_t ctx)
-{
- return ENOTSUP;
-}
-
-static int
-pshm_ioctl(__unused struct fileproc *fp, __unused u_long com,
- __unused caddr_t data, __unused vfs_context_t ctx)
-{
- return ENOTSUP;
-}
-
-static int
-pshm_select(__unused struct fileproc *fp, __unused int which, __unused void *wql,
- __unused vfs_context_t ctx)
-{
- return ENOTSUP;
-}
-
-static int
-pshm_kqfilter(__unused struct fileproc *fp, struct knote *kn,
- __unused struct kevent_internal_s *kev, __unused vfs_context_t ctx)
-{
- kn->kn_flags = EV_ERROR;
- kn->kn_data = ENOTSUP;
- return 0;
-}
-
int
fill_pshminfo(pshmnode_t * pshm, struct pshm_info * info)
{