絕大多數的 UNIX 系統在 64-bit 下面採用 LP64 這種 data model,這時候 long 就不再是固定為 4 bytes 大小,而是變成 8 bytes 的大小了!
然而,Win64 卻不是使用 LP64,而是採用 LLP64 這個 data model,這時候 long 的大小仍然還是 4 bytes
Many 64-bit compilers today use the LP64 model (including Solaris, AIX, HP, Linux, Mac OS X, and IBM z/OS native compilers). Microsoft’s VC++ compiler uses the LLP64 model.
兩種 data model 的最大差異點就是 long 這個資料型態的大小,LP64 是 64-bit,而 LLP64 則是 32-bit
LLP64 data model 基本上可以說跟 32-bit 的系統一樣,唯一差別只有位址(pointer)改成了 64-bit 而已。資料物件(class, structure) 等如果沒有包含 pointer 的成員的話,整個物件的大小是與 32-bit 系統一樣的!
Following the previous notes about enabling core dump, here’s a note about changing the filename of core dump.
In Linux (since Linux 2.6 and 2.4.21)
you can change the core dump filename from the file /proc/sys/kernel/core_pattern
%% A single % character
%p PID of dumped process
%u real UID of dumped process
%g real GID of dumped process
%s number of signal causing dump
%t time of dump (seconds since 0:00h, 1 Jan 1970)
%h hostname (same as 'nodename' returned by uname(2))
%e executable filename
Linux have a default core filename pattern of “core”.
Alternatively, if /proc/sys/kernel/core_uses_pid contains a non-zero value, then the core dump file name will include a suffix .PID (process id), ex: core.PID
In FreeBSD, sysctl variable “kern.corefile” controls the filename of core dump.
Any sequence of %N in this filename template will be replaced by
the process name, %P by the processes PID, and %U by the UID.
FreeBSD have a default core filename pattern of “%N.core”
You can include path in the filename pattern both in Linux and FreeBSD.
This make it possible to put core dump file in a separated directory.
==> open file for write and delete it ...
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad8s1d 144520482 28011428 104947416 21% /home
==> write 100MB to file ...
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad8s1d 144520482 28111508 104847336 21% /home
==> close file ...
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad8s1d 144520482 28011428 104947416 21% /home