Subject: Re: fstat derivations?
To: David Maxwell <david@fundy.ca>
From: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
List: tech-kern
Date: 11/29/1999 09:35:33
> Working on the m3 port, and we're running into warnings
> regarding compat_ functions. 
> 
> warning: reference to compatibility stat(); include <sys/stat.h> to
> generate correct reference

<sys/stat.h> contains the following:

int	stat __P((const char *, struct stat *))	__RENAME(__stat13);
int	fstat __P((int, struct stat *))		__RENAME(__fstat13);


<sys/cdefs.h> defines __RENAME as:

#ifdef __GNUC__
#define	__RENAME(x)	__asm__(___STRING(_C_LABEL(x)))
#else
...
#endif

you can run down the defiunitions of ___STRING() and _C_LABEL(), or
you can just run the code through cpp and look at the result..

int	stat (const char *, struct stat *) __asm__("__stat13");

this is a GNU C extension which means "for the language-visible function
"stat", use "__stat13" as the assembler/linker-visible symbol.

> Can someone tell me what the plan is for fstat, and the appropriate
> way to handle calls in the m3 compiler?

The m3 translation of <sys/stat.h> will have to arrange for the symbol
used in external linkage to differ from the language-visible name...
or you'll need a M3 stub which calls a C language routine in the M3
run time library which calls the C "stat" routine..

I don't know M3 very well so i'm not sure what's easier.

					- Bill