This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <unistd.h> | |
| #include <errno.h> | |
| #include <fcntl.h> | |
| #include <sys/types.h> | |
| #include <sys/stat.h> | |
| #include <sys/io.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdint.h> | |
| #include <unistd.h> | |
| #include <inttypes.h> | |
| #include <errno.h> | |
| #include <sys/ioctl.h> | |
| #include <sys/stat.h> | |
| #include <fcntl.h> | |
| #include <sys/utsname.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // weibo上有人说到https://github.com/joewalnes/websocketd,我想其原理大致如此(process-wrapper.c): | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <sys/types.h> | |
| #include <sys/stat.h> | |
| #include <fcntl.h> | |
| int wrap_process(const char* exefile) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <unistd.h> | |
| #include <stdint.h> | |
| #include <linux/fd.h> | |
| #include <sys/types.h> | |
| #include <sys/stat.h> | |
| #include <sys/ioctl.h> | |
| #include <fcntl.h> | |
| #define BLKSSZGET _IO(0x12,104)/* get block device sector size */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <linux/module.h> | |
| #include <linux/init.h> | |
| #include <linux/kthread.h> | |
| struct task_struct* ts; | |
| static int thread_func(void) | |
| { | |
| while (1) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| count_words: count_words.o lexer.o -lfl | |
| gcc count_words.o lexer.o -lfl -o count_words | |
| count_words.o: count_words.c | |
| gcc -c count_words.c | |
| lexer.o: lexer.c | |
| gcc -c lexer.c | |
| lexer.c: lexer.l |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main() { printf("Hello, World!\n"); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdlib.h> //getenv, atoi | |
| #include <stdio.h> //printf | |
| int main() { | |
| char* reps_text = getenv("reps"); | |
| int reps = reps_text ? atoi( reps_text ) : 10; | |
| char* msg = getenv( "msg" ); | |
| if (!msg) msg = "Hello."; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdlib.h> | |
| #include <stdio.h> | |
| int main( int argc, char **argv, char **envp ) { | |
| char **env; | |
| for( env = envp; *env; env++ ) | |
| printf( "%s\n", *env ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| extern char **environ; | |
| void main() | |
| { | |
| for (char **env = environ; *env; ++env) | |
| printf("%s\n", *env); | |
| } |