Brendan Gregg
2005-Jul-02 18:54 UTC
[dtrace-discuss] clearing element from array of struct
G''Day Folks,
This question should be a quickie - what''s the syntax to delete an
element
from an array of struct? (I''m being good and using structs now). eg,
struct ioinfo {
int uid;
int pid;
int ppid;
string args;
string comm;
uint64_t time;
char rw;
};
struct ioinfo start[uint64_t, uint64_t];
now if I try to zero an entry later on with,
start[this->dev, this->blk] = 0;
I get,
in action list: operands have incompatible types: "struct ioinfo" =
"int"
would zero''ing out each element one by one free memory like one would
hope, or have I just missed the right syntax? (I may have missed the
syntax - it''s almost 5am :).
thanks,
Brendan
Michael Shapiro
2005-Jul-02 23:05 UTC
[dtrace-discuss] clearing element from array of struct
> G''Day Folks, > > This question should be a quickie - what''s the syntax to delete an element > from an array of struct? (I''m being good and using structs now). eg, > > struct ioinfo { > int uid; > int pid; > int ppid; > string args; > string comm; > uint64_t time; > char rw; > }; > > struct ioinfo start[uint64_t, uint64_t]; > > now if I try to zero an entry later on with, > > start[this->dev, this->blk] = 0; > > I get, > > in action list: operands have incompatible types: "struct ioinfo" = "int" > > would zero''ing out each element one by one free memory like one would > hope, or have I just missed the right syntax? (I may have missed the > syntax - it''s almost 5am :). > > thanks, > > BrendanWe don''t have one yet -- this is on my list of things to fix in the near future. It will either be assignment to zero or an undef() function. -Mike -- Mike Shapiro, Solaris Kernel Development. blogs.sun.com/mws/
Brendan Gregg
2005-Jul-03 12:59 UTC
[dtrace-discuss] clearing element from array of struct
G''Day Mike, On Sat, 2 Jul 2005, Michael Shapiro wrote: [...]> > start[this->dev, this->blk] = 0; > > > > I get, > > > > in action list: operands have incompatible types: "struct ioinfo" = "int" > > > > would zero''ing out each element one by one free memory like one would > > hope, or have I just missed the right syntax? (I may have missed the > > syntax - it''s almost 5am :). > > > > thanks, > > > > Brendan > > We don''t have one yet -- this is on my list of things to fix in the > near future. It will either be assignment to zero or an undef() function.Ahh - thanks! I didn''t miss something silly :) Brendan