Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jun 2007 00:34:26 +0800
From:      "Howard Su" <howard0su@gmail.com>
To:        current@freebsd.org
Subject:   concept prove patch for ktrace output to all file types
Message-ID:  <f126fae00706270934h3e39e33avaa686aa2c12b72c6@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
------=_Part_19119_25214203.1182962066882
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

This is a concept prove patch for ktrace. In order to make ktrace write to
stdout, /dev/xxx, fifo file, pipe, I changed ktrace syscall to accepting a
file handler instead of a file name.

I just get a workable kernel patch. And i make as small as possible changes
to userland code. Now you can do something like:
#mkfifo foo
in session A: #kdump -f foo
in session B: #ktrace -f foo ls

Then, you can see a real time output like truss did.

Before moving forward (hacking userland), i want to get some feedback if my
changes in kernel part is the right direction to do. Appreciate your time.

PS: The patch can be clearly apply to today's current.

-- 
-Howard

------=_Part_19119_25214203.1182962066882
Content-Type: text/plain; name=ktrace.patch; charset=ANSI_X3.4-1968
Content-Transfer-Encoding: base64
X-Attachment-Id: f_f3g0wgy8
Content-Disposition: attachment; filename="ktrace.patch"

LS0tICBzeXMva2Vybi9rZXJuX2V4ZWMuYy5vcmlnCisrKyAgc3lzL2tlcm4va2Vybl9leGVjLmMK
QEAgLTI5MCw3ICsyOTAsNyBAQAogCXN0cnVjdCBwYXJncyAqb2xkYXJncyA9IE5VTEwsICpuZXdh
cmdzID0gTlVMTDsKIAlzdHJ1Y3Qgc2lnYWN0cyAqb2xkc2lnYWN0cywgKm5ld3NpZ2FjdHM7CiAj
aWZkZWYgS1RSQUNFCi0Jc3RydWN0IHZub2RlICp0cmFjZXZwID0gTlVMTDsKKwlzdHJ1Y3QgZmls
ZSAqdHJhY2VmcCA9IE5VTEw7CiAJc3RydWN0IHVjcmVkICp0cmFjZWNyZWQgPSBOVUxMOwogI2Vu
ZGlmCiAJc3RydWN0IHZub2RlICp0ZXh0dnAgPSBOVUx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
cnBvaW50cywgcGlkKSA8IDApCiAJCWVycigxLCAiJXMiLCB0cmFjZWZpbGUpOworCWNsb3NlKGZk
KTsKIAlleGl0KDApOwogfQogCg==
------=_Part_19119_25214203.1182962066882--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f126fae00706270934h3e39e33avaa686aa2c12b72c6>