Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/lsof.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ enum lsof_file_type {
type */
LSOF_FILE_SCO_SEMA, /**< SCO OpenServer Xenix semaphore file */
LSOF_FILE_SCO_SHARED, /**< SCO OpenServer Xenix shared data file */
LSOF_FILE_NPOLICY, /**< Darwin Netpolicy */
LSOF_FILE_UNSUPPORTED, /**< unsupported file type */

/* types from struct vnode */
Expand Down
15 changes: 15 additions & 0 deletions lib/dialects/darwin/dfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,20 @@ void process_fsevents(struct lsof_context *ctx, /* context */
Lf->type = LSOF_FILE_FSEVENTS;
}

/*
*
* process_fsevents() -- process a network policy file
* see also -
https://github.com/apple-opensource/lsof/blob/da09c8c6436286e5bd8c400b42e86b54404f12a7/lsof/dialects/darwin/libproc/dnetpolicy.c
*/

void process_netpolicy(struct lsof_context *ctx, /* context */
int pid, /* PID */
int32_t fp) /* fd */
{
Lf->type = LSOF_FILE_NPOLICY;
}

/*
* process_kqueue() -- process a kernel queue file
*/
Expand Down Expand Up @@ -612,3 +626,4 @@ void process_fileport_vnode(struct lsof_context *ctx, /* context */
process_vnode_common(ctx, &vi);
}
#endif /* PROC_PIDLISTFILEPORTS */

3 changes: 3 additions & 0 deletions lib/dialects/darwin/dproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,9 @@ static void process_fds(struct lsof_context *ctx, /* context */
case PROX_FDTYPE_VNODE:
(void)process_vnode(ctx, pid, fdp->proc_fd);
break;
case PROX_FDTYPE_NETPOLICY:
(void)process_netpolicy(ctx, pid, fdp->proc_fd);
break;
default:
(void)snpf(Namech, Namechl - 1, "unknown file type: %d",
fdp->proc_fdtype);
Expand Down
1 change: 1 addition & 0 deletions lib/dialects/darwin/dproto.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ extern void process_psem(struct lsof_context *ctx, int pid, int32_t fd);
extern void process_pshm(struct lsof_context *ctx, int pid, int32_t fd);
extern void process_socket(struct lsof_context *ctx, int pid, int32_t fd);
extern void process_vnode(struct lsof_context *ctx, int pid, int32_t fd);
extern void process_netpolicy(struct lsof_context *ctx, int pid, int32_t fd);
#if defined(PROC_PIDLISTFILEPORTS)
extern void process_fileport_pipe(struct lsof_context *ctx, int pid,
uint32_t fileport);
Expand Down
3 changes: 3 additions & 0 deletions lib/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ void file_type_to_string(enum lsof_file_type type,
case LSOF_FILE_SCO_SHARED:
(void)snpf(buf, buf_len, "XSD");
break;
case LSOF_FILE_NPOLICY:
(void)snpf(buf, buf_len, "NPOLICY");
break;
case LSOF_FILE_UNSUPPORTED:
(void)snpf(buf, buf_len, "UNSP");
break;
Expand Down
Loading