Where is the exact code part of the walletnotify function?
I don't know exactly what you are asking, but

wallet.cpp (from line 591)

    // notify an external script when a wallet transaction comes in or is updated
    std::string strCmd = GetArg("-walletnotify", "");

    if ( !strCmd.empty())
    {
        boost::replace_all(strCmd, "%s", wtxIn.GetHash().GetHex());
        boost::thread t(runCommand, strCmd); // thread runs free
    }


runs a thread that executes the runCommand() function in util.cpp

wallet.cpp (from line 1335)

void runCommand(std::string strCommand)
{
    int nErr = ::system(strCommand.c_str());
    if (nErr)
        LogPrintf("runCommand error: system(%s) returned %d\n", strCommand, nErr);
}


and I think that is all code you need.