c

cmd- comma to separate parameters Compared to space?

我是研究僧i 提交于 2021-02-18 22:41:49
问题 I have some questions on the subject, of commas compared to space, in delimiting parameters. They are questions that C programmers familiar with the cmd prompt, may be able to throw some light on.. I know that when doing c:\>program a b c there are 4 parameters [0]=program [1]=a [2]=b [3]=c According to hh ntcmds.chm concepts.. Shell overview ; and , are used to separate parameters ; or , command1 parameter1;parameter2 Use to separate command parameters. I see dir a,b gives the same result as

cmd- comma to separate parameters Compared to space?

眉间皱痕 提交于 2021-02-18 22:41:13
问题 I have some questions on the subject, of commas compared to space, in delimiting parameters. They are questions that C programmers familiar with the cmd prompt, may be able to throw some light on.. I know that when doing c:\>program a b c there are 4 parameters [0]=program [1]=a [2]=b [3]=c According to hh ntcmds.chm concepts.. Shell overview ; and , are used to separate parameters ; or , command1 parameter1;parameter2 Use to separate command parameters. I see dir a,b gives the same result as

How does “get_user_pages” work (For linux driver)

落爺英雄遲暮 提交于 2021-02-18 22:37:28
问题 Working on a Linux PCI driver, now I'm trying to write codes for DMA using scatter/gather. For now, I've learned that to access to DMA datas directly from User space, we need to pin user space pages to kernel space. And to do this, we have get_user_pages , its full definition is like: int get_user_pages(struct task_struct * tsk, struct mm_struct * mm, unsigned long start, int nr_pages, int write, int force, struct page ** pages, struct vm_area_struct ** vmas); My first question is about the

How does backtracking affect the language recognized by a parser?

≯℡__Kan透↙ 提交于 2021-02-18 22:26:49
问题 Not a school related question, but it comes up in the Dragon Book (Compilers: Principles, Techniques, and Tools) in an exercise: The grammar: S ::= aSa | aa generates all even length strings of a's except for the empty string. a) Construct a recursive-descent parser with backtracking for this grammar that tries the alternative aSa before aa. Show that the procedure for S succeeds on 2, 4, or 8 a's, but fails on 6 a's. b) What language does your parser recognize? I'm stumped. It seems like if

How does backtracking affect the language recognized by a parser?

[亡魂溺海] 提交于 2021-02-18 22:26:07
问题 Not a school related question, but it comes up in the Dragon Book (Compilers: Principles, Techniques, and Tools) in an exercise: The grammar: S ::= aSa | aa generates all even length strings of a's except for the empty string. a) Construct a recursive-descent parser with backtracking for this grammar that tries the alternative aSa before aa. Show that the procedure for S succeeds on 2, 4, or 8 a's, but fails on 6 a's. b) What language does your parser recognize? I'm stumped. It seems like if

gcc canaries : undefined reference to __stack_chk_guard

巧了我就是萌 提交于 2021-02-18 22:16:52
问题 I'm trying to enable gcc' s canaries' generation but I get an undefined reference to __stack_chk_guard. From gcc's man about canaries : -mstack-protector-guard=guard Generate stack protection code using canary at guard. Supported locations are global for global canary or tls for per-thread canary in the TLS block (the default). This option has effect only when -fstack-protector or -fstack-protector-all is specified. These -m switches are supported in addition to the above on x86-64 processors

UL suffix vs uint32_t cast

时光毁灭记忆、已成空白 提交于 2021-02-18 22:13:13
问题 I have to define constants like this : #define MY_CONSTANT 0xBEEF I want to be sure that my constant will be considered 32 bits. I have can use a (uint32_t) cast like this : #define MY_CONSTANT (uint32_t)0xBEEF Or a UL suffix like this : #define MY_CONSTANT 0xBEEFUL Are these two versions fully equivalent? I would say no, as UL is the equivalent of unsigned long and unsigned long length may depend on CPU. The C99 standard ensures that an uint32_t integer is 32 bits, but I don't think it

UL suffix vs uint32_t cast

六眼飞鱼酱① 提交于 2021-02-18 22:12:52
问题 I have to define constants like this : #define MY_CONSTANT 0xBEEF I want to be sure that my constant will be considered 32 bits. I have can use a (uint32_t) cast like this : #define MY_CONSTANT (uint32_t)0xBEEF Or a UL suffix like this : #define MY_CONSTANT 0xBEEFUL Are these two versions fully equivalent? I would say no, as UL is the equivalent of unsigned long and unsigned long length may depend on CPU. The C99 standard ensures that an uint32_t integer is 32 bits, but I don't think it

Avoiding page faults in IDT hooking

故事扮演 提交于 2021-02-18 22:12:37
问题 Note: I'm running on FreeBSD, but I've also included Linux as a tag since the problem is somewhat general and Linux-specific solutions are of interest to me. Edit : just to confirm that the issue was not FreeBSD specific, I ported the module to Linux, and indeed got the exact same behavior. The code for the Linux version of the module is given below; it is essentially exactly the same, the only major difference being that the IDT is evidently given read-only protection in Linux, and so I had

Why doesn't recv block until it receives all of the data?

寵の児 提交于 2021-02-18 22:10:03
问题 Why doesn't the recv system call just block until all the data is received? Every time I have seen a recv call, it's in a while loop which just keeps on calling recv until all the data is there. Why not just have recv block in the first place? 回答1: You can request that recv block until all data is received, with the MSG_WAITALL flag. However, if a signal arrives, a system call that has performed some work (ie, receiving part of the data) cannot be automatically restarted to receive the rest.