pipe

使用Windbg和VMware来搭建调试内核的环境

泄露秘密 提交于 2020-01-24 09:58:38
现象:虚拟机内还原系统镜像后蓝屏。通过调试查看蓝屏码为7B蓝屏,是由于磁盘类型选用SCSI导致了蓝屏无法正常开机,应改用IDE类型。 原理:VMware在虚拟机OS虚拟一个COM口,并在HostOS创建了一个管道,这个管道的一端连接虚拟机OS的COM口,另一端则是Windbg,所以HostOS(Windbg)和虚拟机OS的所有数据交换都是通过这个管道来流通转发的。 过程: 1、安装好Windbg   2、创建一个Windbg的快捷方式,在“目标”一栏后面加上:-b -k com:pipe,port=\\.\pipe\com_1,resets=0    3、右键此电脑—属性—高级系统设置—环境变量,新建一个环境变量_NT_SYMBOL_PATH 值为: SRV*d:\mysymbol* http://msdl.microsoft.com/download/symbols    4、添加一个串行端口(需先关闭虚拟机OS)      输出到命名管道 \\.\pipe\com_1    5、在虚拟机OS的boot.ini(映射到磁盘中寻找该文件)里填入如下内容:multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional Debug" /fastdetect /debugport=com1

How to pass a dataframe column as an argument in a function using piping?

♀尐吖头ヾ 提交于 2020-01-24 09:28:38
问题 I'm messing around with the built-in dataset economics in R, and I'm trying to pass a dataframe column as an argument in a function that uses piping (dplyr, %>% ). But I'm experiencing some seemingly strange problems. Somehow I can't successfully pass a column name as an argument to the function top_n() within my custom function. Here's how I would subset the 5 countries with the biggest population without a custom functon: Code 1: library(dplyr) df_econ <- economics df_top_5 <- df_econ %>%

How to separate fields with pipe character delimiter

社会主义新天地 提交于 2020-01-24 04:13:05
问题 I know this question has already been asked but no of the solution I've found worked for me! I have a program that has an output like this: COUNT|293|1|lps I'm interested in having the second field however no one of these tries worked: ./spawn 1 | cut -d '|' -f2 ./spawn 1 | cut -d \| -f2 ./spawn 1 | awk -F "|" '{print $2}' ./spawn 1 | awk 'BEGIN{FS="|"} {print $2}' ./spawn 1 | sed 's/|/;/g' ./spawn 1 | sed 's/\|/;/g' But the output is always the same: COUNT|293|1|lps Is there a bug somewhere

C Fork and Pipe closing ends

孤街浪徒 提交于 2020-01-24 00:22:31
问题 I am building an application that requires two way communication with a few child processes. My parent is like a query engine constantly reading words from stdin and passes it to each child process. The child processes perform their processing and writes back to the parent on their exclusive pipes. This is theoretically how it should work however I am stuck on the implementation details. The first issue is do I create 2 pipes before forking the child? When I fork, I know the child is going to

Declaring char array causes execv() to not work

╄→尐↘猪︶ㄣ 提交于 2020-01-22 02:41:20
问题 I wrote the following code in order to use pipes in c unix: #include <stdio.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <string.h> int main () { int fds[2]; pid_t pid; /* Create a pipe. File descriptors for the two ends of the pipe are placed in fds. */ pipe (fds); /* Fork a child process. */ pid = fork (); if (pid == (pid_t) 0) { //char abc[10]; - **Uncommenting this cause the program not to work.** /* This is the child process. Close our copy of the write

execlp multiple “programs”

眉间皱痕 提交于 2020-01-21 15:05:46
问题 I want to run something like cat file.tar | base64 | myprogram -c "| base64 -d | tar -zvt " I use execlp to run the process. When i try to run something like cat it works, but if i try to run base64 -d | tar -zvt it doesn't work. I looked at the bash commands and I found out that I can run bash and tell him to run other programs. So it's something like: execlp ("bash", "-c", "base64 -d | tar -zvt", NULL); If I run it on the terminal, it works well, but using the execlp it dont work. If I use

Why does ffmpeg stop randomly in the middle of a process?

本秂侑毒 提交于 2020-01-21 14:38:38
问题 ffmpeg feels like its taking a long time. I then look at my output file and i see it stops between 6 and 8mbs. A fully encoded file is about 14mb. Why does ffmpeg stop? My code locks up on StandardOutput.ReadToEnd();. I had to kill the process (after seeing it not move for more then 10 seconds when i see it update every second previously) then i get the results of stdout and err. stdout is "" stderr is below. The output msg shows the filesize ended. I also see a drop in my CPU usage when it

How to sort 'find' results in bash by size

南笙酒味 提交于 2020-01-21 12:24:27
问题 I am wondering if there's an "easy" way (through a pipe or something) to order (by file size) the results of a "find" command in bash such as: find /location/of/directory/ -type f -size +2G 回答1: You can use %k for example to print the size in kilobytes: find . -type f -size +2G -printf "%kKB %p\n" | sort -n By saying -printf "%kKB %p\n" you are printing the file in kilobytes and then the name. sort -n gets this input and sorts it accordingly. See an example: $ find . -type f -size +1M -printf

Linux: Pipe into Python (ncurses) script, stdin and termios

送分小仙女□ 提交于 2020-01-21 05:01:09
问题 Apparently this is almost a duplicate of "Bad pipe filedescriptor when reading from stdin in python - Stack Overflow"; however, I believe this case is slightly more complicated ( and it is not Windows specific, as the conclusion of that thread was ). I'm currently trying to experiment with a simple script in Python: I'd like to supply input to the script - either through command line arguments; or by 'pipe'-ing a string to this script - and have the script show this input string using a

How can I get the output of a Python subprocess command that contains a pipe?

别说谁变了你拦得住时间么 提交于 2020-01-20 08:55:15
问题 I have: cmd_array = ['head', '-n', str(source_noise_end), "data/noise/" + source + '_16k.dat', '|', 'tail', '-' + str(source_noise_start)] source_noise = subprocess.check_output(cmd_array) The command is valid when I type it into Linux. I get subprocess.CalledProcessError: Command '['head', '-n', '2366468', 'data/noise/white_16k.dat', '|', 'tail', '-2183988']' returned non-zero exit status 1. What am I doing wrong? 回答1: Try with this : import subprocess # cmd contains shell command cmd="your