PTRAP(4) PTRAP(4) NAME ptrap - plumber(4) filter SYNOPSIS ptrap port [!]regexp [ +attr [!]regexp ... ] ... DESCRIPTION Ptrap is a program that mounts itself over a plumber(4) ser- vice mounted at /mnt/plumb and filters incoming messages according to the rules provided on the command line. Ptrap accepts an arbitrary number of filters; each filter applies to a port, and may match over both the data and attributes of plumb messages. A filter is formatted as a port name, a data filter, and a list of attribute filters. The data filter is a regex(6) that matches the plumbed data. The attribute filter consists of the attribute name prefixed with a '+', followed by a regex(6) that matches the contents of the attribute. Any regex may be prefixed with a '!' in order to negate a match, causing all matches for that regex to be discarded. All parts of a filter must match in order for a plumb message to be forwarded. EXAMPLES Start a sam(1) instance dedicated to editing kernel source code: ptrap edit '^/sys/src/9/' sam In another window, start a second sam(1) instance for all other editing jobs: ptrap edit '!^/sys/src/9/' sam Start an acme(1) instance instance dedicated to reading plumbed manual pages: ptrap edit '.*' +action '^showdata' +filename '^/man/' acme -c1 SOURCE /sys/src/cmd/ptrap.c SEE ALSO plumber(4), plumb(6) PTRAP(4) PTRAP(4) BUGS Multiple filters specified on the same port ignore all but the last one. Ptrap would be more useful if it could inhibit sending the message to other clients. As far as plumber(4) is concerned, even messages dropped by ptrap are "accepted", which means rules that are supposed to apply to messages not accepted by clients are not invoked (e.g. a rule starting an editor if no one is listening to the edit port will not work if there is a ptrap on that port). HISTORY Ptrap first appeared in 9front (February, 2018).