linux
linux
hfyinsdu
烂笔头--好记性不如烂笔头
展开
-
linux aio & libaio
Find two excellent blog to introduce linux aio and libaio usage.https://github.com/littledan/linux-aiohttps://jin-yang.github.io/post/linux-program-aio.html原创 2020-08-05 17:56:54 · 95 阅读 · 0 评论 -
How to access physical addresses from user space in Linux?
see stackoverflow.Will need dig more to see the details.转载 2020-04-03 09:15:50 · 124 阅读 · 0 评论 -
thread: detached state
for detached state thread.原创 2020-04-03 07:57:15 · 268 阅读 · 0 评论 -
reentrant & thread safe with examples
Wiki says, In computing, a computer program or subroutine is called reentrant if multiple invocations can safely run concurrently. The concept applies even on a single processor system, where a reentr...原创 2020-03-29 17:31:45 · 94 阅读 · 0 评论 -
multithread: why main thread exit leads to other threads exit?
In linux multithread program, when main thread exit, other threads will exit too, why? How to keep other thread running when main thread exit?Consider following program, when main thread exit, new t...原创 2020-03-09 18:00:44 · 182 阅读 · 0 评论 -
fork() printf()
#include <stdio.h>#include <sys/types.h>#include <unistd.h> int main(void){ int i; for(i=0; i<2; i++){ fork(); printf("-"); } wait(NULL); wait(N...转载 2020-03-06 17:12:48 · 228 阅读 · 0 评论 -
find variale value in ELF file
copied from stackoverflow.First, you would use readelf to determine the virtual address of the variable (where it lives in memory after the program is loaded). -s will show you the symbol table, and...转载 2020-03-05 18:42:48 · 136 阅读 · 0 评论 -
add a new system call for x86
#define T_SYSCALL 64 // system call#define SYS_fork 1#define SYS_sleep 2#define SYSCALL(name) \ .globl name; \ name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; ...原创 2020-03-02 17:11:35 · 160 阅读 · 0 评论 -
ELF brief introduction
refer wiki: https://en.wikipedia.org/wiki/Executable_and_Linkable_Formathttps://pdos.csail.mit.edu/6.828/2018/labs/lab1/need refine when have time. The point is to notice the relationship between ...转载 2020-01-21 16:14:56 · 179 阅读 · 0 评论 -
linux read pipe
questionwhat will happen if comment out line 13? why?#include <stdio.h>#include <stdlib.h>#include <unistd.h>int main(){ int p[2]; pipe(p); write(p[1], "hello...原创 2020-01-16 16:14:00 · 470 阅读 · 0 评论 -
linux command
1. kill process by name using pkillhfyin@hfyin-VirtualBox:~/projects/c$ ps aux | grep wchfyin 18789 0.0 0.0 4372 72 pts/2 S 08:45 0:00 ./wchfyin 18799 0.0 0.0 4372 72 ...原创 2020-01-17 13:53:43 · 68 阅读 · 0 评论 -
ubuntu 64-bit: install 32-bit gcc lib
On 64-bit machines, you may need to install a 32-bit support library. The symptom is that linking fails with error messages like "__udivdi3 not found" and "__muldi3 not found". On Ubuntu Linux, try th...转载 2020-01-20 10:17:17 · 1062 阅读 · 0 评论