Home
lvsoft [entries|archive|friends|userinfo]
lvsoft

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

投奔gentoo了 [Feb. 4th, 2006|12:46 pm]
硬盘挂掉了,换了一个新的硬盘,就顺便把os也换一下。其实原来的debian也不错,要说debian不好,也就是安装软件太容易了,以至于在装了数千个包之后,忽然发现给系统减肥似乎变成了一个非常复杂的任务,于是干脆一切从头开始。我对reiser4仰慕已久,装gentoo就是冲着这个来的。

gentoo还算比较好装的,这次也就装了2遍就安上了。第一遍偷懒,把现成的LiveCD直接安上了。结果这个LiveCD的内核对reiserfs4支持似乎有问题,硬盘动不动就猛读个几分钟,并且这期间什么事情都不能做。后来只好从stage3开始编译一个mm-kernel,然后一口气编译Xorg,kde,firefox,oo,emacs,evolution,beagle,...

编译这些东西还真是费力气,而且我后来发现不按照顺序编译,有些软件根本就没法用。比如我同时编译了xorg和scim,结果scim就不能用,非得在xorg编译好之后再编译scim才行。
此外gentoo的测试源似乎问题也挺多的。比如kde-3.5这个包,按理说应该以来一切kde-base/*下面的非develop包,可是事实上他什么也没有依赖。另外还有一些包,依赖关系也少写了一些。不过总得来说,还是很顺利的,赞一个。

到目前为止,系统已经算是装好了,下面配置好emacs,latex,就应该差不多了...
link7 comments|post comment

一劳永逸的解决linux下ftp的utf8编码问题 [Nov. 28th, 2005|09:21 am]
发信人: Lv(Coordination set, warp engine engage), 信区: LinuxUnix. 本篇人气: 8
标 题: 终于搞定ftp服务器的utf8编码问题了
发信站: 南京大学小百合站 (Mon Nov 28 17:26:07 2005)

编码问题linux下面一个老问题了,虽然现在有一切统一于utf8的趋势,但是总有一些死脑
筋的东西。比如ftp协议就根本没对utf8做出如何处理的规定,因此大部分服务端和客户端
都假设基于本地locale编码的。结果,我的ftp server基于utf8,而大部分windows clie
nt都基于gbk,看到的自然是一片乱码...

解决这个问题可以从两个地方着手,一个是服务端,一个是客户端。客户端由于ftp协议
乏这方面规定的原因,到目前为止只发现把firefox作为ftp客户端的时候可以解决这个问
题...

服务端问题也类似,目前只有打布丁的方式可以解决这个问题。偶比较反对布丁,因为每
个软件,每个版本的布丁都不一样。所以从另一个途经着手,一劳永逸的解决了这个问题


偶的方式也没什么特别的,基本上就是拦截了ftp服务器对本地磁盘的访问,在这个过程
把编码进行了转换。这样无论什么软件,只要用偶这个程序加个壳,就能支持utf8了。现
在大家访问偶的音乐ftp就不会再有乱码问题了。

ps:程序没有好好测试过,目前只确认在vsftpd下面读文件是没有问题的。理论上其他功能
,和其他服务器下应该也管用。
本实现用的是ld preload机制,而不是ptrace机制,对性能影响很小,可以忽略不计。

此外理论上对磁盘目录读取应该有一定的加速作用...

程序如下:
安装方法:把以下3个文件保存在某个目录下,
然后make install
会生成dynfn和libcodingconv.so*,
前者是主程序,放在/usr/local/bin下面,
后者是用于拦截的动态库,放在/usr/local/lib下面。

使用方法很简单,在原来的程序启动命令前面加上dynfn就行了。

比如原来是vsftpd parm1 parm2启动vsftpd的
现在:dynfn vsftpd parm1 parm2
即可。

此外,欢迎报告bug,不过以下bug就不要再报告了...
不带任何参数启动dynfn会segment fault,而不是如你所想的显示一个帮助。
---------Makefile-----------
CC=gcc
CFLAGS= -O2
TARGETS=libcodingconv.so dynfn

all: $(TARGETS)

dynfn: dynfn.o

clean:
rm -rf *.o $(TARGETS)

libcodingconv.so: libcodingconv.c
$(CC) -shared -ldl -Wl,-soname,libcodingconv.so.1 -o libcodingconv.so.
1.0 libcodingconv.c
ln -s -f libcodingconv.so.1.0 libcodingconv.so.1
ln -s -f libcodingconv.so.1 libcodingconv.so

install: libcodingconv.so dynfn
yes | cp -a libcodingconv.so* /usr/local/lib
---------Makefile-----------

----------dynfn.c----------
#include
[Error: Irreparable invalid markup ('<stdio.h>') in entry. Owner must fix manually. Raw contents below.]

发信人: Lv(Coordination set, warp engine engage), 信区: LinuxUnix. 本篇人气: 8
标 题: 终于搞定ftp服务器的utf8编码问题了
发信站: 南京大学小百合站 (Mon Nov 28 17:26:07 2005)

编码问题linux下面一个老问题了,虽然现在有一切统一于utf8的趋势,但是总有一些死脑
筋的东西。比如ftp协议就根本没对utf8做出如何处理的规定,因此大部分服务端和客户端
都假设基于本地locale编码的。结果,我的ftp server基于utf8,而大部分windows clie
nt都基于gbk,看到的自然是一片乱码...

解决这个问题可以从两个地方着手,一个是服务端,一个是客户端。客户端由于ftp协议缺
乏这方面规定的原因,到目前为止只发现把firefox作为ftp客户端的时候可以解决这个问
题...

服务端问题也类似,目前只有打布丁的方式可以解决这个问题。偶比较反对布丁,因为每
个软件,每个版本的布丁都不一样。所以从另一个途经着手,一劳永逸的解决了这个问题


偶的方式也没什么特别的,基本上就是拦截了ftp服务器对本地磁盘的访问,在这个过程中
把编码进行了转换。这样无论什么软件,只要用偶这个程序加个壳,就能支持utf8了。现
在大家访问偶的音乐ftp就不会再有乱码问题了。

ps:程序没有好好测试过,目前只确认在vsftpd下面读文件是没有问题的。理论上其他功能
,和其他服务器下应该也管用。
本实现用的是ld preload机制,而不是ptrace机制,对性能影响很小,可以忽略不计。

此外理论上对磁盘目录读取应该有一定的加速作用...

程序如下:
安装方法:把以下3个文件保存在某个目录下,
然后make install
会生成dynfn和libcodingconv.so*,
前者是主程序,放在/usr/local/bin下面,
后者是用于拦截的动态库,放在/usr/local/lib下面。

使用方法很简单,在原来的程序启动命令前面加上dynfn就行了。

比如原来是vsftpd parm1 parm2启动vsftpd的
现在:dynfn vsftpd parm1 parm2
即可。

此外,欢迎报告bug,不过以下bug就不要再报告了...
不带任何参数启动dynfn会segment fault,而不是如你所想的显示一个帮助。
---------Makefile-----------
CC=gcc
CFLAGS= -O2
TARGETS=libcodingconv.so dynfn

all: $(TARGETS)

dynfn: dynfn.o

clean:
rm -rf *.o $(TARGETS)

libcodingconv.so: libcodingconv.c
$(CC) -shared -ldl -Wl,-soname,libcodingconv.so.1 -o libcodingconv.so.
1.0 libcodingconv.c
ln -s -f libcodingconv.so.1.0 libcodingconv.so.1
ln -s -f libcodingconv.so.1 libcodingconv.so

install: libcodingconv.so dynfn
yes | cp -a libcodingconv.so* /usr/local/lib
---------Makefile-----------

----------dynfn.c----------
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

main(int argc, char ** argv)
{
putenv("LD_PRELOAD=/usr/local/lib/libcodingconv.so");
execvp(argv[1], &argv[1]);
perror("execv");
}
----------dynfn.c--------

----------libcodingconv.c-----------
#define _GNU_SOURCE
#define __USE_LARGEFILE64

#define DEBUG_DIR(x)

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dlfcn.h>
#include <dirent.h>
#include <utime.h>
#include <iconv.h>
#include <string.h>
#include <stdarg.h>

#define ALLOC_STEPSIZE 100
#define MAX_DIRSIZE 0
#define MAXPATHLEN 4096

#if defined(RTLD_NEXT)
#define REAL_LIBC RTLD_NEXT
#else
#define REAL_LIBC ((void *) -1L)
#endif

/*
* File name related calls:
* In&Out:
* scandir
* In:
* opendir
* mkdir
* chmod
* chdir
* lchown
* chown
* utime
* utimes
* readlink
* symlink
* rename
* remove
* fopen
* freopen
* creat
* utmpname
* truncate
* link
* open
* open64
* mknod
* stat
* lstat
* unlink
* umask
* Out:
* readdir
* readdir64
*
*/
int errno;
iconv_t cd_in=NULL, cd_out=NULL;
#define CODING_LOCAL "UTF8"
#define CODING_TO "GBK"

static void init (void) __attribute__ ((constructor));

struct dirent_s {
unsigned long long d_ino;
long long d_off;
unsigned short int d_reclen;
unsigned char d_type;
char *d_name;
};

struct dir_s {
DIR *dir;
int num;
int max;
struct dirent_s *dp;
int pos;
int fd;
struct dirent ret_dir;
struct dirent64 ret_dir64;
};

static int (*real_scandir)(const char *dir, struct dirent ***namelist, int(*fi
lter)(const struct dirent *), int(*compar)(const void *, const void *))=0;
static int (*real_closedir)(DIR *dir) = 0;
static DIR *(*real_opendir)(const char *name) = 0;
static struct dirent *(*real_readdir)(DIR *dir) = 0;
static struct dirent64 *(*real_readdir64)(DIR *dir) = 0;
static off_t (*real_telldir)(DIR *dir) = 0;
static void (*real_seekdir)(DIR *dir, off_t offset) = 0;
static int (*real_dirfd)(DIR *dir) = 0;
static int (*real_mkdir)( const char *pathname, mode_t mode )=0;
static int (*real_chmod)( const char *path, mode_t mode )=0;
static int (*real_chown)( const char *path, uid_t owner, gid_t group )=0;
static int (*real_lchown)( const char *path, uid_t owner, gid_t group )=0;
static int (*real_utime)( const char *filename, const struct utimbuf *buf )=0;

static int (*real_utimes)( const char *filename, const struct timeval tv[2] )=
0;
static int (*real_readlink)( const char *path, char *buf, size_t bufsiz )=0;

static int (*real_symlink)( const char *oldpath, const char *newpath )=0;
static int (*real_rename)( const char *oldpath, const char *newpath )=0;
static int (*real_remove)( const char *pathname )=0;
static FILE* (*real_fopen)( const char *path, const char *mode )=0;
static FILE* (*real_freopen)( const char *path, const char *mode, FILE *stream
)=0;
static int (*real_creat)( const char *pathname, mode_t mode )=0;
static int (*real_open)( const char *pathname, int flags, ... )=0;
static int (*real_open64)( const char *pathname, int flags, ... )=0;
static void (*real_utmpname)( const char *file )=0;
static int (*real_truncate)( const char *path, off_t length )=0;
static int (*real_link)(const char *oldpath, const char *newpath )=0;
static int (*real_mknod)(const char *pathname, mode_t mode, dev_t dev )=0;
static int (*real_stat)(const char *file_name, struct stat *buf )=0;
static int (*real_lstat)( const char *file_name, struct stat *buf )=0;
static int (*real_unlink)(const char *pathname )=0;
static int (*real_chdir)(const char *path)=0;
static int (*real_close)(int fd);

static int (*real___xstat64)(int ver, const char * filename, struct stat64 * s
tat_buf)=0;
static int (*real___lxstat64)(int ver, const char * filename, struct stat64 *
stat_buf)=0;


static unsigned long max_dirsize = MAX_DIRSIZE;
static num_open = 0;

void conv_out(const char * name, char * newname)
{
int m;
size_t in, out;
const char * pname=name;

in=strlen(name);
out=MAXPATHLEN;

m=iconv(cd_out, (char **)&pname, &in,
&newname, &out);
newname[m]=0;
if (m<0) strcpy(newname, name);
}

void conv_in(char * name, char * newname, int size)
{
int m;
size_t in, out;
in=strlen(name);
out=size;

m=iconv(cd_in, &name, &in,
&newname, &out);
newname[m]=0;

if (m<0) strcpy(newname, name);
}

static void init (void)
{
char *cp;

real_open = dlsym(RTLD_NEXT,"open");
real_close = dlsym(RTLD_NEXT,"close");

real_opendir = dlsym(RTLD_NEXT, "opendir");
real_closedir = dlsym(RTLD_NEXT, "closedir");
real_readdir = dlsym(RTLD_NEXT, "readdir");
real_readdir64 = dlsym(RTLD_NEXT, "readdir64");
real_telldir = dlsym(RTLD_NEXT, "telldir");
real_seekdir = dlsym(RTLD_NEXT, "seekdir");
real_dirfd = dlsym(RTLD_NEXT, "dirfd");
real_mkdir = dlsym(REAL_LIBC, "mkdir");
real_chmod = dlsym(REAL_LIBC, "chmod");
real_lchown = dlsym(REAL_LIBC, "lchown");
real_chown = dlsym(REAL_LIBC, "chown");
real_utime = dlsym(REAL_LIBC, "utime");
real_scandir = dlsym(REAL_LIBC, "scandir");
real_utimes = dlsym(REAL_LIBC, "utimes");
real_readlink = dlsym(REAL_LIBC, "readlink");
real_symlink = dlsym(REAL_LIBC, "symlink");
real_rename = dlsym(REAL_LIBC, "rename");
real_remove = dlsym(REAL_LIBC, "remove");
real_fopen = dlsym(REAL_LIBC, "fopen");
real_freopen = dlsym(REAL_LIBC, "freopen");
real_creat = dlsym(REAL_LIBC, "creat");
real_open = dlsym(REAL_LIBC, "open");
real_open64 = dlsym(REAL_LIBC, "open64");
real_utmpname = dlsym(REAL_LIBC, "utmpname");
real_truncate = dlsym(REAL_LIBC, "truncate");
real_link = dlsym(REAL_LIBC, "link");
real_mknod = dlsym(REAL_LIBC, "mkdir");
real_stat = dlsym(REAL_LIBC, "stat");
real_lstat = dlsym(REAL_LIBC, "lstat");
real_unlink = dlsym(REAL_LIBC, "unlink");
real_chdir = dlsym(REAL_LIBC, "chdir");
real___xstat64 = dlsym(REAL_LIBC, "__xstat64");
real___lxstat64 = dlsym(REAL_LIBC, "__lxstat64");

if ((cp = getenv("SPD_READDIR_MAX_SIZE")) != NULL) {
max_dirsize = atol(cp);
}

initCD();
}

int initCD()
{
if ((cd_in)&&(cd_out)) return 1;
cd_out=iconv_open(CODING_LOCAL, CODING_TO);
cd_in=iconv_open(CODING_TO, CODING_LOCAL);
if ((cd_in)&&(cd_out)) return 1;
return 0;
}

static void free_cached_dir(struct dir_s *dirstruct)
{
int i;

if (!dirstruct->dp)
return;

for (i=0; i < dirstruct->num; i++) {
free(dirstruct->dp[i].d_name);
}
free(dirstruct->dp);
dirstruct->dp = 0;
}

static int ino_cmp(const void *a, const void *b)
{
const struct dirent_s *ds_a = (const struct dirent_s *) a;
const struct dirent_s *ds_b = (const struct dirent_s *) b;
ino_t i_a, i_b;

i_a = ds_a->d_ino;
i_b = ds_b->d_ino;

if (ds_a->d_name[0] == '.') {
if (ds_a->d_name[1] == 0)
i_a = 0;
else if ((ds_a->d_name[1] == '.') && (ds_a->d_name[2] == 0))
i_a = 1;
}
if (ds_b->d_name[0] == '.') {
if (ds_b->d_name[1] == 0)
i_b = 0;
else if ((ds_b->d_name[1] == '.') && (ds_b->d_name[2] == 0))
i_b = 1;
}

return (i_a - i_b);
}


DIR *opendir(const char *name)
{
DIR *dir;
struct dir_s *dirstruct;
struct dirent_s *ds, *dnew;
struct dirent64 *d;
struct stat st;
char newname[MAXPATHLEN];
char newname2[MAXPATHLEN];

if (!real_opendir)
return NULL;
if (initCD()){
conv_out(name, newname);
}

dir = (*real_opendir)(newname);
if (!dir)
return NULL;

dirstruct = malloc(sizeof(struct dir_s));
if (!dirstruct) {
(*real_closedir)(dir);
errno = -ENOMEM;
return NULL;
}
dirstruct->num = 0;
dirstruct->max = 0;
dirstruct->dp = 0;
dirstruct->pos = 0;
dirstruct->dir = 0;

if (max_dirsize && (stat(name, &st) == 0) &&
(st.st_size > max_dirsize)) {
dirstruct->dir = dir;
return (DIR *) dirstruct;
}

while ((d = (*real_readdir64)(dir)) != NULL) {
if (dirstruct->num >= dirstruct->max) {
dirstruct->max += ALLOC_STEPSIZE;
dnew = realloc(dirstruct->dp,
dirstruct->max * sizeof(struct dir_s));
if (!dnew)
goto nomem;
dirstruct->dp = dnew;
}
ds = &dirstruct->dp[dirstruct->num++];
ds->d_ino = d->d_ino;
ds->d_off = d->d_off;
ds->d_reclen = d->d_reclen;
ds->d_type = d->d_type;
conv_in(d->d_name, newname2, MAXPATHLEN);

if ((ds->d_name = malloc(strlen(newname2)+1)) == NULL) {
dirstruct->num--;
goto nomem;
}
strcpy(ds->d_name, newname2);
}
dirstruct->fd = dup((*real_dirfd)(dir));
(*real_closedir)(dir);
qsort(dirstruct->dp, dirstruct->num, sizeof(struct dirent_s), ino_cmp);
return ((DIR *) dirstruct);
nomem:
free_cached_dir(dirstruct);
dirstruct->dir = dir;
return ((DIR *) dirstruct);
}

int closedir(DIR *dir)
{
struct dir_s *dirstruct = (struct dir_s *) dir;

if (dirstruct->dir)
(*real_closedir)(dirstruct->dir);

if (dirstruct->fd >= 0)
close(dirstruct->fd);
free_cached_dir(dirstruct);
free(dirstruct);
return 0;
}

struct dirent *readdir(DIR *dir)
{
struct dir_s *dirstruct = (struct dir_s *) dir;
struct dirent_s *ds;

if (dirstruct->dir)
return (*real_readdir)(dirstruct->dir);

if (dirstruct->pos >= dirstruct->num)
return NULL;

ds = &dirstruct->dp[dirstruct->pos++];
dirstruct->ret_dir.d_ino = ds->d_ino;
dirstruct->ret_dir.d_off = ds->d_off;
dirstruct->ret_dir.d_reclen = ds->d_reclen;
dirstruct->ret_dir.d_type = ds->d_type;
strncpy(dirstruct->ret_dir.d_name, ds->d_name,
sizeof(dirstruct->ret_dir.d_name));

return (&dirstruct->ret_dir);
}

struct dirent64 *readdir64(DIR *dir)
{
struct dir_s *dirstruct = (struct dir_s *) dir;
struct dirent_s *ds;

if (dirstruct->dir){

struct dirent64 * ret=(*real_readdir64)(dirstruct->dir);
return ret;
}

if (dirstruct->pos >= dirstruct->num)
return NULL;

ds = &dirstruct->dp[dirstruct->pos++];
dirstruct->ret_dir64.d_ino = ds->d_ino;
dirstruct->ret_dir64.d_off = ds->d_off;
dirstruct->ret_dir64.d_reclen = ds->d_reclen;
dirstruct->ret_dir64.d_type = ds->d_type;
strncpy(dirstruct->ret_dir64.d_name, ds->d_name,
sizeof(dirstruct->ret_dir64.d_name));

return (&dirstruct->ret_dir64);
}

off_t telldir(DIR *dir)
{
struct dir_s *dirstruct = (struct dir_s *) dir;

if (dirstruct->dir)
return (*real_telldir)(dirstruct->dir);

return ((off_t) dirstruct->pos);
}

void seekdir(DIR *dir, off_t offset)
{
struct dir_s *dirstruct = (struct dir_s *) dir;

if (dirstruct->dir) {
(*real_seekdir)(dirstruct->dir, offset);
return;
}

dirstruct->pos = offset;
}

int dirfd(DIR *dir)
{
struct dir_s *dirstruct = (struct dir_s *) dir;

if (dirstruct->dir)
return (*real_dirfd)(dirstruct->dir);

return (dirstruct->fd);
}

int scandir(const char *dir, struct dirent ***namelist,
int(*filter)(const struct dirent *),
int(*compar)(const void *, const void *))
{

return (*real_scandir)( dir, namelist, filter, compar );
}

int mkdir(const char *pathname, mode_t mode)
{
char newname[MAXPATHLEN];

if (initCD()){
conv_out(pathname, newname);
}
return (*real_mkdir)( newname, mode );
}


int chmod(const char *path, mode_t mode)
{
char newname[MAXPATHLEN];

if (initCD()){
conv_out(path, newname);
}
return (*real_chmod)( newname, mode );
}

int lchown(const char *path, uid_t owner, gid_t group)
{
char newname[MAXPATHLEN];

if (initCD()){
conv_out(path, newname);
}
return (*real_lchown)( newname, owner, group );
}

int chown(const char *path, uid_t owner, gid_t group)
{
char newname[MAXPATHLEN];

if (initCD()){
conv_out(path, newname);
}
return (*real_chown)( newname, owner, group );
}

int utime(const char *filename, const struct utimbuf *buf)
{
char newname[MAXPATHLEN];

if (initCD()){
conv_out(filename, newname);
}
return (*real_utime)( newname, buf );
}

int utimes(const char *filename, const struct timeval tv[2])
{
char newname[MAXPATHLEN];

if (initCD()){
conv_out(filename, newname);
}
return (*real_utimes)( newname, tv );
}

int readlink(const char *path, char *buf, size_t bufsiz)
{
char newname[MAXPATHLEN];
char newname2[MAXPATHLEN];
int m;

if (initCD()){
conv_out(path, newname);
}
m=(*real_readlink)( newname, newname2, MAXPATHLEN );
conv_in(newname2, buf, bufsiz);
return m;
}

int symlink(const char *oldpath, const char *newpath)
{
char newname[MAXPATHLEN];
char newname2[MAXPATHLEN];

if (initCD()){
conv_out(oldpath, newname);
conv_out(newpath, newname2);
}
return (*real_symlink)( newname, newname2 );
}

int rename(const char *oldpath, const char *newpath)
{
char newname[MAXPATHLEN];
char newname2[MAXPATHLEN];

if (initCD()){
conv_out(oldpath, newname);
conv_out(newpath, newname2);
}
return (*real_rename)( newname, newname2 );
}

int remove(const char *pathname)
{
char newname[MAXPATHLEN];

if (initCD()){
conv_out(pathname, newname);
}
return (*real_remove)( newname );
}

FILE *fopen(const char *path, const char *mode)
{
char newname[MAXPATHLEN];

if (initCD()){
conv_out(path, newname);
}

return (*real_fopen)( newname, mode );
}

FILE *freopen(const char *path, const char *mode, FILE *stream)
{
char newname[MAXPATHLEN];

if (initCD()){
conv_out(path, newname);
}

return (*real_freopen)( newname, mode, stream );
}

int creat(const char *pathname, mode_t mode)
{
char newname[MAXPATHLEN];

if (initCD()){
conv_out(pathname, newname);
}

return (*real_creat)( newname, mode );
}

int open(const char *pathname, int flags, ...)
{
char newname[MAXPATHLEN];
if (initCD()){
conv_out(pathname, newname);
}

return (*real_open)( newname, flags );
}

int open64(const char *pathname, int flags, ...)
{
char newname[MAXPATHLEN];
if (initCD()){
conv_out(pathname, newname);
}

return (*real_open64)( newname, flags );
}

void utmpname(const char *file)
{
char newname[MAXPATHLEN];
if (initCD()){
conv_out(file, newname);
}

(*real_utmpname)( newname );
}

int truncate(const char *path, off_t length)
{
char newname[MAXPATHLEN];
if (initCD()){
conv_out(path, newname);
}

return (*real_truncate)( newname, length );
}

int link(const char *oldpath, const char *newpath)
{
char newname[MAXPATHLEN];
char newname2[MAXPATHLEN];
if (initCD()){
conv_out(oldpath, newname);
conv_out(newpath, newname2);
}

return (*real_link)( newname, newname2 );
}

int mknod(const char *pathname, mode_t mode, dev_t dev)
{
char newname[MAXPATHLEN];
if (initCD()){
conv_out(pathname, newname);
}

return (*real_mknod)( newname, mode, dev );
}

int stat(const char *file_name, struct stat *buf)
{
char newname[MAXPATHLEN];
if (initCD()){
conv_out(file_name, newname);
}

return (*real_stat)( newname, buf );
}

int lstat(const char *file_name, struct stat *buf)
{
char newname[MAXPATHLEN];
conv_out(file_name, newname);

return (*real_lstat)( newname, buf );
}

int __xstat64(int ver, const char * filename, struct stat64 * buf)
{
char newname[MAXPATHLEN];
conv_out(filename, newname);

return (*real___xstat64)( ver, newname, buf );
}

int __lxstat64(int ver, const char * filename, struct stat64 * buf)
{
char newname[MAXPATHLEN];
conv_out(filename, newname);

return (*real___lxstat64)( ver, newname, buf );
}



int unlink(const char *pathname)
{
char newname[MAXPATHLEN];
conv_out(pathname, newname);

return (*real_unlink)( newname );
}

int chdir(const char* path)
{
char newname[MAXPATHLEN];
conv_out(path, newname);

return (*real_chdir)( newname );
}
----------libcodingconv.c-----------
--
When the mind is enlightened,
spirit is freeed,
the body means not.

※ 来源:.南京大学小百合站 http://bbs.nju.edu.cn[FROM: 172.16.30.232][+reset]
link10 comments|post comment

今天换了个主板,遇到郁闷的事情了 [Nov. 12th, 2005|04:24 am]
把t41换成t42了,其实我主要是想要个好一点的显卡的。
没想到居然只有radeon 9000 mobility...
勉强换了,

然后装机居然多出了4个螺丝,我跑过来找JS换,
就是指望他们熟练一点,没想到居然也就这个水平,还不如欧自己换算了...

然后抱回家,在linux下面才玩了一会儿游戏,就强制关机了,
关机前看了一眼提示信息,居然是温度过高...

然后以为那个js没有给我把风扇电源插上,
打开键盘看了一下,居然插上了,而且风扇也跑得很欢的样子。
然后偶就百思不得其解了,因为即使不涂硅胶,也不可能温度升得这么快的。
研究了好长一会儿,没有头绪,
然后在关机的一瞬间欧明白了,
欧发现那个cpu风扇居然是倒着转的,
cpu风扇是涡轮抽风式设计,倒着转效果比不转好不到哪里去...
吐血啊,js给我换一个返修的风扇也就罢了,好歹也修的敬业一点呢...

明天找他们去,今天只能做点灌水,聊天之类的小负荷事情了...
link2 comments|post comment

Phased Array Radar [Nov. 8th, 2005|09:39 pm]
最近忽然对这个东西异常感兴趣,
打算自己做一个玩玩,
貌似比较好玩的样子。
linkpost comment

test [Nov. 8th, 2005|09:25 pm]
test test
link1 comment|post comment

navigation
[ viewing | most recent entries ]

Advertisement