[OpenAFS] fstat vs stat in 1.3.82

Tony D'Amato tdamato@odu.edu
Fri, 10 Jun 2005 11:22:54 -0400


> Date: Fri, 10 Jun 2005 10:29:08 -0400 (EDT)
> From: Derrick J Brashear <shadow@dementia.org>
> To: "Tony D'Amato" <tony@lions.odu.edu>
> Cc: openafs-info@openafs.org
> Subject: Re: [OpenAFS] fstat vs stat in 1.3.82
> 
> On Fri, 10 Jun 2005, Tony D'Amato wrote:
> 
> > I'm compiling OpenAFS 1.3.82 on SGI IRIX 6.5.22 using the SGI MIPSpro
> > 7.3.1.3m compilers, and I've run into a few syntax errors. Here's a
> > small part of one of them - I replaced fstat with stat in a couple of
> > modules because the compiler complained. Here's the patch.
> 
> Uh. I don't believe you don't have fstat. What was the actual complaint?

I'm sorry, but perhaps I wasn't clear in my original email. It wasn't
that IRIX doesn't have fstat, it's that the compiler complained about
the usage:

---begin log--- 
cc-1164 cc: ERROR File = ./serverLog.c, Line = 244
  Argument of type "const char *" is incompatible with parameter of type "int".

      if ((fstat(fileName, &statbuf) == 0)  && (S_ISFIFO(statbuf.st_mode))) {
                 ^

cc-1164 cc: ERROR File = ./serverLog.c, Line = 317
  Argument of type "const char *" is incompatible with parameter of type "int".

      if ((fstat(fileName, &statbuf) == 0)  && (S_ISFIFO(statbuf.st_mode))) {
                 ^

2 errors detected in the compilation of "./serverLog.c".
---end log---

According to the IRIX man page for fstat, the first argument of fstat
needs to be an 'int', whereas stat's first argument is a 'char *', which
is how it's being used in this procedure.

> 
> > I've got some other patches which I made to allow OpenAFS to compile
> > under IRIX - where's a good place to send these?
> 
> openafs-bugs@openafs.org
> 
> But if they're all like this, well, we'd rather have patches to fix the 
> real problem.
> 

Okay, that's fine. Most of the patches are casts (the MIPSpro compilers
seem to be notorious about making sure casts are being used and complain
if they are not). However, one of the patches is something like this
one, which fixes a finger check in afs_vnop_rename.c:

--- openafs-1.3.80/src/afs/VNOPS/afs_vnop_rename.c.orig 2005-01-30 22:49:15.000000000 -0500
+++ openafs-1.3.80/src/afs/VNOPS/afs_vnop_rename.c
@@ -360,7 +360,7 @@ afsrename(struct vcache *aodp, char *ana

 int
 #if defined(AFS_SGI_ENV)
-afs_rename(OSI_VC_DECL(aodp), char *aname1, struct vcache *andp, achar *name2, struct pathname *npnp, struct AFS_UCRED *acred)
+afs_rename(OSI_VC_DECL(aodp), char *aname1, struct vcache *andp, char *aname2, struct pathname *npnp, struct AFS_UCRED *acred)
 #else
 afs_rename(OSI_VC_DECL(aodp), char *aname1, struct vcache *andp, char *aname2, struct AFS_UCRED *acred)
 #endif

Just thought I'd help...

-- 
Tony D'Amato
Senior UNIX Systems Administrator
Office of Computing and Communcations Services