• Hello MLAers! We've re-enabled auto-approval for accounts. If you are still waiting on account approval, please check this thread for more information.

libUTIL.a - A/UX library

What does it do?

ar -t libUTIL.a

extract each object file and use

"nm" to see what functions they provide.

 
It's a collection of functions not supplied by the A/UX system, to make porting of apps easier.
That doesn't narrow it down much. I've generally found A/UX "complete" in terms of what a classic non-threaded UNIX box is supposed to provide.

It's not ANSI and is missing a ton of prototypes, this is my work-in-progress to allow gcc with "-Wall -Werror". I extend this based on the A/UX man pages.

Code:
/* Custom header for A/UX 3.1.1

must work with no other includes
*/

#ifdef __cplusplus
extern "C" {
#endif

struct timeval;
struct timezone;
struct sockaddr;
struct sigstack;
struct fd_set;
struct ether_addr;

int ether_hostton(char *,struct ether_addr *);
int vfork(void);
int bzero(char *,int);

int select(int,struct fd_set *,struct fd_set *,struct fd_set *,struct timeval *);
int recv(int,char *,int,int);
int send(int,const char *,int,int);
int accept(int,struct sockaddr *,int *);
int socketpair(int,int,int,int *);
int getsockname(int,struct sockaddr *,int *);
int getpeername(int,struct sockaddr *,int *);
int connect(int,struct sockaddr *,int);
int gethostname(char *,int);
int bind(int,struct sockaddr *,int);
int listen(int,int);
int socket(int,int,int);
int setsockopt(int,int,int,char *,int);
int getsockopt(int,int,int,char *,int*);
int sendto(int,char *,int,int,struct sockaddr *,int);
int recvfrom(int,const char *,int,int,struct sockaddr *,int *);
int ioctl(int,int,...);
int sigstack(struct sigstack*,struct sigstack *);
int slot_ether_addr(int,void *);
int gettimeofday(struct timeval *,struct timezone *);
int strcasecmp(const char *,const char *);
int shutdown(int,int);
int setgroups(int,int*);
void openlog(const char *,int,int);
void syslog(int,const char *,...);
void closelog(void);
int setlogmask(int);
int flock(int,int);
int ftruncate(int,int);
int getopt(int,char *const*,const char *);
extern char *optarg;
extern int optind, opterr;

#ifdef __cplusplus
}
#endif
 
I wasn't sure what level of detail you were looking for.

Code:
$ ar -t /opt/lib/gcc/aux/2.7.2/libUTIL.a
_emalloc.o
_malloc.o
_memalign.o
_strdup.o
_strsave.o
abs.o
atof.o
biglitpow.o
botch.o
colldata.o
ctype.o
div.o
doprnt.o
doscan.o
dtop.o
dumpheap.o
ecvt.o
emalloc.o
fdopen.o
flsbuf.o
fmod.o
fopen.o
fpos.o
fprintf.o
fseek.o
ftell.o
getcwd.o
getmem.o
getopt.o
getpagesize.o
getpriority.o
leak.o
locale.o
ltostr.o
malloc.o
mbstowcs.o
mbtowc.o
memalign.o
memmove.o
printf.o
ptod.o
raise.o
regex.o
scanf.o
setenv.o
setlinebuf.o
setopts.o
setpriority.o
snprintf.o
sprintf.o
sptree.o
stats.o
strdup.o
strerror.o
strftime.o
strmode.o
strndup.o
strpbrk.o
strsave.o
strsep.o
strtod.o
strtol.o
strtoul.o
strxfrm.o
sysexits.o
syslog.o
ungetc.o
verify.o
vfork.o
vfprintf.o
vprintf.o
vsprintf.o
wcstombs.o
wctomb.o
 
The two libraries I use on A/UX are libbsd.a and libposix.a.

There is alot of duplication in what you listed with what A/UX libc.a (or is it libc_s) already provide. Eg, the fopen/fread/malloc.

For snprintf and memmove one should have a general strategy for when these are not provided, eg SunOS 4.1 does not have these.

You can't really provide vfork if the OS does not provide it, the classic approach is to simply use fork.

The biggest thing missing is A/UX does not have mmap, hence demand loadable shared libraries are not possible.

 
There is some duplication with libc ... various sources state the A/UX version is broken or deficient in some way, and the libUTIL versions are improvements.

 
Would you say that as a general rule it's good practice to compile everything -lbsd -lposix, then? Kind of "when in doubt, link it"?
I do, because my "portable standard" is posix. If the platform is missing something then I use a work around or provide the function.

eg

Code:
#ifdef HAVE_SNPRINTF
snprintf(buf,sizeof(buf),"...."
#else
sprintf(buf,".....
#endif
What are the broken things in A/UX?

Admittedly because A/UX applications are generally is statically linked you don't have to worry about compatibility with 3rd party shared libraries over time.

There is nothing to stop you getting the glibc source and compiling a static c library from that.

 
What are the broken things in A/UX?
I don't recall off the top of my head. Maybe it wasn't so much broken as missing (memmove, etc). I can't find any references to broken implementations now that I look for them...

BTW, sounds like you've done a fair amount of A/UX coding!

 
BTW, sounds like you've done a fair amount of A/UX coding!
I have a large project that A/UX (along with many others) is one of the components of the "obstacle course" I put each version through. The good thing is making something highly portable reveals lurking bugs.

 
Back
Top