Hi, I''m tring to get path when a user type "mkdir ...." syscall::mkdir:entry { printf("path: %s exename: %s\n", fds[arg0].fi_pathname, execname); } but the problem is that fds[arg0].fi_path name is alway null, please help. Thanks This message posted from opensolaris.org
jack wrote:> Hi, > > I''m tring to get path when a user type "mkdir ...." > > syscall::mkdir:entry > { > printf("path: %s exename: %s\n", fds[arg0].fi_pathname, execname); > } > > but the problem is that fds[arg0].fi_path name is alway null, please help. > > Thanks >Try: printf("\npath: %s exename: %s\n", copyinstr(arg0), execname); arg0 IS the pathname. The fds[] array is index with a file descriptor, which in not used in the mkdir system call. Jim
Yeah, copyinstr(argo0) works, but it only give the name for the new directory. How do I print out the whole path for the new created directory? Thanks. This message posted from opensolaris.org
You may want to just prepend the built-in variable cwd - current working directory to copyinstr(arg0). -Angelo On 6 Feb 2007, at 14:12, jack wrote:> Yeah, copyinstr(argo0) works, but it only give the name for the new > directory. > How do I print out the whole path for the new created directory? > Thanks. > > > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org
Jack, The following will handle pre-pending the cwd, if the arg to mkdir is a relative path: syscall::mkdir:entry { self->dirp = arg0; } syscall::mkdir:return / self->dirp / { self->back = copyinstr(self->dirp); self->front = substr(self->back,0,1) == "/" ? "" : strjoin(cwd,"/"); printf("%s%s", self->front, self->back); self->front = 0; self->back = 0; self->dirp = 0; } Of course, if you need to reject invalid arguments to mkdir, that''s more code yet. Chip Angelo Rajadurai wrote:> You may want to just prepend the built-in variable cwd - current > working directory to copyinstr(arg0). > > > -Angelo > > On 6 Feb 2007, at 14:12, jack wrote: > >> Yeah, copyinstr(argo0) works, but it only give the name for the new >> directory. >> How do I print out the whole path for the new created directory? Thanks. >> >> >> This message posted from opensolaris.org >> _______________________________________________ >> dtrace-discuss mailing list >> dtrace-discuss at opensolaris.org > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org