2 solaris基础和常用知识( 六 )


/tmp , /tmp最多 500M即可 。然后在 / 上面建立/usr , /opt 和/export/home 。
现在补救的办法是利用软link的办法:首先将一些在/或/usr中不太是系统直接
使用的目录(一定不可以包含/usr/sbin,/sbin, /etc,等等)转移到有空间的分
区上面 , 然后使用ln建立软连接 。关于ln的使用可以man.这种办法是不得已而
为之 。不是很好把握 , 搞不好就会死机 , 并且启动不起来 。所以在进行此项活
动时 , 首先要备份数据 , 以免发生以上情况时丢失 。如果您在下午下班的时间
可以抽出一点时间 , 最好还是将系统重新安装一遍的好 。因为 , 每一个目录都
有一定的用意 , 一些软件的安装不是地方会让人感到很别扭 。而使用软连接又
会降低系统的运行速度 。

93 Q: 求助--请教一个多线程编程问题 。关于我们发现的问题具体现象如下:
函数 void* A(void *pInput)
{
char szBuf[30000]; //this buffer maybe larger than 30,000
...
...
}
在多线程程序中 , 该函数在main中运行(此时相当于在主线程中运行)正常 。
如果使用pthread_create创建一个线程 , 以A作为线程入口函数 , 用内存测试工
具purify可以观察到该线程运行过程中出现Beyond Stack Read、Beyond Stack
Write错误 。如果把szBuf改为堆中分配的内存 , 则无此问题 。据此 , 我们判断
是线程的栈空间溢出造成该问题 。按资料描述 , 主线程的缺省栈空间大小为8M
, 子线程缺省栈空间为2M;我们使用pthread_attr_setstack函数将子线程的栈
空间设置为8M , 但仍未解决问题 。后又将线程属 性设置为
PTHREAD_SCOPE_SYSTEM , 问题仍然存在 。函数A以静态库方式由第三方提供 ,
我们现需要使之在一个子线程中运行 , 因此希望能够提供主线程与子线程差异
的资料 , 除堆栈空间、调度方式外 , 是否还有其他差别 , 造成以上错误的发生
A: In fact, there is no problem in the program. I think there is a bug
in their debug tool: purify. You can use dbx to debug your program.

94 Q: 请问一块硬盘上可以有两个Solaris分区吗?在一块硬盘上分了两个solaris分
区 , 一个是active的系统安装分区 , 另一个是后来用fdisk创建的 , 请问怎样把
第二个分区加入到solaris系统中使用 。谢谢 。
A: Yes, There can be up to six partitions in a disk. you can see the
partition using utility format. Command list:
#format
Then you will see the disks installed in you system.then select the
disks you are interested in. then print "partition" and then "print"
to see the partition information. The partition you want to add to
the system can be identified as c#t#d#s#. Make sure the mount point(
a empty Directory in file system). such as /disk1.then run the
command:
#mount /dev/dsk/c#t#d#s# /disk1

run the command
#df -k
to verify the slice(partition) is properly installed.

95 Q: 请问在Solaris 2.7上,可以动态改变分区大小吗? 我的工作站划分分区不合理,
根分区太小,已经满了,可以使用工具动态改变吗?
A: No, If you want to modify it, the whole disk data will be lost.
In fact, I think it high time for you to re-instal the solaris
system. In the new installation. You really need just two partitions
swap and root. Leave no more than 1G to swap partition and all the
left to root.Don"t forget to backup all you data before re-installation.

96 Q: 用CC编译器如何实现结构成员按字节对齐 , 类似于其他编译器的#pragma pack(1)
功能 。
A: It is a standard compilation option(#pragma pack). It is also
supported in Solaris C.You can get documents about SC options from
http://sunlibray under workshop directory.

97 Q: 为什么SUN的本地界面有时候会出现死掉的情况 , 此时kill掉用户的dtsession

推荐阅读