process

setuid on an executable doesn't seem to work

≯℡__Kan透↙ 提交于 2020-05-27 04:00:06
问题 I wrote a small C utility called killSPR to kill the following processes on my RHEL box. The idea is for anyone who logs into this linux box to be able to use this utility to kill the below mentioned processes (which doesn't work - explained below). cadmn@rhel /tmp > ps -eaf | grep -v grep | grep " SPR " cadmn 5822 5821 99 17:19 ? 00:33:13 SPR 4 cadmn cadmn 10466 10465 99 17:25 ? 00:26:34 SPR 4 cadmn cadmn 13431 13430 99 17:32 ? 00:19:55 SPR 4 cadmn cadmn 17320 17319 99 17:39 ? 00:13:04 SPR 4

fork() in a For Loop

纵然是瞬间 提交于 2020-05-17 05:55:05
问题 #include <stdio.h> #include <sys/type.h> #include <unistd.h> #include <stdlib.h> #include <errno.h> int main(void) { pid_t pid; int i; for(i=0; i<3; i++) { pid = fork(); if(pid == -1) { printf("Fork Error.\n"); } else if(pid == 0) { printf("I am child"); } } if(pid != 0) { while((pid = waitpid(-1, NULL, 0)) > 0) if(errno == ECHILD) break; printf("I am parent and all children have exited.\n"); } exit(0); return 0; } The result is that, 'I am child' is printed 7 times, 'I am parent and all

Multiple CMD commands C#

左心房为你撑大大i 提交于 2020-05-16 07:36:07
问题 Currently I am programming a program which controls the CMD. The problem is that with my code I can run a single command and then the CMD closes. But I need to fill in follow-up commands (like filling in passwords). My current code is: cmdProcess.StartInfo.FileName = "cmd.exe"; cmdProcess.StartInfo.CreateNoWindow = false; cmdProcess.StartInfo.RedirectStandardInput = true; cmdProcess.StartInfo.RedirectStandardOutput = true; cmdProcess.StartInfo.UseShellExecute = false; cmdProcess.Start();

Multiple CMD commands C#

给你一囗甜甜゛ 提交于 2020-05-16 07:36:07
问题 Currently I am programming a program which controls the CMD. The problem is that with my code I can run a single command and then the CMD closes. But I need to fill in follow-up commands (like filling in passwords). My current code is: cmdProcess.StartInfo.FileName = "cmd.exe"; cmdProcess.StartInfo.CreateNoWindow = false; cmdProcess.StartInfo.RedirectStandardInput = true; cmdProcess.StartInfo.RedirectStandardOutput = true; cmdProcess.StartInfo.UseShellExecute = false; cmdProcess.Start();

How to send multiple files to the printer with one Process call

孤人 提交于 2020-05-15 06:27:06
问题 I need to print multiple PDF-files from the hard-drive. I have found this beautiful solution of how to send a file to the printer. The problem with this solution is that if you want to print multiple files you have to wait for each file for the process to finish. in the command shell it is possible to use the same command with multiple filenames: print /D:printerName file1.pdf file2.pdf and one call would print them all. unfortunately simply just to put all the filenames into the

Python Multiprocessing on List of dictionaries

*爱你&永不变心* 提交于 2020-05-15 02:57:07
问题 I have a list of dictionaries. list_of_dict = [{'name' : 'bob', 'weight': 50}, {'name' : 'ramesh', 'weight': 60}] I want to process both the dictionaries at the same time What should I use for this multiprocessing Pool or Process ? 回答1: I have tried with Multiprocessing Pool from multiprocessing.pool import ThreadPool as Pool pool_size = 5 def worker(item1, itme2): try: print(item1.get('weight')) print(itme2) except: print('error with item') pool = Pool(pool_size) items = [{'name' : 'bob',

How to get the list of running processes including full file path?

北城以北 提交于 2020-05-13 13:34:11
问题 I use the JCL function JclSysInfo.RunningProcessesList to get the list of running processes. However, many of the returned processes consist only of the exe file names, while others contain the whole file path, for example: dopus.exe C:\Program Files\Listary\Listary.exe C:\Program Files (x86)\Direct Folders\df.exe Everything.exe etc... The code: uses ..., JclSysInfo; procedure GetRunningProcesses; var RunningProcesses: TStringList; begin RunningProcesses := TStringList.Create; try if

Kill processes run by specified user in powershell

拜拜、爱过 提交于 2020-05-11 17:34:10
问题 Just wondering how can I kill all processes with the same name running by a specified user. For example, I could have multiple program.exe running by different users. I could use: get-process program.exe | kill to kill all of them. But I just want to kill those instances run by a specified user. Is there a convenient way to do that? 回答1: TASKKILL.EXE /FI "USERNAME eq walid" /IM myprog.exe You can also use wildcards: TASKKILL.EXE /FI "USERNAME eq w*" /IM m* For more details type: taskkill.exe

Kill processes run by specified user in powershell

眉间皱痕 提交于 2020-05-11 17:33:31
问题 Just wondering how can I kill all processes with the same name running by a specified user. For example, I could have multiple program.exe running by different users. I could use: get-process program.exe | kill to kill all of them. But I just want to kill those instances run by a specified user. Is there a convenient way to do that? 回答1: TASKKILL.EXE /FI "USERNAME eq walid" /IM myprog.exe You can also use wildcards: TASKKILL.EXE /FI "USERNAME eq w*" /IM m* For more details type: taskkill.exe

What is kthreadd process and children and how it is different from init and children

為{幸葍}努か 提交于 2020-05-09 19:01:08
问题 I wanted to know what is kthread and why it does not take any memory and has no open files. I wrote some code which will simply print the PID of the currently running processes in a parent child tree format along with some additional information like used VMZ, RSS, threads, openfiles. All the children of the PID 2 named kthreadd did not have the VmSize and VmRSS in the /proc/[pid]/status file. the /proc/[pid]/fd did not contain any open files. What are these processes, how they are different