Tuesday Aug 28, 2007
Tuesday Aug 28, 2007
In my previous entry about BSD compatibility gap closure process I have promised to provide a guide on how to get new code into libc. I will use changes done via CR 6495220 to illustrate the process with examples.
Process related and technical changes which are usually needed:
$ nm -x /usr/lib/libc.so.1 | grep '|_\?err$' [5783] |0x00049c40|0x00000030|FUNC |GLOB |0 |13 |_err [6552] |0x00049c40|0x00000030|FUNC |WEAK |0 |13 |err
pvs -dsv -N SUNW_1.23 /usr/lib/libc.so.1 \
| sed -n '1,/SUNW.*:/p' | egrep '((v?errx?)|(v?warnx?));'
vwarnx;
...
If you're adding private (underscored) symbols do not forget to add them to the SUNWprivate section. This is usually the case because the strong symbols
are accompanied by weak symbols. Weak symbols go to the global part of the most recent
SUNW section and strong symbols go to global part of SUNWprivate section.
foo = FUNCTION FILTER libc.so.1;This was done with the *fp functions in libipsecutils' mapfile. The specialty in that case was that the *fp functions were renamed to underscored variants while moving them via redefines in errfp.h.
/builds/.../usr/include/err.h", line 43: warning: function argument declared inconsistently: warn(arg 1) in utils.c(62) char * and llib-lc:err.h(43) const char * (E_INCONS_ARG_DECL2)The problem with this output is that there are cca 23 files named utils.c in ONNV. CR 6585621 is waiting someone to provide remedy for that via adding -F flag to LINTFLAGS in $SRC/lib and $SRC/cmd.
[6583] | 301316| 37|FUNC |GLOB |0 |13 |_warnx [1925] | 320000| 96|FUNC |LOCL |0 |13 |_warnxThis can be usually solved by renaming the local variant.
tags:
bsd
libc
opensolaris
solaris
Linkage:
Technorati cosmos
Thursday Aug 23, 2007
I do not get to meet customers very often but I clearly remember the last time where I participated in a pseudo-technical session with a new customer. The engineers were keen on learning details about all features which make Solaris outstanding but they were also bewildered by the lack of common functions such as daemon() (see CR 4471189). Yes, there is a number of private implementations in various places in ONNV, however this is not very useful. Until recently, this was also the case of err/warn function family.
With the putback of CR 6495220 there are now the following functions living in libc:
void err(int, const char *, ...); void verr(int, const char *, va_list); void errx(int, const char *, ...); void verrx(int, const char *, va_list); void warn(const char *, ...); void vwarn(const char *, va_list); void warnx(const char *, ...); void vwarnx(const char *, va_list);
These functions were present in BSD systems for a long time (they've been in FreeBSD since 1994). The configure scripts of various pieces of software contain checks for presence and functionality of the err/warn functions in libc (and setting the HAVE_ERR_H define). For Solaris, those checks have now become enabled too.
The err(3C) man page covering these functions will be delivered in the same build as the changes, that is build 72.
The change is covered by PSARC 2006/662 architectural review and the stability level for all the functions is Committed
(see Architecture Process and Tools for more details on how this works).
Unfortunately, the case is still closed. Hopefully it will be opened soon.
Update 09-28-2007: the PSARC/2006/662 case is now open, including onepager document and e-mail discussion. Thanks to John Plocher, Darren Reed and Bill Sommerfeld.
As I prompted in the err/warn Heads-up there is now time to stop creating new private implementations and to look at purging duplicates (there are many of them, however not all can be gotten rid of in favour of err/warn from libc).
I will write about how to get code into libc in general from a more detailed perspective next time.
However, this does not mean there is nothing left to do in this area. Specifically, FreeBSD's err(3) contains functions err_set_exit(), err_set_file() and errc(), warnc(), verrc() and vwarnc(). These functions could be ported over too. Also, there is __progname or getprogname(3). Moreover, careful (code) reader has realized that err.c contains private implementations of functions with fp suffix. This function (sub)family could be made Committed too. So, there is still lot of work which could be done. Anyone is free to work on any of these. (see Jayakara Kini's blog entry on how to become OpenSolaris contributor if you're not already)
tags:
bsd
err
opensolaris
solaris
warn
Linkage:
Technorati cosmos