亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? bb_threads.c

?? 話帶數據中傳真解調程序
?? C
字號:
/* A very basic threads package. Based on the excellent work of * Wolfram Gloger (Gloger@lrz.uni-Muenchen.de), Linus Torvalds, and * Alan Cox. * * I didn't do much, just strung these things together. * Christopher Neufeld  (neufeld@physics.utoronto.ca) */   /* Important: the macro __SMP__ must be defined if this is to run on * SMP Linux. *//* #define __SMP__ */#include <linux/signal.h>#include <linux/unistd.h>#include <linux/types.h>//Bodge to stop loading of types package again.#define	_SYS_TYPES_H	1#include <sys/mman.h>#include <values.h>#ifdef __NFDBITS#undef __NFDBITS#endif#ifdef __FDMASK#undef __FDMASK#endif#include <stdio.h>#include <unistd.h>#include "bb_threads.h"#define CLONE_VM        0x00000100#define CLONE_FS        0x00000200#define CLONE_FILES     0x00000400#define CLONE_SIGHAND   0x00000800#define PR_SALL         (CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND)/* Start a thread calling fn(data, len). * sp is the _top_ of the allocated stack; len its length. */static intsprocsp(void (*fn)(void *, size_t), unsigned int flags,        void *data, caddr_t sp, size_t len){        long retval;        void **newstack = (void **)((size_t)sp & ~(sizeof(void *)-1));        *(--(size_t *)newstack) = len;        *(--newstack) = data;        /*         * Do clone() system call. We need to do the low-level stuff         * entirely in assembly as we're returning with a different         * stack in the child process and we couldn't otherwise guarantee         * that the program doesn't use the old stack incorrectly.         *         * Parameters to clone() system call:         *      %eax - __NR_clone, clone system call number         *      %ebx - clone_flags, bitmap of cloned data         *      %ecx - new stack pointer for cloned child         *         * The clone() system call returns (in %eax) the pid of the newly         * cloned process to the parent, and 0 to the cloned process. If         * an error occurs, the return value will be the negative errno.         *         * In the child process, we will do a "jsr" to the requested function         * and then do a "exit()" system call which will terminate the child.         */        __asm__ __volatile__(                "int $0x80\n\t"         /* Linux/i386 system call */                "testl %0,%0\n\t"       /* check return value */                "jne 1f\n\t"            /* jump if parent */                "call *%3\n\t"          /* start subthread function */                "movl %2,%0\n\t"                "int $0x80\n"           /* exit system call: exit subthread */                "1:\t"                :"=a" (retval)                :"0" (__NR_clone),"i" (__NR_exit),                 "r" (fn),                 "b" (flags | SIGCHLD),                 "c" (newstack));        if (retval < 0) {                errno = -retval;                retval = -1;        }        return retval;}/* The following code is removed directly from <asm/bitops.h>, and the * 'extern' keywords stripped. *//* * Copyright 1992, Linus Torvalds. *//* * These have to be done with inline assembly: that way the bit-setting * is guaranteed to be atomic. All bit operations return 0 if the bit * was cleared before the operation and != 0 if it was not. * * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). */#ifdef __SMP__#define LOCK_PREFIX "lock ; "#define SMPVOL volatile#else#define LOCK_PREFIX ""#define SMPVOL#endif/* * Some hacks to defeat gcc over-optimizations.. */struct __dummy { unsigned long a[100]; };#define ADDR (*(struct __dummy *) addr)#define CONST_ADDR (*(const struct __dummy *) addr)__inline__ static int set_bit(int nr, void SMPVOL * addr){	int oldbit;	__asm__ __volatile__(LOCK_PREFIX		"btsl %2,%1\n\tsbbl %0,%0"		:"=r" (oldbit),"=m" (ADDR)		:"ir" (nr));	return oldbit;}__inline__ static int clear_bit(int nr, void SMPVOL * addr){	int oldbit;	__asm__ __volatile__(LOCK_PREFIX		"btrl %2,%1\n\tsbbl %0,%0"		:"=r" (oldbit),"=m" (ADDR)		:"ir" (nr));	return oldbit;}/* * This routine doesn't need to be atomic. */__inline__ int static test_bit(int nr, void volatile * addr){	return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0;}/* End of other people's code - CJN */#define BLOCKSIZE 4096#define MAXNUMTHREADS 256#ifndef FALSE#define FALSE 0#endif#ifndef TRUE#define TRUE 1#endifstatic size_t stacksize;static int shared_signal_handlers = TRUE;static pid_t threadids[MAXNUMTHREADS];static void *stacks[MAXNUMTHREADS];static pid_t numthreads;   /* Initialized to 0 by compiler */static volatile int privatemutex;/* Prototypes */static __inline__ int bb_threads_private_lock(void);static __inline__ int bb_threads_private_unlock(void);static __inline__ intbb_threads_private_lock(void){  while(set_bit(0, &privatemutex))    while(test_bit(0, &privatemutex));  return 0;}static __inline__ intbb_threads_private_unlock(void){  return clear_bit(0, &privatemutex);}/* Set the stack size to be used in subsequent thread creation. */voidbb_threads_stacksize(size_t n){  if (n % BLOCKSIZE != 0) {    fprintf(stderr, "Please select a stack size which is an integer multiple of %d\n", BLOCKSIZE);    return;  }  bb_threads_private_lock();  stacksize = n;  bb_threads_private_unlock();  }/* When a new thread is spawned, does it share signal behaviour with its * parent? In other words, if the child thread sets a signal action, does * that action replace the parent's action as well? The default action is * share handlers. */voidbb_threads_shared_sighandlers(int shared) {  bb_threads_private_lock();  if (shared) {    shared_signal_handlers = TRUE;  } else {    shared_signal_handlers = FALSE;  }  bb_threads_private_unlock();}/* Create a new thread. It should be passed "fcn", a function which * takes two arguments, (the second one is a dummy, always 4). The * first argument is passed in "arg". Returns the PID of the new * thread */pid_tbb_threads_newthread(void (*fcn)(void *, size_t), void *arg){  pid_t newpid; char *barrier;  int flags;  if (stacksize == 0) {    fprintf(stderr, "Error. bb_threads_newthread() called before bb_threads_stacksize()\n");    return -1;  }  bb_threads_private_lock();  stacks[numthreads] = malloc(stacksize + 1 * BLOCKSIZE);  if (stacks[numthreads] == NULL) {    fprintf(stderr, "Memory allocation failure in bb_threads_newthread()\n");    bb_threads_private_unlock();    return -1;  }  barrier = (char *)(((int)(stacks[numthreads] + BLOCKSIZE) / BLOCKSIZE) * BLOCKSIZE);  if (mprotect(barrier, BLOCKSIZE, PROT_NONE)) {    fprintf(stderr, "Warning: Unable to guard the stack in bb_threads_newthread() for the new\n");    fprintf(stderr, "thread. Stack overruns will not immediately SIGSEGV.\n");  }  flags = CLONE_VM | CLONE_FS | CLONE_FILES;  if (shared_signal_handlers)    flags |= CLONE_SIGHAND;  newpid = sprocsp(fcn, flags, arg, stacks[numthreads] + stacksize + BLOCKSIZE, sizeof(arg));    if (newpid == -1) {    fprintf(stderr, "Unknown error spawning new thread.\n");    if (mprotect(barrier, BLOCKSIZE, PROT_READ | PROT_WRITE)) {      fprintf(stderr, "Warning: Unable to remove the mprotect on the stack in bb_threads_newthread().\n");      fprintf(stderr, "Your program is likely to SEGV soon.\n");    }    free(stacks[numthreads]);    bb_threads_private_unlock();    return -1;  }  threadids[numthreads] = newpid;  numthreads++;  bb_threads_private_unlock();  return newpid;}/* Clean up after a thread has finished. Should be passed the PID of * the thread which has exited, and it will free the memory used by * the thread's stack. */pid_tbb_threads_cleanup(pid_t tnum){  int i, j;  char *barrier;  bb_threads_private_lock();  for (i = 0; i < numthreads; i++)    if (threadids[i] == tnum)      break;  if (i == numthreads) {#ifndef SILENT_FAIL_CLEANUP    fprintf(stderr, "Warning: tried to clean up a thread which wasn't there.\n");#endif  /* !SILENT_FAIL_CLEANUP */    bb_threads_private_unlock();    return -1;  }  barrier = (char *)(((int)(stacks[i] + BLOCKSIZE) / BLOCKSIZE) * BLOCKSIZE);  if (mprotect(barrier, BLOCKSIZE, PROT_READ | PROT_WRITE)) {    fprintf(stderr, "Warning: Unable to remove the mprotect on the stack in bb_threads_newthread().\n");    fprintf(stderr, "Your program is likely to SEGV soon.\n");  }  free(stacks[i]);  for (j = i+1; j < numthreads; j++) {    stacks[j-1] = stacks[j];    threadids[j-1] = threadids[j];  }  numthreads--;  bb_threads_private_unlock();  return tnum;}#define MAX_MUTEXES 1024static int volatile mutexes[MAX_MUTEXES / (BITSPERBYTE * sizeof(int)) + 1];/* Initialize a mutex */intbb_threads_mutexcreate(int n){  if (n >= MAX_MUTEXES || n < 0) {    fprintf(stderr, "Mutex ID number out of range.\n");    return -1;  }  clear_bit(n, &mutexes[0]);  return 0;}/* Lock a mutex. If already locked, wait for it to be freed. */__inline__ intbb_threads_lock(int n){  if (n >= MAX_MUTEXES || n < 0) {    fprintf(stderr, "Mutex ID number out of range.\n");    return -1;  }  while(set_bit(n, &mutexes[0]))    while(test_bit(n, &mutexes[0]));  return 0;}/* Free a mutex so that somebody else can have it. Returns the previous * value of the mutex. It is legal to unlock an unlocked mutex. */__inline__ intbb_threads_unlock(int n){  if (n >= MAX_MUTEXES || n < 0) {    fprintf(stderr, "Mutex ID number out of range.\n");    return -1;  }  return clear_bit(n, &mutexes[0]);}/* Try to lock a mutex, but rather than busy waiting on it, sleep for * 'usecs' microseconds between attempts. */__inline intbb_threads_sleepy_lock(int n, int usecs){  if (n >= MAX_MUTEXES || n < 0) {    fprintf(stderr, "Mutex ID number out of range.\n");    return -1;  }  while(set_bit(n, &mutexes[0]))    while(test_bit(n, &mutexes[0]))      usleep(usecs);  return 0;}voidbb_threads_id_fcn(FILE *stream){  fprintf(stream, "$RCSfile: bb_threads.c,v $ $Revision: 0.8 $ $Date: 1996/10/15 13:51:15 $ (UTC)\n");}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人午夜大片免费观看| 亚洲品质自拍视频网站| 91在线视频观看| 美女诱惑一区二区| 中文字幕中文在线不卡住| 日韩一级片在线播放| 一本一道久久a久久精品综合蜜臀| 久草中文综合在线| 亚洲国产精品自拍| 中文字幕一区二区三区四区 | 亚洲一级不卡视频| 中文字幕免费不卡| 欧美xxxxx牲另类人与| 欧美日韩精品免费| 在线亚洲免费视频| www.66久久| 国产成人av一区| 久久福利资源站| 热久久一区二区| 午夜精品视频在线观看| 一区二区三区中文字幕电影| 国产精品美女久久久久久2018 | 亚洲高清不卡在线| 色狠狠av一区二区三区| 视频在线观看91| 久久九九久久九九| 91视视频在线观看入口直接观看www | 亚洲国产高清不卡| 欧美日韩精品一区二区| 97国产一区二区| 成人久久久精品乱码一区二区三区| 日本女优在线视频一区二区| 亚洲午夜激情网站| 亚洲图片欧美色图| 亚洲午夜久久久久久久久电影院| 日韩毛片高清在线播放| 136国产福利精品导航| 中文字幕日本乱码精品影院| 国产精品高潮呻吟| 亚洲日本一区二区| 亚洲精品视频自拍| 亚洲一区二区三区爽爽爽爽爽| 一区二区三区资源| 亚洲狠狠爱一区二区三区| 亚洲国产一二三| 亚洲成av人片一区二区三区| 亚洲123区在线观看| 日韩av一二三| 国产麻豆精品95视频| 成人高清免费观看| 91麻豆swag| 精品视频全国免费看| 欧美精品久久天天躁| 日韩欧美二区三区| 久久久精品日韩欧美| 国产精品免费视频观看| 日韩理论片一区二区| 亚洲一区免费在线观看| 亚洲国产中文字幕在线视频综合 | 国产精品乱码妇女bbbb| 亚洲精品一区二区三区在线观看| 欧美精品高清视频| 精品盗摄一区二区三区| 91精品国产乱| 久久精品这里都是精品| 国产精品美女一区二区三区| 国产精品午夜电影| 一区二区三区在线免费| 日韩福利电影在线| 欧美日韩综合在线| 91精品国产入口在线| 精品久久国产字幕高潮| 亚洲国产精品传媒在线观看| 一区二区三区在线影院| 日本不卡一区二区| 国产精一区二区三区| 欧美午夜精品久久久| 日韩视频免费直播| 国产精品的网站| 日本午夜精品视频在线观看| 风间由美性色一区二区三区| 在线观看欧美黄色| 久久综合狠狠综合久久综合88 | 成人午夜短视频| 欧美高清视频一二三区| 国产午夜久久久久| 日韩国产欧美三级| av中文字幕一区| 日韩西西人体444www| 亚洲精品国产无天堂网2021| 裸体在线国模精品偷拍| 色哟哟国产精品| 精品电影一区二区三区| 亚洲电影一区二区三区| www.欧美日韩国产在线| 日韩欧美国产小视频| 一区二区三区精品在线观看| 狠狠色狠狠色综合系列| 欧美日韩精品系列| 亚洲另类春色校园小说| 国产一区二区三区精品视频| 欧美猛男gaygay网站| 亚洲色图.com| 成人精品在线视频观看| 精品久久久久av影院| 日日摸夜夜添夜夜添国产精品| 99综合影院在线| 国产三区在线成人av| 精品国产乱子伦一区| 丁香另类激情小说| 国产亚洲一区二区三区| 精品无人区卡一卡二卡三乱码免费卡 | 91视频精品在这里| 精品裸体舞一区二区三区| 蜜臀va亚洲va欧美va天堂| 88在线观看91蜜桃国自产| 久久疯狂做爰流白浆xx| 日韩欧美国产综合| 亚洲男人天堂av| 成人成人成人在线视频| 国产日韩亚洲欧美综合| 久久99精品国产.久久久久| 欧美放荡的少妇| 性久久久久久久| 欧美片在线播放| 午夜日韩在线电影| 欧美裸体一区二区三区| 洋洋av久久久久久久一区| 色婷婷精品大视频在线蜜桃视频 | 亚洲私人黄色宅男| 成人午夜免费视频| 欧美激情中文字幕一区二区| 国产精品一区不卡| 国产婷婷一区二区| 成人污污视频在线观看| 国产精品色噜噜| 91丝袜国产在线播放| 日韩美女视频一区| 在线观看视频91| 亚洲国产综合色| 欧美一区二区三区四区久久| 日韩av一级电影| 欧美成人国产一区二区| 国产综合久久久久影院| 久久九九99视频| 菠萝蜜视频在线观看一区| 国产精品久久久久久久久动漫| 成人免费看视频| 一区二区在线看| 欧美男人的天堂一二区| 久久国内精品自在自线400部| 日韩一级视频免费观看在线| 精品一区二区三区视频| 国产日韩成人精品| 91浏览器打开| 丝袜亚洲另类丝袜在线| 久久综合999| 99亚偷拍自图区亚洲| 亚洲一区电影777| 91精品国产91久久久久久一区二区| 久久不见久久见免费视频1| 久久美女高清视频| 亚洲制服欧美中文字幕中文字幕| 亚洲私人黄色宅男| 天天色天天操综合| 日欧美一区二区| 婷婷开心久久网| 男女激情视频一区| 激情欧美一区二区| 国产一区二区在线观看免费 | 成人免费电影视频| 国产精华液一区二区三区| 久久国产人妖系列| 韩国av一区二区三区| 欧美亚洲动漫另类| 黄色精品一二区| 亚洲黄网站在线观看| 精品国产网站在线观看| 成人免费的视频| 日本中文字幕一区二区视频| 中文字幕二三区不卡| 欧美精品日韩精品| www.亚洲色图.com| 麻豆久久久久久久| 亚洲色图制服丝袜| 久久综合狠狠综合久久激情| 在线观看91视频| 国产成人免费视频网站高清观看视频 | 色爱区综合激月婷婷| 九色综合狠狠综合久久| 亚洲激情第一区| 久久久久久久久一| 欧美精品久久99| 色狠狠色狠狠综合| 成人一区二区三区在线观看| 免费成人在线播放| 亚洲电影视频在线| 亚洲品质自拍视频网站| 国产欧美日韩在线看| 日韩欧美一区二区三区在线|