# CONFIG_KLOGD_SOURCE_RING_BUFFER is not set
# CONFIG_LAST is not set
# CONFIG_LOGGER is not set
+CONFIG_LSOF=y
# CONFIG_MDEV is not set
# CONFIG_MDEV_CONF is not set
# CONFIG_MKE2FS is not set
toys/other/yes.c \
toys/pending/dd.c \
toys/pending/expr.c \
+ toys/pending/lsof.c \
toys/pending/more.c \
toys/pending/pgrep.c \
toys/pending/netstat.c \
#define USE_LAST(...)
#define CFG_LOGGER 0
#define USE_LOGGER(...)
+#define CFG_LSOF 1
+#define USE_LSOF(...) __VA_ARGS__
#define CFG_MDEV 0
#define USE_MDEV(...)
#define CFG_MDEV_CONF 0
#undef FOR_deallocvt
#endif
-// df Pkt*a[-Pk] Pkt*a[-Pk]
+// df HPkht*a[-HPkh] HPkht*a[-HPkh]
#undef OPTSTR_df
-#define OPTSTR_df "Pkt*a[-Pk]"
+#define OPTSTR_df "HPkht*a[-HPkh]"
#ifdef CLEANUP_df
#undef CLEANUP_df
#undef FOR_df
#undef FLAG_a
#undef FLAG_t
+#undef FLAG_h
#undef FLAG_k
#undef FLAG_P
+#undef FLAG_H
#endif
// dhcp V:H:F:x*r:O*A#<0T#<0t#<0s:p:i:SBRCaovqnbf
#undef FLAG_S
#endif
-// ls (color):;ZgoACFHLRSacdfiklmnpqrstux1[-Cxm1][-Cxml][-Cxmo][-Cxmg][-cu][-ftS][-HL] (color):;ZgoACFHLRSacdfiklmnpqrstux1[-Cxm1][-Cxml][-Cxmo][-Cxmg][-cu][-ftS][-HL]
+// ls (color):;ZgoACFHLRSacdfhiklmnpqrstux1[-Cxm1][-Cxml][-Cxmo][-Cxmg][-cu][-ftS][-HL] (color):;ZgoACFHLRSacdfhiklmnpqrstux1[-Cxm1][-Cxml][-Cxmo][-Cxmg][-cu][-ftS][-HL]
#undef OPTSTR_ls
-#define OPTSTR_ls "(color):;ZgoACFHLRSacdfiklmnpqrstux1[-Cxm1][-Cxml][-Cxmo][-Cxmg][-cu][-ftS][-HL]"
+#define OPTSTR_ls "(color):;ZgoACFHLRSacdfhiklmnpqrstux1[-Cxm1][-Cxml][-Cxmo][-Cxmg][-cu][-ftS][-HL]"
#ifdef CLEANUP_ls
#undef CLEANUP_ls
#undef FOR_ls
#undef FLAG_l
#undef FLAG_k
#undef FLAG_i
+#undef FLAG_h
#undef FLAG_f
#undef FLAG_d
#undef FLAG_c
#undef FOR_lsmod
#endif
+// lsof lp:t lp:t
+#undef OPTSTR_lsof
+#define OPTSTR_lsof "lp:t"
+#ifdef CLEANUP_lsof
+#undef CLEANUP_lsof
+#undef FOR_lsof
+#undef FLAG_t
+#undef FLAG_p
+#undef FLAG_l
+#endif
+
// lspci emkn@i:
#undef OPTSTR_lspci
#define OPTSTR_lspci 0
#endif
#define FLAG_a (1<<0)
#define FLAG_t (1<<1)
-#define FLAG_k (1<<2)
-#define FLAG_P (1<<3)
+#define FLAG_h (1<<2)
+#define FLAG_k (1<<3)
+#define FLAG_P (1<<4)
+#define FLAG_H (1<<5)
#endif
#ifdef FOR_dhcp
#define FLAG_l (1<<10)
#define FLAG_k (1<<11)
#define FLAG_i (1<<12)
-#define FLAG_f (1<<13)
-#define FLAG_d (1<<14)
-#define FLAG_c (1<<15)
-#define FLAG_a (1<<16)
-#define FLAG_S (1<<17)
-#define FLAG_R (1<<18)
-#define FLAG_L (1<<19)
-#define FLAG_H (1<<20)
-#define FLAG_F (1<<21)
-#define FLAG_C (1<<22)
-#define FLAG_A (1<<23)
-#define FLAG_o (1<<24)
-#define FLAG_g (1<<25)
-#define FLAG_Z (1<<26)
-#define FLAG_color (1<<27)
+#define FLAG_h (1<<13)
+#define FLAG_f (1<<14)
+#define FLAG_d (1<<15)
+#define FLAG_c (1<<16)
+#define FLAG_a (1<<17)
+#define FLAG_S (1<<18)
+#define FLAG_R (1<<19)
+#define FLAG_L (1<<20)
+#define FLAG_H (1<<21)
+#define FLAG_F (1<<22)
+#define FLAG_C (1<<23)
+#define FLAG_A (1<<24)
+#define FLAG_o (1<<25)
+#define FLAG_g (1<<26)
+#define FLAG_Z (1<<27)
+#define FLAG_color (1<<28)
#endif
#ifdef FOR_lsattr
#endif
#endif
+#ifdef FOR_lsof
+#ifndef TT
+#define TT this.lsof
+#endif
+#define FLAG_t (1<<0)
+#define FLAG_p (1<<1)
+#define FLAG_l (1<<2)
+#endif
+
#ifdef FOR_lspci
#ifndef TT
#define TT this.lspci
char *ident;
};
+// toys/pending/lsof.c
+
+struct lsof_data {
+ char *pids;
+
+ struct stat *sought_files;
+
+ struct double_list *files;
+ int last_shown_pid;
+ int shown_header;
+};
+
// toys/pending/mke2fs.c
struct mke2fs_data {
int cin_fd;
};
+// toys/pending/netstat.c
+
+struct netstat_data {
+ char current_name[21];
+ int some_process_unidentified;
+};;
+
// toys/pending/openvt.c
struct openvt_data {
struct klogd_data klogd;
struct last_data last;
struct logger_data logger;
+ struct lsof_data lsof;
struct mke2fs_data mke2fs;
struct modprobe_data modprobe;
struct more_data more;
+ struct netstat_data netstat;
struct openvt_data openvt;
struct pgrep_data pgrep;
struct ping_data ping;
#define help_su "usage: su [-lmp] [-c CMD] [-s SHELL] [USER [ARGS...]]\n\nSwitch to user (or root) and run shell (with optional command line).\n\n-s shell to use\n-c command to pass to shell with -c\n-l login shell\n-(m|p) preserve environment\n\n"
-#define help_seq "usage: seq [-f fmt_str] [-s sep_str] [first] [increment] last\n\nCount from first to last, by increment. Omitted arguments default\nto 1. Two arguments are used as first and last. Arguments can be\nnegative or floating point.\n\n-f Use fmt_str as a floating point format string\n-s Use sep_str as separator, default is a newline character\n\n"
+#define help_seq "usage: seq [-f fmt_str] [-s sep_str] [first] [increment] last\n\nCount from first to last, by increment. Omitted arguments default\nto 1. Two arguments are used as first and last. Arguments can be\nnegative or floating point.\n\n-f Use fmt_str as a printf-style floating point format string\n-s Use sep_str as separator, default is a newline character\n\n"
#define help_pidof "usage: pidof [-s] [-o omitpid[,omitpid...]] [NAME]...\n\nPrint the PIDs of all processes with the given names.\n\n-s single shot, only return one pid.\n-o omit PID(s)\n\n"
#define help_mdev "usage: mdev [-s]\n\nCreate devices in /dev using information from /sys.\n\n-s Scan all entries in /sys to populate /dev.\n\n"
+#define help_lsof "usage: lsof [-lt] [-p PID1,PID2,...] [NAME]...\n\nLists open files. If names are given on the command line, only\nthose files will be shown.\n\n-l list uids numerically\n-p for given comma-separated pids only (default all pids)\n-t terse (pid only) output\n\n"
+
#define help_logger "usage: logger [-s] [-t tag] [-p [facility.]priority] [message]\n\nLog message (or stdin) to syslog.\n\n"
#define help_last "usage: last [-W] [-f FILE]\n\nShow listing of last logged in users.\n\n-W Display the information without host-column truncation.\n-f FILE Read from file FILE instead of /var/log/wtmp.\n\n"
#define help_mkdir "usage: mkdir [-vp] [-m mode] [dirname...]\n\nCreate one or more directories.\n\n-m set permissions of directory to mode.\n-p make parent directories as needed.\n-v verbose\n\n"
-#define help_ls_color "--color device=yellow symlink=turquoise/red dir=blue socket=purple\n files: exe=green suid=red suidfile=redback stickydir=greenback\n =auto means detect if output is a tty.\n\nusage: ls --color[=auto] [-ACFHLRSZacdfiklmnpqrstux1] [directory...]\n\nlist files\n\nwhat to show:\n-a all files including .hidden -c use ctime for timestamps\n-d directory, not contents -i inode number\n-k block sizes in kilobytes -p put a '/' after dir names\n-q unprintable chars as '?' -s size (in blocks)\n-u use access time for timestamps -A list all files but . and ..\n-H follow command line symlinks -L follow symlinks\n-R recursively list files in subdirs -F append /dir *exe @sym |FIFO\n-Z security context\n\noutput formats:\n-1 list one file per line -C columns (sorted vertically)\n-g like -l but no owner -l long (show full details)\n-m comma separated -n like -l but numeric uid/gid\n-o like -l but no group -x columns (horizontal sort)\n\nsorting (default is alphabetical):\n-f unsorted -r reverse -t timestamp -S size\n"
+#define help_ls_color "--color device=yellow symlink=turquoise/red dir=blue socket=purple\n files: exe=green suid=red suidfile=redback stickydir=greenback\n =auto means detect if output is a tty.\n\nusage: ls --color[=auto] [-ACFHLRSZacdfhiklmnpqrstux1] [directory...]\n\nlist files\n\nwhat to show:\n-a all files including .hidden -c use ctime for timestamps\n-d directory, not contents -i inode number\n-k block sizes in kilobytes -p put a '/' after dir names\n-q unprintable chars as '?' -s size (in blocks)\n-u use access time for timestamps -A list all files but . and ..\n-H follow command line symlinks -L follow symlinks\n-R recursively list files in subdirs -F append /dir *exe @sym |FIFO\n-Z security context\n\noutput formats:\n-1 list one file per line -C columns (sorted vertically)\n-g like -l but no owner -h human readable sizes\n-l long (show full details) -m comma separated\n-n like -l but numeric uid/gid -o like -l but no group\n-x columns (horizontal sort)\n\nsorting (default is alphabetical):\n-f unsorted -r reverse -t timestamp -S size\n"
-#define help_ls "usage: ls --color[=auto] [-ACFHLRSZacdfiklmnpqrstux1] [directory...]\n\nlist files\n\nwhat to show:\n-a all files including .hidden -c use ctime for timestamps\n-d directory, not contents -i inode number\n-k block sizes in kilobytes -p put a '/' after dir names\n-q unprintable chars as '?' -s size (in blocks)\n-u use access time for timestamps -A list all files but . and ..\n-H follow command line symlinks -L follow symlinks\n-R recursively list files in subdirs -F append /dir *exe @sym |FIFO\n-Z security context\n\noutput formats:\n-1 list one file per line -C columns (sorted vertically)\n-g like -l but no owner -l long (show full details)\n-m comma separated -n like -l but numeric uid/gid\n-o like -l but no group -x columns (horizontal sort)\n\nsorting (default is alphabetical):\n-f unsorted -r reverse -t timestamp -S size\n--color device=yellow symlink=turquoise/red dir=blue socket=purple\n files: exe=green suid=red suidfile=redback stickydir=greenback\n =auto means detect if output is a tty.\n\n"
+#define help_ls "usage: ls --color[=auto] [-ACFHLRSZacdfhiklmnpqrstux1] [directory...]\n\nlist files\n\nwhat to show:\n-a all files including .hidden -c use ctime for timestamps\n-d directory, not contents -i inode number\n-k block sizes in kilobytes -p put a '/' after dir names\n-q unprintable chars as '?' -s size (in blocks)\n-u use access time for timestamps -A list all files but . and ..\n-H follow command line symlinks -L follow symlinks\n-R recursively list files in subdirs -F append /dir *exe @sym |FIFO\n-Z security context\n\noutput formats:\n-1 list one file per line -C columns (sorted vertically)\n-g like -l but no owner -h human readable sizes\n-l long (show full details) -m comma separated\n-n like -l but numeric uid/gid -o like -l but no group\n-x columns (horizontal sort)\n\nsorting (default is alphabetical):\n-f unsorted -r reverse -t timestamp -S size\n--color device=yellow symlink=turquoise/red dir=blue socket=purple\n files: exe=green suid=red suidfile=redback stickydir=greenback\n =auto means detect if output is a tty.\n\n"
#define help_ln "usage: ln [-sfnv] [FROM...] TO\n\nCreate a link between FROM and TO.\nWith only one argument, create link in current directory.\n\n-s Create a symbolic link\n-f Force the creation of the link, even if TO already exists\n-n Symlink at destination treated as file\n-v Verbose\n\n"
#define help_dirname "usage: dirname PATH\n\nShow directory portion of path.\n\n"
-#define help_df "usage: df [-t type] [FILESYSTEM ...]\n\nThe \"disk free\" command shows total/used/available disk space for\neach filesystem listed on the command line, or all currently mounted\nfilesystems.\n\n-P The SUSv3 \"Pedantic\" option\n-k Sets units back to 1024 bytes (the default without -P)\n-t type Display only filesystems of this type.\n\nPedantic provides a slightly less useful output format dictated by Posix,\nand sets the units to 512 bytes instead of the default 1024 bytes.\n\n"
+#define help_df "usage: df [-HPkh] [-t type] [FILESYSTEM ...]\n\nThe \"disk free\" command shows total/used/available disk space for\neach filesystem listed on the command line, or all currently mounted\nfilesystems.\n\n-P The SUSv3 \"Pedantic\" option\n-k Sets units back to 1024 bytes (the default without -P)\n-h Human readable output (K=1024)\n-H Human readable output (k=1000)\n-t type Display only filesystems of this type.\n\nPedantic provides a slightly less useful output format dictated by Posix,\nand sets the units to 512 bytes instead of the default 1024 bytes.\n\n"
#define help_date "usage: date [-u] [-r FILE] [-d DATE] [+DISPLAY_FORMAT] [-D SET_FORMAT] [SET]\n\nSet/get the current date/time. With no SET shows the current date.\n\nDefault SET format is \"MMDDhhmm[[CC]YY][.ss]\", that's (2 digits each)\nmonth, day, hour (0-23), and minute. Optionally century, year, and second.\nAlso accepts \"@UNIXTIME[.FRACTION]\" as seconds since midnight Jan 1 1970.\n\n-d Show DATE instead of current time (convert date format)\n-D +FORMAT for SET or -d (instead of MMDDhhmm[[CC]YY][.ss])\n-r Use modification time of FILE instead of current date\n-u Use UTC instead of current timezone\n\n+FORMAT specifies display format string using these escapes:\n\n%% literal % %n newline %t tab\n%S seconds (00-60) %M minute (00-59) %m month (01-12)\n%H hour (0-23) %I hour (01-12) %p AM/PM\n%y short year (00-99) %Y year %C century\n%a short weekday name %A weekday name %u day of week (1-7, 1=mon)\n%b short month name %B month name %Z timezone name\n%j day of year (001-366) %d day of month (01-31) %e day of month ( 1-31)\n\n%U Week of year (0-53 start sunday) %W Week of year (0-53 start monday)\n%V Week of year (1-53 start monday, week < 4 days not part of this year)\n\n%D = \"%m/%d/%y\" %r = \"%I : %M : %S %p\" %T = \"%H:%M:%S\" %h = \"%b\"\n%x locale date %X locale time %c locale date/time\n\n"
USE_DEALLOCVT(NEWTOY(deallocvt, ">1", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_NEEDROOT))
USE_GROUPDEL(OLDTOY(delgroup, groupdel, TOYFLAG_NEEDROOT|TOYFLAG_SBIN))
USE_USERDEL(OLDTOY(deluser, userdel, TOYFLAG_NEEDROOT|TOYFLAG_SBIN))
-USE_DF(NEWTOY(df, "Pkt*a[-Pk]", TOYFLAG_SBIN))
+USE_DF(NEWTOY(df, "HPkht*a[-HPkh]", TOYFLAG_SBIN))
USE_DHCP(NEWTOY(dhcp, "V:H:F:x*r:O*A#<0T#<0t#<0s:p:i:SBRCaovqnbf", TOYFLAG_SBIN|TOYFLAG_ROOTONLY))
USE_DHCPD(NEWTOY(dhcpd, ">1P#<0>65535=67fi:S46[!46]", TOYFLAG_SBIN|TOYFLAG_ROOTONLY))
USE_DIFF(NEWTOY(diff, "<2>2B(ignore-blank-lines)d(minimal)b(ignore-space-change)ut(expand-tabs)w(ignore-all-space)i(ignore-case)T(initial-tab)s(report-identical-files)q(brief)a(text)L(label)*S(starting-file):N(new-file)r(recursive)U(unified)#<0=3", TOYFLAG_USR|TOYFLAG_BIN))
USE_LOGIN(NEWTOY(login, ">1f:ph:", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
USE_LOGNAME(NEWTOY(logname, ">0", TOYFLAG_USR|TOYFLAG_BIN))
USE_LOSETUP(NEWTOY(losetup, ">2S(sizelimit)#s(show)ro#j:fdca[!afj]", TOYFLAG_SBIN))
-USE_LS(NEWTOY(ls, USE_LS_COLOR("(color):;")"ZgoACFHLRSacdfiklmnpqrstux1[-Cxm1][-Cxml][-Cxmo][-Cxmg][-cu][-ftS][-HL]", TOYFLAG_BIN|TOYFLAG_LOCALE))
+USE_LS(NEWTOY(ls, USE_LS_COLOR("(color):;")"ZgoACFHLRSacdfhiklmnpqrstux1[-Cxm1][-Cxml][-Cxmo][-Cxmg][-cu][-ftS][-HL]", TOYFLAG_BIN|TOYFLAG_LOCALE))
USE_LSATTR(NEWTOY(lsattr, "vldaR", TOYFLAG_BIN))
USE_LSMOD(NEWTOY(lsmod, NULL, TOYFLAG_SBIN))
+USE_LSOF(NEWTOY(lsof, "lp:t", TOYFLAG_USR|TOYFLAG_BIN))
USE_LSPCI(NEWTOY(lspci, "emkn"USE_LSPCI_TEXT("@i:"), TOYFLAG_USR|TOYFLAG_BIN))
USE_LSUSB(NEWTOY(lsusb, NULL, TOYFLAG_USR|TOYFLAG_BIN))
USE_MAKEDEVS(NEWTOY(makedevs, "<1>1d:", TOYFLAG_USR|TOYFLAG_BIN))