void kernelmain(LoaderInfo *info) { asm("mov $0x10, %ax"); // fix 64bit selectors asm("mov %ax, %ds"); asm("mov %ax, %es"); asm("mov %ax, %fs"); asm("mov %ax, %gs"); asm("mov %ax, %ss"); asm("mov $0x90000, %rsp"); // temporary stack setupTTY(info); // first, so that we can output text to screen et.c kprintf(" %s ", _kernelName); kprintf(_kernelVersionFormat, _kernelVersionMajor, _kernelVersionMinor, _kernelVersionPatch, KERNEL_GIT_VERSION); kprintf(" %s %s", _kernelBuildDate, _kernelBuildTime); kprintf("\n\nScreen mode %dx%d @ %d bits per pixel; %d bytes per row.\n\n", info->vesaPixelWidth, info->vesaPixelHeight, info->vesaPixelDepth, info->vesaBytesPerRow); // setupPaging(info); setupE820(info); setupInterrupts(); dev_hook_run(); asm("jmp .;"); }
/* * Fork and execute the command. This returns in the parent. */ int PtyProcess::exec(const QByteArray &command, const QList<QByteArray> &args) { int i; if (init() < 0) { return -1; } if ((m_pid = fork()) == -1) { qCritical() << "[" << __FILE__ << ":" << __LINE__ << "] " << "fork():" << strerror(errno); return -1; } // Parent if (m_pid) { d->pty->closeSlave(); return 0; } // Child if (setupTTY() < 0) { _exit(1); } for (i = 0; i < d->env.count(); ++i) { putenv(const_cast<char *>(d->env.at(i).constData())); } unsetenv("KDE_FULL_SESSION"); // for : Qt: Session management error unsetenv("SESSION_MANAGER"); // QMutex::lock , deadlocks without that. // <thiago> you cannot connect to the user's session bus from another UID unsetenv("DBUS_SESSION_BUS_ADDRESS"); // set temporarily LC_ALL to C, for su (to be able to parse "Password:"******"LC_ALL"); if (!old_lc_all.isEmpty()) { qputenv("KDESU_LC_ALL", old_lc_all); } else { unsetenv("KDESU_LC_ALL"); } qputenv("LC_ALL", "C"); // From now on, terminal output goes through the tty. QByteArray path; if (command.contains('/')) { path = command; } else { QString file = QStandardPaths::findExecutable(QFile::decodeName(command)); if (file.isEmpty()) { qCritical() << "[" << __FILE__ << ":" << __LINE__ << "] " << command << "not found."; _exit(1); } path = QFile::encodeName(file); } const char **argp = (const char **)malloc((args.count() + 2) * sizeof(char *)); i = 0; argp[i++] = path.constData(); for (QList<QByteArray>::ConstIterator it = args.begin(); it != args.end(); ++it, ++i) { argp[i] = (*it).constData(); } argp[i] = NULL; execv(path.constData(), const_cast<char **>(argp)); qCritical() << "[" << __FILE__ << ":" << __LINE__ << "] " << "execv(" << path << "):" << strerror(errno); _exit(1); return -1; // Shut up compiler. Never reached. }
int PtyProcess::exec(const QByteArray &command, const QList<QByteArray> &args) { kDebug(kdesuDebugArea()) << k_lineinfo << "Running" << command; int i; if (init() < 0) return -1; if ((m_Pid = fork()) == -1) { kError(kdesuDebugArea()) << k_lineinfo << "fork():" << perror; return -1; } // Parent if (m_Pid) { d->m_pPTY->closeSlave(); return 0; } // Child if (setupTTY() < 0) _exit(1); for (i = 0; i < d->env.count(); ++i) { putenv(const_cast<char *>(d->env.at(i).constData())); } unsetenv("KDE_FULL_SESSION"); // for : Qt: Session management error unsetenv("SESSION_MANAGER"); // QMutex::lock , deadlocks without that. // <thiago> you cannot connect to the user's session bus from another UID unsetenv("DBUS_SESSION_BUS_ADDRESS"); // set temporarily LC_ALL to C, for su (to be able to parse "Password:"******"LC_ALL" ); if( !old_lc_all.isEmpty() ) qputenv( "KDESU_LC_ALL", old_lc_all ); else unsetenv( "KDESU_LC_ALL" ); qputenv("LC_ALL", "C"); // From now on, terminal output goes through the tty. QByteArray path; if (command.contains('/')) path = command; else { QString file = KStandardDirs::findExe(command); if (file.isEmpty()) { kError(kdesuDebugArea()) << k_lineinfo << command << "not found."; _exit(1); } path = QFile::encodeName(file); } const char **argp = (const char **)malloc((args.count()+2)*sizeof(char *)); i = 0; argp[i++] = path; for (QList<QByteArray>::ConstIterator it=args.begin(); it!=args.end(); ++it, ++i) argp[i] = *it; argp[i] = NULL; execv(path, const_cast<char **>(argp)); kError(kdesuDebugArea()) << k_lineinfo << "execv(" << path << "):" << perror; _exit(1); return -1; // Shut up compiler. Never reached. }