自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

奇峰小筑

留着,不懂过来翻翻

  • 博客(78)
  • 资源 (2)
  • 收藏
  • 关注

原创 [unix]两个互斥量保护共享变量自增,保证线程执行安全实例

#include "apue.h"#include #define NHASH 29#define HASH(id) (((unsigned long)id)%NHASH)struct foo *fh[NHASH];pthread_mutex_t hashlock = PTHREAD_MUTEX_INITIALIZER;struct foo { int

2018-01-12 17:58:08 292

原创 [unix]pthread_cleanup_push & pthread_cleanup_pop 实例

#include "apue.h"#include void cleanup(void *arg){ printf("cleanup: %s\n", (char *)arg);}void * thr_fn1(void *arg){ printf("thread 1 start\n"); pthread_cleanup_push(cleanup,(void *

2018-01-12 16:32:31 364

原创 [unix]线程返回值

#include "apue.h"#include struct foo { int a,b,c,d;};void printfoo(const char *s , const struct foo *fp){ printf("%s",s); printf(" structure at 0x%lx\n",(unsigned long)fp); prin

2018-01-11 17:43:48 270 1

原创 [unix]线程创建

#include "apue.h"#include pthread_t ntid;void printids(const char *s){ pid_t pid; pthread_t tid; pid = getpid(); /*这里用pthread_self函数获取当前线程id,而不是用pthread_create执行时候保存在全局变量ntid

2018-01-11 14:29:39 367

原创 [unix]system函数的一个实现

代码来源 unix环境高级编程 第三版 一书  这个system函数实现有缺陷  具体参详10.18节#include #include #include #include int system(const char *cmdstring){ pid_t pid; int status; struct sigaction ignore,saveintr,savequit; s

2017-12-31 11:57:28 865

转载 [unix]sigsuspend函数保护代码临界区 使其不被特定信号中断

#include #include /** * 1 保护代码临界区 使其不被特定信号中断 * 2 当sigsuspend返回时 它将信号屏蔽字设置为调用它之前当值 * SIGINT信号将被阻塞。因此将信号屏蔽恢复为之前保存当值oldmask * 3 在调用sigsuspend时 将SIGUSR1信号加到了进程号屏蔽字中, * 所以当运行该信号处理程序时,得知信号屏蔽字已改变。可见,在

2017-12-29 17:32:38 213

转载 [unix]信号处理非局部跳转sigsetjmp函数和siglongjmp实例

#include <apue.h>#include <setjmp.h>#include <time.h>#include <errno.h>static void sig_usr1(int);static void sig_alrm(int);static sigjmp_buf jmpbuf;static volatile sig_atomic_t canjump;void pr_m

2017-12-28 17:45:20 260

转载 [unix]SIGQUIT信号堵塞的测试

#include <apue.h>#include <errno.h>static void sig_quit(int);int main(void){ sigset_t newmask, oldmask, pendmask; if(signal(SIGQUIT,sig_quit) == SIG_ERR) err_sys("can't catch SIGQUIT

2017-12-27 14:47:09 297

转载 【unix】alarm,pause函数 实现sleep函数的一些问题(SIGALRM信号跟其他信号如(SIGINT))交互的问题

#include #include static jmp_buf env_alrm; /* version 2 */static void sig_alrm(int signo){ longjmp(env_alrm,1); /* versin 2 */ /* nothing to do , just return to wake up the pause (version 1

2017-12-18 17:02:47 406

转载 [UNIX]signal函数捕捉SIGCLD信号

#include #include static void sig_cld(int);int main(){ pid_t pid; if(signal(SIGCLD,sig_cld) == SIG_ERR) perror("signal error"); if((pid = fork()) < 0) perror("fork error"); else if(pid

2017-12-14 17:49:33 279

翻译 [UNIX]孤儿进程实验

学无止境不耻下问  http://includestdio.com

2017-12-11 17:40:15 231

原创 [UNIX]进程调度nice()函数测试

技术社区:www.includestdio.com

2017-12-08 17:03:47 611

原创 CENTOS6.5 编译安装 LNMP

1 配置好IP、DNS 、网关,确保使用远程连接工具能够连接服务器 2 配置防火墙,开启80端口、3306端口 vi /etc/sysconfig/iptables #编辑防火墙配置文件 -A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT(允许80端口通过防火墙) -A INPUT -m state –stat

2017-11-23 11:51:55 293 1

转载 【C】终端/普通文件/标准错误的缓冲大小

#include "apue.h"#include "apueerror.h"void pr_stdio(const char *, FILE *);int is_unbuffered(FILE *);int is_linebuffered(FILE *);int buffer_size(FILE *);int main(int argc,char **argv){ FILE *f

2017-09-29 11:52:00 268

原创 【C】单向链表和双向链表的插入

typedef struct NODE { struct NODE *link; int value;} Node;typedef struct DNODE { struct DNODE *fwd; struct DNODE *bwd; int value;} Dnode;# s11_node.h ################incl

2017-09-08 15:49:57 345

转载 GCC内嵌汇编一些限制字符串

/******************/ “b”将输入变量放入ebx “c”将输入变量放入ecx “d”将输入变量放入edx “s”将输入变量放入esi “d”将输入变量放入edi “q”将输入变量放入eax,ebx ,ecx ,edx中的一个 “r”将输入变量放入通用寄存器,也就是eax ,ebx,ecx,edx,esi,edi中的一个 “A”把e

2017-07-31 09:47:34 1133

转载 【c语言】实现打开一个连接描述符,并操作描述符

#include <csapp.h>int open_clientfdd(char *hostname,char *port);int open_listenfdd(char *port);void echo(int connfd);int main(int argc,char **argv) { int listenfd, connfd; socklen_t clientle

2017-07-17 16:12:27 366

转载 【c语言】打开一个socket服务端listen 描述符

int open_listenfdd(char *port){ struct addrinfo hints,*listp,*p; int listenfd, optval = 1; /* get a list of potential server address*/ memset(&hints,0,sizeof(struct addrinfo)); hints.a

2017-07-14 17:39:45 1070

转载 【c语言】打开一个客户端socket描述符

int open_clientfdd(char *hostname,char *port){ int clientfd; struct addrinfo hints,*listp,*p; /* get a list of potential server address*/ memset(&hints,0,sizeof(struct addrinfo)); hi

2017-07-14 17:09:40 397

转载 【C语言】查询域名IP

/* ============================================================================ Name : inettest.c Author : Moshiyou Version : Copyright : Your copyright notice Description : He

2017-07-14 14:50:40 967

转载 【C语言】实现一个简单SHELL应用

【C语言】实现一个简单SHELL应用

2017-06-29 14:19:54 4351

转载 【C语言】FORK子进程的创建和回收(按顺序回收)

/* ============================================================================ Name : test.c Author : Version : Copyright : Your copyright notice Description : Hello World in

2017-06-29 09:42:05 2422

原创 RSA签名验证的JAVA JDK实现方式

package com.crypt.my;import java.security.KeyFactory;import java.security.KeyPair;import java.security.KeyPairGenerator;import java.security.PrivateKey;import java.security.PublicKey;import jav

2017-06-05 23:19:06 4148

原创 JAVA多线程 Thread Runable 守护线程实例

JAVA多线程 Thread  Runable  守护线程实例package com.thread.my; public class ThreadTest extends Thread{ private int ticket = 5; private String name; public ThreadTest(String name){ this.name = na

2017-06-02 22:06:30 552

原创 【汇编语言】王爽第三版 - 实验11

把以0结尾的字符串小写转大写 DATAS SEGMENT ;此处输入数据段代码 db "Beginner's All-purpose Symbolic Instruction Code.",0 DATAS ENDSSTACKS SEGMENT ;此处输入堆栈段代码STACKS ENDSCODES SEGMENT ASSUME CS:CODES,

2017-04-21 17:15:30 1201

原创 【汇编语言】8086处理器标志寄存器的作用和DEBUG中的表示

CF:    进位标志是用来反映计算时是否产生了由低位向高位的进位,或者产生了从高位到低位的借位 。PF:    奇偶标志是用来记录相关指令执行后,其结果的所有的  Bit  位中  1  的个数是否为偶数 。ZF:    记录的是相关的指令执行完毕后,其执行的结果是否为  0 。SF:    符号标志,其记录相关指令执行完以后,其结果是否为负数 。DF:   

2017-04-21 16:10:32 1035

原创 《汇编语言》王爽第三版 - 实验10

(1)编写子程序参数 行,列,颜色,内容显示于屏幕上DATAS SEGMENT ;此处输入数据段代码 db 'Welcome to masm!',0DATAS ENDSSTACKS SEGMENT ;此处输入堆栈段代码STACKS ENDSCODES SEGMENT ASSUME CS:CODES,DS:DATAS,SS:STACKSS

2017-04-14 10:13:27 1287

原创 《汇编语言》王爽第三版 - 实验9

《汇编语言》王爽第三版 - 实验9

2017-04-13 11:34:34 1753

原创 【C语言】位的运算(深入理解计算机系统第三版习题2.12)

#include <stdio.h>#include <stdlib.h>int main(){ int a = 0x87654321; int b,d,c,e; b = a & 0xFF; // 0x00000021 c = ~ 0xFF; d = a ^ c; // 0x789abc21 e = a | 0xFF; // 0x876

2017-03-16 09:53:25 975

原创 【SHELL】统计Nginx访问日志状态码

########################################################################## File Name: check_nginx_server.sh# Author: Moshiyou# mail: [email protected]#Created Time:Mon 30 May 2016 10:21:52 AM CST#####

2016-05-30 11:29:11 4133

原创 【C语言】合并,排序两个链表

#include <stdio.h>#include <stdlib.h>#include <malloc.h>#include <assert.h>typedef struct stu{ int id; //学号 char sex[10]; //性别 float score; //成绩 struct stu *next; //下一节点的

2016-05-27 16:08:01 893

原创 【C语言】动态链表建立工人档案,并输出结果

#include <stdio.h>#include <stdlib.h>#include <malloc.h>struct factor{ int id; //工号 char name[20]; //姓名 float wages; //薪水 struct factor *next; //下一节点的头指针};struct f

2016-05-25 10:14:51 548

原创 【C语言】结构体判断一个日期是该年的第几天

#include <stdio.h>#include <stdlib.h>struct date { int year; int month; int day;} date;int main() { int sum = 0,tag; printf("请输入年月日:\n"); scanf("%d,%d,%d", &date.year, &date.m

2016-05-24 15:35:37 5437

原创 【C语言】指向指针的指针变量对字符串进行排序

#include <stdio.h>#include <stdlib.h>#include <string.h>void sort(char * str[], int size) { int i, j; char * tmp; for (i = 0; i < size - 1; i++) { for (j = i + 1; j < size; j++)

2016-05-24 14:49:49 532

原创 【SHELL】监控Nginx运行,Mysql主从运行,主从复制延迟

#!/bin/bashResettem=$(tput sgr0)server_url='http://www.zhongfenqi.com/ngx_status'mysql_slave_addr='192.168.1.103'mysql_slave_port='3307'mysql_slave_user=rootmysql_slave_pwd=123456mysql_slave_sock=

2016-05-23 19:55:14 792

原创 【SHELL】监控系统信息CPU,磁盘,内存

#!/bin/bash################################system infomation###############################clearif `test $# -eq 0`thenreset_terminal=$(tput sgr0)# OS typeos=$(uname -o)echo -e '\E[32m:'"OS t

2016-05-22 17:49:27 685 1

原创 【C语言】二维数组转置

#include <stdio.h>#include <stdlib.h>#define LINE 3#define COLUMN 3//3x3二维数组转置int a[LINE][COLUMN]={};void arr_trace(int *parr){ int i=0,j=0; for(i=0;i<LINE;i++){ for(j=0;j<COLUMN;

2016-05-20 17:21:54 2862

原创 【C语言】统计字符数

#include <stdio.h>#include <stdlib.h>//统计字符串字符个数int upcount=0,lowcount=0,spacecount=0,numcount=0,othercount=0;void char_total(char *str){ int i=0; while(*(str+i) != '\0'){ if(*(str+i

2016-05-16 11:56:20 823

原创 【C语言】判断字符串是否是回文

#include <stdio.h>#include <stdlib.h>#include <string.h>//判断一个字符串是不是回文 (正序跟倒序是一样的)int is_back_content(char *str){ int i=0,j,len,n; len = strlen(str); j = len - 1; n = len/2; whi

2016-05-11 17:23:12 3159

原创 【C语言】截取字符串实现

#include <stdio.h>#include <stdlib.h>#include <string.h>//从m长字符串中第n个位置复制字符到另外一个字符串char* substr(char *str,int n){ char *newstr; if(abs(n) > strlen(str) || n == 0) /*如果n的绝对值大于原始字符串长度退出程序状态值

2016-05-11 15:29:34 1285

php实现验证码

php实现验证码

2014-09-11

PHP实现柱形统计图源码

PHP实现柱形统计图实现,利用php gd库实现柱形统计图

2014-09-11

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除