如果fork后不进行wait
或waitpid
,那么子进程将会成会僵尸进程。double fork后, second child成为孤儿进程,由init负责后续的清理工作。
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
import java.nio.ByteBuffer; | |
import java.util.*; | |
import static java.lang.Math.log; | |
/** | |
* User: zhaoyao | |
* Date: 11-9-24 | |
* Time: PM10:48 | |
*/ |
########################################## expat ############################################# | |
cd /usr/local/src | |
wget http://downloads.sourceforge.net/project/expat/expat/2.0.1/expat-2.0.1.tar.gz?use_mirror=cdnetworks-kr-2 | |
tar zxvf expat-2.0.1.tar.gz· | |
cd expat-2.0.1 | |
./configure --prefix=/usr/local/expat | |
make && make install | |
mkdir /usr/local/expat/lib64 | |
cp -a /usr/local/expat/lib/* /usr/local/expat/lib64/ |
/* tail -- output the last part of file(s) | |
Copyright (C) 1989-2012 Free Software Foundation, Inc. | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by | |
the Free Software Foundation, either version 3 of the License, or | |
(at your option) any later version. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
int | |
is_big_endian() | |
{ | |
int test = 1; | |
unsigned char *testp = (unsigned char*) &test; | |
// test if the high bits is on the left | |
return testp[0] == 0; | |
} |
lua_pushstring与lua_pushlstring | |
push的string会被memcpy到lua malloc出来的TString中去,会产生一次memcpy |
import java.util.*; | |
/** | |
* User: zhaoyao | |
* Date: 11/5/12 | |
* Time: 11:56 PM | |
*/ | |
public class Typoglycemia { | |
private static final Random rnd = new Random(); |
package snip; | |
import java.io.EOFException; | |
import java.util.Arrays; | |
import java.util.PriorityQueue; | |
/** | |
* User: zhaoyao | |
* Date: 1/5/13 | |
* Time: 10:53 PM |
<?xml version="1.0" encoding="UTF-8"?> | |
<scheme name="SonOfObsidian" version="1" parent_scheme="Default"> | |
<option name="LINE_SPACING" value="1.0" /> | |
<option name="EDITOR_FONT_SIZE" value="16" /> | |
<option name="CONSOLE_FONT_NAME" value="Monospaced" /> | |
<option name="CONSOLE_FONT_SIZE" value="12" /> | |
<option name="EDITOR_FONT_NAME" value="Consolas" /> | |
<colors> | |
<option name="CARET_COLOR" value="ffffff" /> | |
<option name="CARET_ROW_COLOR" value="333333" /> |
U=$(echo "$1" | cut -d@ -f1 | cut -d: -f1) | |
HOSTNAME=$(echo "$1" | cut -d@ -f2 | cut -d: -f1) | |
PORT=$(echo "$1" | cut -d: -f2) | |
if [[ $U = $1 ]]; then #no user specified | |
U=$(USER) | |
fi | |
if [[ $PORT = $1 ]]; then #no port specified | |
PORT="22" | |
fi |