To promote compatibility with other operating systems, the uid_t and gid_t types have been changed from long (32-bit binaries) and int (64-bit binaries) to the uint32_t type. For more information about this feature, see uid_t and gid_t Type Changes in Solaris Express Developer Editicon What’s New.
The following are the consequences of these changes:
When code is recompiled, standard development practices should catch any problems that are caused by changes in the uid_t and gid_t type.
Problem areas to be aware of include the following:
1 #include <unistd.h> 2 #include <stdlib.h> 3 #include <stdio.h> 4 5 int 6 main(void) 7 { 8 uid_t negone = -1; 9 10 if (getuid() < 0) 11 exit(1); 12 13 (void) setreuid(negone, getuid()); 14 15 (void) printf("%ld\n", getuid()); 16 17 return (0); 18 } |
The following warning is generated by Sun's Studio 11 compiler:
"uid.c", line 8: warning: initializer does not fit or is out of range: -1" |
The following warnings are generated by Studio 11 lint:
((8) warning: constant truncated by assignment |
(8) warning: initializer will be sign-extended: -1 |
(10) warning: suspicious comparison of unsigned with 0: op "<" |
function argument ( number ) type inconsistent with format |
|
The following warnings are generated by gcc -Wall -Wextra:
uid.c:10: warning: comparison of unsigned expression < 0 is always false |
uid.c:15: warning: long int format, uid_t arg (arg 2) |
Newly-compiled C binaries can be intermingled with old objects and system objects. The size of the type has not changed.
The change in the uid_t and gid_t type results in different name mangling for C++ functions and objects.
As with C binaries, C++ binaries and libraries continue to function as before. The exception is when libraries contain interfaces that use uid_t and gid_t. In this instance, the libraries that contain these interfaces, and the applications that use these interfaces, would need to be recompiled at the same time.
Because the Solaris OS does not expose C++ interfaces of this nature, no incompatibilities with Solaris libraries are expected.