ptrace (process trace system call) on Linux from D

mta`chrono chrono at mta-international.net
Tue May 8 09:41:54 PDT 2012


Am 08.05.2012 18:12, schrieb Matej Nanut:
> On Monday, 7 May 2012 at 22:56:07 UTC, mta`chrono wrote:
>> What do you meant by "D alternatives to wait() and fork() that could be
>> used with ptrace()". Maybe I don't understand your intention.
> 
> Nevermind with that; I've been confused since there are exec*()
> functions in std.process, but no wait() and fork(). I think there's a
> new std.process in the works that has more D-ish ways to do these.
> 
> And thanks for the core.* VS std.c.* clarification. I didn't even think
> of using core.* all the way for libc bindings.

But consider that fork() is a very specific UNIX syscall. There is
nothing similar like that on Windows. That's maybe why they didn't wrap
it in Phobos.

Maybe the same applies to wait() that seems to rely on the UNIX signal
stuff. But there should be some kind of derivate on windows, too.

But neverthenless you are free to use every C-Funktion. You just need
some kind of definition to tell dmd to create the right symbols. If the
definition is already present in druntime, it's fine - just use it!
otherwise you have to define it yourself.

> 
> If struct method names are mangled, does that mean that that way of
> doing it doesn't work? I'll try it anyway, to try and get rid of a few
> extra files.

It shouldn't work. But you can add another custom ptrace method (_NOT_
extern(C)) with different operators.

If you can give more information of your superior intention (what are
you going to create?) then I'll might provide a better assistance!


More information about the Digitalmars-d-learn mailing list