68kMLA Classic Interface

This is a version of the 68kMLA forums for viewing on your favorite old mac. Visitors on modern platforms may prefer the main site.

Click here to select a new forum.
libUTIL.a - A/UX library
Posted by: ChristTrekker on 2008-06-24 09:47:55
Does this source code exist anywhere besides Jagielski's hard drive?

Posted by: porter on 2008-06-24 10:14:57
What does it do?

ar -t libUTIL.a

extract each object file and use

"nm" to see what functions they provide.

Posted by: ChristTrekker on 2008-06-24 10:53:24
It's a collection of functions not supplied by the A/UX system, to make porting of apps easier.

Posted by: porter on 2008-06-24 11:16:42
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.

/* 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
Posted by: ChristTrekker on 2008-06-24 11:27:05
I wasn't sure what level of detail you were looking for.

$ 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
Posted by: porter on 2008-06-24 15:03:40
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.

Posted by: ChristTrekker on 2008-06-24 19:35:51
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.

Posted by: ChristTrekker on 2008-06-24 19:42:04
The two libraries I use on A/UX are libbsd.a and libposix.a.
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"?

Posted by: porter on 2008-06-24 20:09:29
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

#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.

Posted by: ChristTrekker on 2008-06-25 14:12:39
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!

Posted by: porter on 2008-06-25 14:49:28
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.

1