@@ -472,6 +472,72 @@ enum lsof_error lsof_logic_and(struct lsof_context *ctx);
472472enum lsof_error lsof_select_process (struct lsof_context * ctx , char * command ,
473473 int exclude );
474474
475+ /** Ask lsof to select process by matching regex
476+ *
477+ * Select process executing the command that matches with the
478+ * `regex`.
479+ *
480+ * `regex` must begin and end with a slash ('/'), the characters between the
481+ * slashes are interpreted as a regular expression.
482+ *
483+ * The closing slash may be followed by these modifiers:
484+ * - b the regular expression is a basic one.
485+ * - i ignore the case of letters.
486+ * - x the regular expression is an extended one (default).
487+ *
488+ * You can call this function multiple times to add more search conditions.
489+ *
490+ * \since API version 1
491+ */
492+ enum lsof_error lsof_select_process_regex (struct lsof_context * ctx ,
493+ char * regex );
494+
495+ /** Ask lsof to select process by pid (process id)
496+ *
497+ * Select process by comparing pid. You can specify exclusion by setting
498+ * `exclude` to 1.
499+ *
500+ * You can call this function multiple times to add more search conditions.
501+ *
502+ * \since API version 1
503+ */
504+ enum lsof_error lsof_select_pid (struct lsof_context * ctx , uint32_t pid ,
505+ int exclude );
506+
507+ /** Ask lsof to select process by pgid (process group id)
508+ *
509+ * Select process by comparing pgid. You can specify exclusion by setting
510+ * `exclude` to 1.
511+ *
512+ * You can call this function multiple times to add more search conditions.
513+ *
514+ * \since API version 1
515+ */
516+ enum lsof_error lsof_select_pgid (struct lsof_context * ctx , uint32_t pgid ,
517+ int exclude );
518+
519+ /** Ask lsof to select process by uid
520+ *
521+ * Select process whose user id equals to or not equals to `uid`
522+ *
523+ * You can call this function multiple times to add more search conditions.
524+ *
525+ * \since API version 1
526+ */
527+ enum lsof_error lsof_select_uid (struct lsof_context * ctx , uint32_t uid ,
528+ int exclude );
529+
530+ /** Ask lsof to select process by user login
531+ *
532+ * Select process whose user login name equals to or not equals to `login`
533+ *
534+ * You can call this function multiple times to add more search conditions.
535+ *
536+ * \since API version 1
537+ */
538+ enum lsof_error lsof_select_login (struct lsof_context * ctx , char * login ,
539+ int exclude );
540+
475541/** Freeze the lsof context
476542 *
477543 * You can only call it once per context. After this call, no more options can
@@ -503,7 +569,7 @@ enum lsof_error lsof_gather(struct lsof_context *ctx,
503569/** Destroy a lsof context
504570 *
505571 * You should call `lsof_free_result` to free all `struct lsof_result`
506- * before destorying the context.
572+ * before destroying the context.
507573 *
508574 * You must not use the context anymore after this call.
509575 *
0 commit comments