http://huenlil.pixnet.net/blog/post/23801824-%5B%E8%BD%89%5Dandroid-jni%E5%AF%A6%E4%BE%8B
http://3sec.kilab.tw/?p=244
2013年4月2日 星期二
GCC #error
#error 強迫compiler停止compile,主要是用來除錯用的。與ifdef並用,可以讓程式在某些define
錯誤狀況下中止
語法是
#error 錯誤訊息
當程式遇到#error,錯誤訊息會在console端顯示出來,一般會和其他compiler所定義的訊息
一起顯示出來。
錯誤狀況下中止
語法是
#error 錯誤訊息
當程式遇到#error,錯誤訊息會在console端顯示出來,一般會和其他compiler所定義的訊息
一起顯示出來。
找不到struct ucred
http://linux.die.net/man/7/unix
Ancillary Messages
SCM_CREDENTIALS
Send or receive UNIX credentials. This can be used for authentication. The credentials are passed as a struct ucred ancillary
message. Thus structure is defined in as follows:
struct ucred {
pid_t pid; /* process ID of the sending process */
uid_t uid; /* user ID of the sending process */
gid_t gid; /* group ID of the sending process */
};
Since glibc 2.8, the _GNU_SOURCE feature test macro must be defined (before including any header files) in order to obtain the
definition of this structure.
The credentials which the sender specifies are checked by the kernel. A process with effective user ID 0 is allowed to specify values
that do not match its own. The sender must specify its own process ID (unless it has the capability CAP_SYS_ADMIN), its user
ID, effective user ID, or saved set-user-ID (unless it has CAP_SETUID), and its group ID, effective group ID, or saved
set-group-ID (unless it has CAP_SETGID). To receive a struct ucred message the SO_PASSCRED option must be enabled on the socket.
Ancillary Messages
SCM_CREDENTIALS
Send or receive UNIX credentials. This can be used for authentication. The credentials are passed as a struct ucred ancillary
message. Thus structure is defined in
struct ucred {
pid_t pid; /* process ID of the sending process */
uid_t uid; /* user ID of the sending process */
gid_t gid; /* group ID of the sending process */
};
Since glibc 2.8, the _GNU_SOURCE feature test macro must be defined (before including any header files) in order to obtain the
definition of this structure.
The credentials which the sender specifies are checked by the kernel. A process with effective user ID 0 is allowed to specify values
that do not match its own. The sender must specify its own process ID (unless it has the capability CAP_SYS_ADMIN), its user
ID, effective user ID, or saved set-user-ID (unless it has CAP_SETUID), and its group ID, effective group ID, or saved
set-group-ID (unless it has CAP_SETGID). To receive a struct ucred message the SO_PASSCRED option must be enabled on the socket.
2013年3月31日 星期日
學習Makefile(1)
http://tetralet.luna.com.tw/?op=ViewArticle&articleId=185
問題:(timing of interpreting symobol)
"注意到,make 會將整個 Makefile 展開後,再決定變數的值。也就是說,變數的值將會是整個 Mackfile 中最後被指定的值。例:
x = foo
y = $(x) bar
x = xyz
# y 的值為 xyz bar
在上例中,y 的值將會是 xyz bar,而不是 foo bar。"
對策:
"您可以利用 := 來避開這個問題。:= 表示變數的值決定於它在 Makefile 中的位置,而不是整個 Makefile 展開後最終的值。
x := foo
y := $(x) bar
x := xyz
# y 的值為 foo bar
在上例中,y 的值將會是 foo bar,而不是 xyz bar 了。"
參考:
http://lxr.linux.no/#linux+v3.8.5/scripts/Makefile.build
...
PHONY := __build
__build:
# Init all relevant variables used in kbuild files so
# 1) they have correct type
# 2) they do not inherit any value from the environment
obj-y :=
obj-m :=
lib-y :=
lib-m :=
always :=
...
"注意到,make 會將整個 Makefile 展開後,再決定變數的值。也就是說,變數的值將會是整個 Mackfile 中最後被指定的值。例:
x = foo
y = $(x) bar
x = xyz
# y 的值為 xyz bar
在上例中,y 的值將會是 xyz bar,而不是 foo bar。"
對策:
"您可以利用 := 來避開這個問題。:= 表示變數的值決定於它在 Makefile 中的位置,而不是整個 Makefile 展開後最終的值。
x := foo
y := $(x) bar
x := xyz
# y 的值為 foo bar
在上例中,y 的值將會是 foo bar,而不是 xyz bar 了。"
參考:
http://lxr.linux.no/#linux+v3.8.5/scripts/Makefile.build
...
PHONY := __build
__build:
# Init all relevant variables used in kbuild files so
# 1) they have correct type
# 2) they do not inherit any value from the environment
obj-y :=
obj-m :=
lib-y :=
lib-m :=
always :=
...
2013年3月21日 星期四
2013年3月14日 星期四
訂閱:
意見 (Atom)