public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/14175] New: I can compile this routine on Solaris 2.5 or newer, but not on Linux (Suse 9.0)
@ 2004-02-17 13:33 lapo at erdw dot ethz dot ch
  2004-02-17 16:10 ` [Bug c/14175] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: lapo at erdw dot ethz dot ch @ 2004-02-17 13:33 UTC (permalink / raw)
  To: gcc-bugs

Compilation errors (some variables are undeclared, others are multiply
declared)
seem to arise from differences between header files in
Unix and Linux.
in particular, header files sys/filio.h and sys/ttold.h are present on
Sun but do not exist on Linux machines.

the source code of the routine follows:
/* Updated for Solaris 2.4, SPARCompiler 3.0.1; October 19, 1995,
   Erik Larson */

#include <sys/types.h>
/* #include <rmt.h> */  /* omit this line if remote tape access library not
installed*/
#include <sys/stat.h>
#include <sys/times.h>
#include <sys/ioctl.h>
#include <sys/mtio.h>
#include <sys/file.h>
#include <sys/filio.h>
#include <sys/fcntl.h>
#include <dirent.h>
#include <sys/ttold.h>
#include <stdio.h>
#include <unistd.h>

struct sgttyb   pack;
struct stat     buf;

clockf_(ichan,iopt,isize,ires,ierrno)
        long *ichan, *iopt, *isize, *ires, *ierrno;
{       extern int errno, lockf();
        int kopt;
        kopt = (int) (*iopt);

        switch (kopt) {
        case 0:
                kopt = F_ULOCK;
                break;
        case 1:
                kopt = F_LOCK;
                break;
        case 2:
                kopt = F_TLOCK;
                break;
        case 3:
                kopt = F_TEST;
                break;
        default:
                fprintf(stderr, "lockf: unknown option %d", *iopt);
                exit(2);
                break;
        }


        errno=0;
        *ires = (long) lockf((int)(*ichan), kopt, *isize);
        *ierrno = (long) errno;
}

cermes_(ierrno,mess,lmess)
        char *mess;
        long *ierrno, *lmess;
{       extern int sys_nerr;
        extern char *sys_errlist[];
        char *cp, *mp;
        int lm;
        if(*ierrno >= 0 & *ierrno < sys_nerr)
          {for (lm=0, mp=mess, cp=sys_errlist[*ierrno];*cp;mp++, cp++)
             {*mp=*cp;lm++;}
           *lmess=(long)lm;
          }


        else
          *lmess=-1;
}


copendir_(name,ichan)
        char *name;
        long *ichan;
{       extern DIR *opendir();
        *ichan=(long) opendir(name);
}

cclosedir_(ichan)
        long *ichan;
{       closedir( (DIR *)(*ichan) );
}


creaddir_(ichan,name,lname,idno)
        char  *name;
        long  *ichan, *lname, *idno;
{
        short i, l;
        struct dirent *dptr;
        char *nn;
        if(dptr = readdir((DIR *)(*ichan)))
          {l=dptr->d_reclen;
           *lname= (long) l;
           *idno=(long) dptr->d_ino;
           for (i=0, nn=name; i < l; i++, nn++)
             *nn=dptr->d_name[i];
          }
        else
          {*lname=0;
           *idno=-1;
          }
}

creadlink_(path, pbuf, pnbyt, ires, ierrno)
        char           *pbuf, *path;
        long           *pnbyt, *ires, *ierrno;
{
        extern int      errno, readlink();
        errno = 0;
        *ires = (long) readlink(path , pbuf, (int) (*pnbyt));
        *ierrno = (long) errno;
}

cgterr_(ierrno)
        long *ierrno;
{       extern int errno;
        *ierrno=(long)errno;
}

cmkdir_(pname,mode,ires,ierrno)
        long *ires,*ierrno,*mode;
        char *pname;
{

        extern int errno, mkdir();
        errno=0;
        *ires=(long) mkdir(pname,(int)(*mode));
        *ierrno=(long)errno;
}

cutimes_(pname, times, ires, ierrno)
        long *ires, *ierrno;
        long *times;
        char *pname;
{
        extern int errno, utimes();
        errno=0;
        *ires= (long) utimes( pname,times);
        *ierrno=(long)errno;
}



cflush_(ichan, inout, ires, ierrno)
        long    *ichan, *inout, *ires, *ierrno;
{
        extern int errno;
        int arg;
        errno=0;
        arg=(int)(*inout);
        *ires=(long) ioctl((int)(*ichan),TIOCFLUSH,&arg);
        *ierrno=(long) errno;
}


cstdtr_(ichan, ires, ierrno)
        long    *ichan, *ires, *ierrno;
{
        extern int errno;
        errno=0;
        *ires=(long) ioctl((int)(*ichan),TIOCSDTR,0);
        *ierrno=(long) errno;
}


ccldtr_(ichan, ires, ierrno)
        long    *ichan, *ires, *ierrno;
{
        extern int errno;
        errno=0;
        *ires=(long) ioctl((int)(*ichan),TIOCCDTR,0);
        *ierrno=(long) errno;
}


cgtlmw_(ichan, iword, ires, ierrno)
        long    *ichan, *iword, *ires, *ierrno;
{
        extern int errno;
        int word;
        errno=0;
        *ires=(long) ioctl((int)(*ichan),TIOCLGET,&word);
        *iword=(long) word;
        *ierrno=(long) errno;
}


cstlmw_(ichan, iword, ires, ierrno)
        long    *ichan, *iword, *ires, *ierrno;
{
        extern int errno;
        int word;
        errno=0;
        word=*iword;
        *ires=(long) ioctl((int)(*ichan),TIOCLSET,&word);
        *ierrno=(long) errno;
}


cgtflag_(ichan, iflag, ires, ierrno)
        long           *ichan, *iflag, *ires, *ierrno;
{
        extern int      errno;
        errno = 0;
        *ires = (long) ioctl((int) (*ichan), TIOCGETP, &pack);
        *ierrno = (long) errno;
        *iflag = (long) pack.sg_flags;
}

cstflag_(ichan, iflag, speed, ires, ierrno)
        long           *ichan, *iflag, *speed, *ires, *ierrno;
{
        extern int      errno;
        errno = 0;
        pack.sg_flags = (int) (*iflag);
        pack.sg_ispeed=(char) (*speed);
        pack.sg_ospeed=(char) (*speed);
        *ires = (long) ioctl((int) (*ichan), TIOCSETP, &pack);
        *ierrno = (long) errno;
}

cstexc_(ichan, ires, ierrno)
        long           *ichan, *ires, *ierrno;
{
        extern int      errno;
        char           *dummy;
        errno = 0;
        *ires = (long) ioctl((int) (*ichan), TIOCEXCL, dummy);
        *ierrno = (long) errno;
}

cnoblock_(ichan, iopt, ires, ierrno)
        long           *ichan, *iopt, *ires, *ierrno;
{
        extern int      errno;
        int             tiopt;
        tiopt = (int) (*iopt);
        errno = 0;
        *ires = (long) ioctl((int) (*ichan), FIONBIO, &tiopt);
        *ierrno = (long) errno;
}


copen_(pname, ichan, iopt, ierrno, inew, mode)
        char           *pname;
        long           *ichan, *iopt, *ierrno, *inew, *mode;
{
        extern int      errno;
        extern int      open();
        int             kopt, knew;
        kopt = (int) (*iopt);
        knew = (int) (*inew);
        switch (kopt) {
        case 0:
                kopt = O_RDONLY;
                break;
        case 1:
                kopt = O_WRONLY;
                break;
        case 2:
                kopt = O_RDWR;
                break;
        case 8:
                kopt = O_APPEND;
                break;
        default:
                fprintf(stderr, "copen: unknown option %d", *iopt);
                exit(2);
                break;
        }
        switch (knew) {
        case 0:
                break;
        case 1:
                kopt = kopt | O_EXCL | O_CREAT;
                break;
        case 2:
                kopt = kopt | O_TRUNC | O_CREAT;
                break;
        default:
                fprintf(stderr, "copen: unknown status %d", *inew);
                exit(2);
                break;
        }
        errno = 0;
        *ichan = (long) open(pname, kopt);
        *ierrno = (long) errno;
}

cclose_(ichan, ires, ierrno)
        long           *ichan, *ires, *ierrno;
{
        extern int      errno;
        extern int      close();
        errno = 0;
        *ires = (long) close((int) (*ichan));
        *ierrno = (long) errno;
}

cread_(ichan, pbuf, pnbyt, ires, ierrno)
        char           *pbuf;
        long           *ichan, *pnbyt, *ires, *ierrno;
{
        extern int      errno, read();
        errno = 0;
        *ires = (long) read((int) (*ichan), pbuf, (int) (*pnbyt));
        *ierrno = (long) errno;
}

cwrite_(ichan, pbuf, pnbyt, ires, ierrno)
        char           *pbuf;
        long           *ichan, *pnbyt, *ires, *ierrno;
{
        extern int      errno, write();
        errno = 0;
        *ires = (long) write((int) (*ichan), pbuf, (int) (*pnbyt));
        *ierrno = (long) errno;
}

clseek_(ichan, offst, iopt, ires, ierrno)
        long           *ichan, *offst, *iopt, *ires, *ierrno;
{
        extern int      errno;
        int             kopt;
        kopt = (int) (*iopt);
        switch (kopt) {
        case 0:
                kopt = SEEK_SET;
                break;
        case 1:
                kopt = SEEK_CUR;
                break;
        case 2:
                kopt = SEEK_END;
                break;
        default:
                fprintf(stderr, "clseek: unknown optiion %d", *iopt);
                exit(2);
                break;
        }
        errno = 0;
        *ires = (long) lseek((int) (*ichan), (*offst), kopt);
        *ierrno = (long) errno;
}

cmtio_(ichan, iop, icnt, ires, ierrno)
        long           *ichan, *iop, *icnt, *ires, *ierrno;
{
        extern int      errno;
        int             kopt;
        struct mtop     magop;
        kopt = (int) (*iop);
        switch (kopt) {
        case 0:
                kopt = MTWEOF;
                break;
        case 1:
                kopt = MTFSF;
                break;
        case 2:
                kopt = MTBSF;
                break;
        case 3:
                kopt = MTFSR;
                break;
        case 4:
                kopt = MTBSR;
                break;
        case 5:
                kopt = MTREW;
                break;
        case 6:
                kopt = MTOFFL;
                break;
        case 7:
                kopt = MTNOP;
                break;
        default:
                fprintf(stderr, "cmtio: unknown optiion %d", *iop);
                exit(2);
                break;
        }
        magop.mt_op = kopt;
        magop.mt_count = (long) (*icnt);
        errno = 0;
        *ires = (long) ioctl((int) (*ichan), MTIOCTOP, &magop);
        *ierrno = (long) errno;
}


cperror_(s)
        char           *s;
{
        perror(s);
}

csleep_(psec)
        long           *psec;
{
        int             idum;
        idum = sleep((unsigned) (*psec));
}
/* This has been disabled */
cusleep_(psec)
        long           *psec;
{
        int             idum;
        /* idum = usleep((unsigned) (*psec)); */
}

cfstat_(ichan, size, istat, ierrno)
        long           *ichan, *size, *istat, *ierrno;
{
        extern int      errno;
        extern int      fstat();
        int             dummy;
        errno = 0;
        /* printf("calling fstat in c\n"); */
        dummy = fstat((int) (*ichan), &buf);
        /* printf("fstat through in c\n"); */
        *ierrno = (long) errno;
        *size = (long) (buf.st_size);
        *istat = (long) (buf.st_mode);
}

cstat_(file, size, block, istat, timea, timem, ierrno)
        char           *file;
        long           *size, *block, *istat, *timea, *timem, *ierrno;
{
        extern int      errno;
        extern int      stat();
        int             dummy;
        errno = 0;
        dummy = stat(file, &buf);
        *ierrno = (long) errno;
        *size = (long) (buf.st_size);
        *istat = (long) (buf.st_mode);
        *block= buf.st_blksize;
        *timea=(long) buf.st_atime;
        *timem=(long) buf.st_mtime;
}

ctrun_(ichan, leng, ierrno)
        long           *ichan, *leng, *ierrno;
{
        extern int      errno, ftruncate();
        int             dummy;
        errno = 0;
        dummy = ftruncate((int) (*ichan), (unsigned long) (*leng));
        *ierrno = (long) errno;
}


cgetpid_(ires,ierrno)
        long   *ires,*ierrno;
{
        extern int errno;
        errno = 0;
        *ires=(long)getpid();
        *ierrno = (long) errno;
}

cgetppid_(ires,ierrno)
        long   *ires,*ierrno;
{
        extern int errno;
        errno = 0;
        *ires=(long)getppid();
        *ierrno = (long) errno;
}


/* this used to be called creadlink - i don't think its used anywhere */
creadlinkg_(path, file, namlen, ierrno)
        char            *path, *file;
        int             *namlen, *ierrno;
{
        extern int      errno, readlink();
        int             dummy;
        errno = 0;
        dummy = readlink(path, file, namlen);
        if (dummy = -1) { *ierrno = errno; };
        if (dummy!= -1) { *ierrno = dummy; };
}

-- 
           Summary: I can compile this routine on Solaris 2.5 or newer, but
                    not on Linux (Suse 9.0)
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lapo at erdw dot ethz dot ch
                CC: gcc-bugs at gcc dot gnu dot org,lapo at erdw dot ethz
                    dot ch


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14175


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c/14175] I can compile this routine on Solaris 2.5 or newer, but not on Linux (Suse 9.0)
  2004-02-17 13:33 [Bug c/14175] New: I can compile this routine on Solaris 2.5 or newer, but not on Linux (Suse 9.0) lapo at erdw dot ethz dot ch
@ 2004-02-17 16:10 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-17 16:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-17 16:09 -------
Not a GCC bug, report it to glibc if you really think this is an error with your "GNU/Linux" headers.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14175


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-02-17 16:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-17 13:33 [Bug c/14175] New: I can compile this routine on Solaris 2.5 or newer, but not on Linux (Suse 9.0) lapo at erdw dot ethz dot ch
2004-02-17 16:10 ` [Bug c/14175] " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).