Androids Ndk Does Not Have Sun_len Macro
today I faced trouble - android's ndk does not have SUN_LEN macro (sys/un.h || linux/un.h ), I don't want to patch android's headers, what is better to do?
Solution 1:
Don't patch the headers, define it in your own file.
#ifndef SUN_LEN //In case they fix it down the road#define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) + strlen((ptr)->sun_path))#endif
Solution 2:
SUN_LEN macro is a non-portable (aka not a part of POSIX standard) extension.
It is completely safe to use sizeof(struct sockaddr_un)
instead.
Post a Comment for "Androids Ndk Does Not Have Sun_len Macro"