⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unix编程应用问答中文版.txt

📁 这份文档不是FAQ(Frequently Answered Question)
💻 TXT
📖 第 1 页 / 共 5 页
字号:
25.4  AIX多线程编程与errno全局变量

--------------------------------------------------------------------------

0. Unix/C传奇问题

0.1 Dennis Ritchie 和 Ken Thompson

Q: 我想知道他们,为什么大家不断提到这两个名字?

A: All of Unix Programmers

我们也想知道,:-P

1969年Dennis Ritchie 和 Ken Thompson在贝尔实验室创造性地发明了Unix操作系统,
为此1983年他们获得了图灵奖。

尽管Ritchie是C程序设计语言的发明者,但是他最喜欢的编程语言是Alef。而
Thompson是一名业余飞行员,曾到莫斯科驾驶过米格-29。

欢迎访问

http://cm.bell-labs.com/who/dmr/
http://cm.bell-labs.com/who/ken/

0.2 W. Richard Stevens 之死

Q: David Johns <odin@gte.net>

我是他的崇拜者,用www.google.com搜索他的讣告,但这份讣告没有提及死因,有人
知道吗?

真的仅仅是英年早逝吗?

A: Nithyanandham <m.nithyanandham@blr.spcnl.co.in>

他死于1999/09/01,家人不想让别人知道死因。讣告位于

http://www.azstarnet.com/clips/richard_stevens.html

A: joe broz <jbroz@transarc.ibm.com>

似乎是一场攀岩事故,或者滑雪事故,我不确认。

Q: W. 代表什么

A: William. My parents wanted to name me after my Uncle Bill but also
   wanted to call me Richard. They figured "William Richard" sounded
   better than "Richard William".

Q: 做为Guru of the Unix gurus,Stevens一生当中崇拜过什么人吗?

A: http://www.salon.com/tech/feature/2000/09/01/rich_stevens/index.html

Stevens greatly admired and strove to emulate Donald Knuth, who wrote
"The Art of Computer Programming," and Brian Kernighan,
"The C Programming Language," whose books are as beautifully laid out as
they are brilliantly written.

D: knightmare@bbs.apue.net 2002-04-08 15:54

搞笑片段

我现在越来越崇拜Stevens了,因为昨天我看的电影--反斗神鹰(hot shot)--的导演
是Richard Stevens。

D: Rachel Chalmers <rachel@goop.org>

这个可与之比拟,不过这个是真的

His books are so good that they have come to symbolize intelligence. In
"Wayne's World II," Garth's girlfriend carries a copy of "Unix Network
Programming." Stevens discovered this when he took his 13-year-old son to
see the film. His son grabbed his arm and said, "Dad, that's your book!"

"I couldn't believe it," he told programmer Trent Hein. "My book was used
to define the ultimate geek, and suddenly my son thinks I'm really cool."

His son was right.

0.3 更多Unix传奇故事

A: http://www.salon.com/directory/topics/unix/index.html

0.4 那些Unix传奇人物长什么样,不会都是三头六臂吧

A: 长得并没有多帅,不过更多比他们帅的人没能在Unix历史上留下什么,我想他们
   还是蛮和蔼的嘛。这里是其中九位的照片

   Famous Hacker & Engineer
   http://fsl.myetang.com/

0.5 "3y3"是如何转换成"eye"的

A:

下面是一个基本转换表

--------------------------------------------------------------------------
a 4 @ 4 4 @ @ 4 4 4 or @ or /-\
b |3 b 8 8 B |3 8 8 8 or |3
c C c c k C ( < < (
d |) |) D d D |) D c| |)
e 3 3 3 3 3 3 3 3 3
f |>|-| f ph F F |[ F |= |= or pH
g 6 G g 9 6 6 6 6 9
h |-| |-| H |-| H |{ H |-| |-| or #
i 1 1 i 1 ! | 1 ][ or 1 1 or | or !
j _| j j j J _| J _] J
k |< |< k |< K |< [< |< |{ or |<
l |_ 1 1 1 1 |_ |- 1 or | or [ or |_ |_ or []_
m |\/| |\/| M /\/\ M |V| M |\/| |\/|
n |\| |\| n |\| N |\| N |\| |\| or /\/
o 0 o o 0 0 0 0 0 0
p |> p P p P |o P |> |>
q Q q Q q Q O, Q 0 Q
r |2 r R |2 R |)\ R |2 |2
s 5 5 s 5 5 5 $ 5 or Z 5
t 7 + + 7 7 7 7 7 or + + or 7
u |_| u u u U |_| U |_| |_| or \_/
v \/ v V \/ V \/ V \/ \/
w \/\/ \/\/ W \/\/ W |/\| W \/\/ \/\/
x >< >< X >< X X >< X
y `/ Y y '/ Y \/
| Y j or J or `/ Y
z Z z Z z 2 -\_ Z 5 Z
--------------------------------------------------------------------------

如果只进行字母到数字的转换,可以简化成

--------------------------------------------------------------------------
a -> 4
b -> 8
e -> 3
g -> 6
i -> 1
l -> 1
o -> 0
s -> 5
t -> 7
--------------------------------------------------------------------------

这里有一个转换页面,由于存在一对多的现象,转换结果可能并不完全相符

http://www.planetquake.com/turkey/l33translate.htm

比如"I'm a programmer",将被转换成"1'/\/\ 4 p|209|24/\/\/\/\3|2"

更多信息参看如下链接

http://www.cwru.edu/orgs/sigmataudelta/submissions/rome-relaxweunderstand.htm

D: dfbb@bbs.tsinghua.edu.cn

有个geekcode也差不多,http://www.geekcode.com/geek.html

1. 系统管理配置问题

1.0 如何屏蔽power-button

Q: 如何屏蔽Sun键盘右上角的power-button

A: Alan Coopersmith <alanc@csua.berkeley.edu> 2002年7月19日 22:12

1) 为了只允许root执行sys-suspend命令shutdown/suspend系统,可以编辑
   /etc/default/sys-suspend

2) 为了禁止通过power-button激活sys-suspend命令,编辑
   /usr/openwin/lib/speckeysd.map

1.1 如何给SUN工作站增加eeprom硬件口令保护

A: scz <scz@nsfocus.com>

man -s 1M eeprom了解细节,要求当前是root身份

# /usr/sbin/eeprom (显示当前eeprom配置)

# /usr/sbin/eeprom security-mode=full ( 可选的有command, full, none)

此时进入交互式设置口令过程,总共输入两次,如果两次口令输入不一致,则本次设
置作废。成功设置之后除了go命令之外的其他ok状态下命令均需要口令,包括boot命
令。

设置成command时,同样进入交互式口令输入过程。此时,除了boot和go命令之外的
其他ok状态下命令均需要口令。注意,如果仅仅输入boot命令,不需要口令,一旦
boot命令后面带了参数,比如boot cdrom -s,同样需要输入口令。

如果设置成none(缺省设置),表示去掉这种口令保护。

# /usr/sbin/eeprom security-password= (等号后面无其他字符,直接回车)

如果想改变前面设置的口令,用这条命令,同样是交互式输入过程。

# /usr/sbin/eeprom security-#badlogins=3 (缺省是0)

设置口令输入尝试次数。

警告:如果设置了eeprom硬件保护口令而又忘记,会带来很多麻烦,务必小心。

一个可行的设置办法是,安全模式设置到command而不是full,这样至少可以正常启
动系统。于是只要记得root口令或者还有其他机会获得root权限(缓冲区溢出?),就
可以通过设置安全模式为none而挽救回来。

但是如果设置成full模式却忘记了eeprom口令,我想首先应该打电话给SUN的技术支
持。如果出于某种理由你不想这样做,我不确认eeprom是否可以热插拔,先用一个无
口令保护的eeprom启动系统,然后热插拔换上那个有口令保护的eeprom,然后用root
权限抹去eeprom口令。

D: bluesfisher@smth.org

启动时Stop-N可以恢复OBP缺省设置,应该可以把这个密码去掉吧

按住Stop-N,加电,直到键盘灯闪

D: lose@smth.org 2002-03-22 01:45

试了一下Stop-N,不可以。

试了一下小四的办法是可以的,只是有几个小地方需要说一下。没有eeprom时机器是
无法启动的,所以必须要有另一块没有口令的eeprom。第一次为了热插拔方便没有将
新的eeprom插得很紧,启动之后报告IDPROM出错,不过没有关系,系统还是可以启动。
换上eeprom之后,只有console窗口可以运行,其它命令窗口无法运行命令。在
console下修改

# /usr/sbin/eeprom security-mode=none

reboot机器,一切OK。另外发现,只要你换上eeprom,都可以reboot机器而不需要口
令,重新启动之后再修改也可以,不知道这算不算一个bug。

1.2 如何增加交换空间

A: WT <wt@server.domain.top>

你无法改变分区大小,但是可以增加/删除交换文件,效果类似交换分区。下列命令
在根目录下创建一个500MB的交换文件,名为swapfile

# mkfile 500m /swapfile

下列命令将使之生效

# swap -a /swapfile

现在你有了额外的500MB交换空间,为了每次重启后依旧有效,编辑/etc/vfstab文件
增加如下行

/swapfile - - swap - no -

# swap -l

这里"-l"意味着"list",显示所有交换空间。仔细阅读"swap"和"mkfile"的手册页。

1.3 为什么我不能在/home目录下创建子目录

Q: Solaris 7下,root身份,当我试图在/home目录下创建子目录时,系统拒绝,为
   什么?

A: mohansundarraj

如果/etc/rc2.d/S74autofs脚本中automount(1M)守护进程已经mount了/home,就是
这种现象,而这还是缺省安装后的情形。可以

# /etc/init.d/autofs stop
# umount /home

然后你就可以用root身份在/home下创建子目录,增加文件了。为了永久取消autofs
特性,可以将/etc/rc2.d/S74autofs脚本改名,并注释掉/etc/auto_home、
/etc/auto_master两个文件中的入口点。

SPARC/Solaris的缺省用户主目录是/export/home,而不是/home。

1.4 如何改变一台主机的locale

Q: 一台SPARC/Solaris 8运行在US locale环境中,现在我们想让它运行在
   IE(Ireland) locale环境中,以便可以使用欧洲日期格式,怎么办?

A: Sharad Ramachandran <estancio@hotmail.com>

运行sys-unconfig,在此之前请man -s 1M sys-unconfig,:-)

A: chad schrock <chad@radix.net>

天啊,为了拍死一只苍蝇,你要引爆原子弹吗?

只需要做如下操作,在你的.cshrc/.profile/.bashrc等启动脚本中设置$LANG环境变
量的值为en_UK,注销,重新登录即可。为了使这个设置全局有效,修改
/etc/default/init文件,LANG=en_UK,重启动。

--------------------------------------------------------------------------
# @(#)init.dfl 1.2 92/11/26
#
# This file is /etc/default/init.  /etc/TIMEZONE is a symlink to this file.
# This file looks like a shell script, but it is not.  To maintain
# compatibility with old versions of /etc/TIMEZONE, some shell constructs
# (i.e., export commands) are allowed in this file, but are ignored.
#
# Lines of this file should be of the form VAR=value, where VAR is one of
# TZ, LANG, or any of the LC_* environment variables.
#
TZ=GMT+8
LANG=zh.GBK
--------------------------------------------------------------------------

参看locale(1)和locale(5),了解更多关于locale的信息。运行"locale -a",查看
当前系统所支持的所有locale。

A: Sun Microsystems 2001-06-12

有三种方式改变locale。首先用"locale -a"命令确认系统中已安装的locale

1) 从CDE登录屏幕上修改locale

选择 options -> languages -> choose the new locale

注意,如果登录用户的初始化文件中有不同的locale设置,将优先于系统全局locale
设置。

2) 临时设置locale(shell相关的)

ksh : LANG=<locale>
sh  : LANG=<locale>
      export LANG
csh : setenv LANG <locale>
bash: export LANG=en_US(zh.GBK)

3) vi /etc/default/init

增加如下内容

LANG=<locale>
LC_ALL=<locale>

重启系统。

运行"locale"命令确认改变生效。

如果你希望使用的locale并未安装,参看如下文档安装locale

Solaris 8  : <<International Language Environments Guide>>

Solaris 7  : <<Solaris Internationalization Guide For Developers>>

Solaris 2.6: <<Solaris Internationalization Guide for Developers>>

D: scz <scz@nsfocus.com> 1998-08

SPARC/Solaris 2.5下,为了在vi中正确看到中文需要设置环境变量

sh

LANG=C;export LANG
LC_CTYPE=iso_8859_1;export LC_CTYPE

csh

setenv LANG zh

关于设置LANG这个环境变量涉及到/usr/lib/locale下的目录权限。

1.5 Solaris 7自动注销

Q: 怎样设置才能30秒后自动注销

A: shridhara

不幸的是,Solaris对此没有什么好的支持。如果正在使用telnet会话,或许可以考
虑"logout"变量,参看telnet的手册页。一个变通的办法,使用K-Shell,它支持
TMOUT变量,用于指定非活动时限(以秒为单位)。比如,如果一个shell会话3分钟内
不活动,则终止这个shell会话

$ TMOUT=180;export TMOUT

可以在用户的.profile文件中放置该行。缺点是你只能使用ksh。

D: quack

Linux、Solaris 2.6上的Bash试了也行。

D: scz <scz@nsfocus.com>

vi /etc/default/login

# TIMEOUT sets the number of seconds (between 0 and 900) to wait before
# abandoning a login session.
#
TIMEOUT=180

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -