Hi, I''m tried to used use the freopen() feature to forward the output from dtrace to a file, but I''m getting the following error: ------------------------------------------------------------------------------- dtrace: could not enable tracing: Destructive actions not allowed -------------------------------------------------------------------------------- and the code I have is: syscall::read:return { freopen("testFile"); printf(" exename: %s\n", execname); } Thanks in advance for any help. This message posted from opensolaris.org
dtrace -h will tell you that -w will allow destructive actions. beware all the caveats that go with allowing destructive actions. :) I''ll make no comment on what the ''correct'' way to do any of this. I''ll leave this to the others on the list. :) Nathan. jack wrote:> Hi, > > I''m tried to used use the freopen() feature to forward the output from dtrace to a file, but I''m getting the following error: > > ------------------------------------------------------------------------------- > dtrace: could not enable tracing: Destructive actions not allowed > -------------------------------------------------------------------------------- > and the code I have is: > > > syscall::read:return > { > freopen("testFile"); > printf(" exename: %s\n", execname); > } > > Thanks in advance for any help. > > > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org
On Mon, Mar 05, 2007 at 03:11:04PM -0800, jack wrote:> Hi, > > I''m tried to used use the freopen() feature to forward the output from dtrace to a file, but I''m getting the following error: > > ------------------------------------------------------------------------------- > dtrace: could not enable tracing: Destructive actions not allowed > -------------------------------------------------------------------------------- > and the code I have is: > > > syscall::read:return > { > freopen("testFile"); > printf(" exename: %s\n", execname); > } > > Thanks in advance for any help.You''re getting this message because freopen() is a destructive action, and destructive actions are not allowed unless they have been explicitly enabled with either "-w" or "#pragma D option destructive" (or "-x destructive"). (And amusingly, googling only "destructive actions" gets you the chapter in the DTrace documentation that addresses this.) - Bryan -------------------------------------------------------------------------- Bryan Cantrill, Solaris Kernel Development. http://blogs.sun.com/bmc
On 3/6/07, Bryan Cantrill <bmc at eng.sun.com> wrote:> You''re getting this message because freopen() is a destructive action, and > destructive actions are not allowed unless they have been explicitly > enabled with either "-w" or "#pragma D option destructive" (or "-x > destructive"). (And amusingly, googling only "destructive actions" gets > you the chapter in the DTrace documentation that addresses this.)At the risk of being stoned, why is freopen() classified as destructive? -- Just me, Wire ...
On Tue, Mar 13, 2007 at 01:38:35PM +0800, Wee Yeh Tan wrote:> At the risk of being stoned, why is freopen() classified as destructive?The rule is that anything could cause harm is classified as destructive. Unintentional use of freopen() could cause you to mangle random files on your system just as the system() action could cause harm if misused. Adam -- Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl
On 3/14/07, Adam Leventhal <ahl at eng.sun.com> wrote:> The rule is that anything could cause harm is classified as destructive. > Unintentional use of freopen() could cause you to mangle random files > on your system just as the system() action could cause harm if misused.Got it. Thanks for clarifying. -- Just me, Wire ...