On Mar 9,  1:32pm, Jonathan Stowe wrote:
> On Sat, 2002-03-09 at 07:29, Ed Allen Smith wrote:
> >
> > 
> >         /usr/sbin/perl -I/usr/share/lib/perl5/5.6.0/IP30-R12000-irix 
>-I/usr/share/lib/perl5/5.6.0 /usr/share/lib/perl5/5.6.0/ExtUtils/xsubpp  -typemap 
>/usr/share/lib/perl5/5.6.0/ExtUtils/typemap Utmp.xs > Utmp.xsc && mv Utmp.xsc Utmp.c
> >         cc -n32 -mips4 -TARG:platform=ip30 -c  -D_BSD_TYPES -D_BSD_TIME -woff 
>1009,1110,1184 -DLANGUAGE_C -I/server/people/staff/easmith/include -DDEBUGGING 
>-r12000 -O3 -OPT:fast_sqrt=OFF:Olimit=0 -TENV:X=1 -LNO:opt=1:ou_further=3 
>-OPT:fold_unsafe_relops=OFF:div_split=OFF:IEEE_arithmetic=1:roundoff=0 -LNO:vintr=OFF 
>-OPT:got_call_conversion=OFF      -DVERSION=\"1.5\"  -DXS_VERSION=\"1.5\"  
>-I/usr/share/lib/perl5/5.6.0/IP30-R12000-irix/CORE  Utmp.c
> > cc-1020 cc: ERROR File = Utmp.xs, Line = 400
> >   The identifier "UT_HOSTSIZE" is undefined.
> > 
> >        static char ut_host[UT_HOSTSIZE];
> >                            ^
> > 
> > cc-1174 cc: WARNING File = Utmp.c, Line = 407
> >   The variable "self" was declared but never referenced.
> > 
> >         SV *    self = ST(0);
> >                 ^
> > 
> > cc-1552 cc: WARNING File = Utmp.xs, Line = 400
> >   The variable "ut_host" is set but never used.
> > 
> >        static char ut_host[UT_HOSTSIZE];
> >                    ^
> 
> Oof!,

Quite.

> is there any chance that you could send me your utmp.h (or the
> appropriate bits if it is large) so I can see what changes I need to
> make - unfortunately I don't have an Irix system to test this on :(

#include <sys/types.h>

#define UTMP_FILE       "/var/adm/utmp"
#define WTMP_FILE       "/var/adm/wtmp"
#define ut_name ut_user

/*
 * Pulled out of struct utmp
 */
#ifndef _EXIT_STATUS_
#define _EXIT_STATUS_
struct __exit_status {
    short __e_termination ;     /* Process termination status */
    short __e_exit ;            /* Process exit status */
};
#define exit_status     __exit_status
#define e_termination __e_termination
#define e_exit __e_exit
#endif

struct utmp
  {
        char ut_user[8] ;               /* User login name */
        char ut_id[4] ;                 /* /etc/inittab id(usually line #) */
        char ut_line[12] ;              /* device name (console, lnxx) */
        short ut_pid ;                  /* leave short for compatiblity - process id */
        short ut_type ;                 /* type of entry */
        struct __exit_status ut_exit ;  /* The exit status of a process
                                         * marked as DEAD_PROCESS.
                                         */
        time_t ut_time ;                /* time entry was made */
  } ;

/*      Definitions for ut_type                                         */

#define EMPTY           0
#define RUN_LVL         1
#define BOOT_TIME       2
#define OLD_TIME        3
#define NEW_TIME        4
#define INIT_PROCESS    5       /* Process spawned by "init" */
#define LOGIN_PROCESS   6       /* A "getty" process waiting for login */
#define USER_PROCESS    7       /* A user process */
#define DEAD_PROCESS    8
#define ACCOUNTING      9

#define UTMAXTYPE       ACCOUNTING      /* Largest legal value of ut_type */

/*      Special strings or formats used in the "ut_line" field when     */
/*      accounting for something other than a process.                  */
/*      No string for the ut_line field can be more than 11 chars +     */
/*      a NULL in length.                                               */

#define RUNLVL_MSG      "run-level %c"
#define BOOT_MSG        "system boot"
#define OTIME_MSG       "old time"
#define NTIME_MSG       "new time"

extern void endutent(void);
extern struct utmp *getutent(void);
extern struct utmp *getutid(const struct utmp *);
extern struct utmp *getutline(const struct utmp *);
extern struct utmp *pututline(const struct utmp *); 
extern void setutent(void);
extern int utmpname(const char *);

utmpx.h has the following, BTW:


#include <standards.h>
#include <sys/types.h>

/*
 * from sys/time.h
 */
#ifndef _TIMEVAL_T
#define _TIMEVAL_T
struct timeval {
#if _MIPS_SZLONG == 64
        __int32_t :32;
#endif
        time_t  tv_sec;         /* seconds */
        long    tv_usec;        /* and microseconds */
};

/*
 * Since SVID API explicitly gives timeval struct to contain longs ...
 * Thus need a second timeval struct for 64bit binaries to correctly
 * access specific files (ie. struct utmpx in utmpx.h).
 */
struct __irix5_timeval {
        __int32_t    tv_sec;         /* seconds */
        __int32_t    tv_usec;        /* and microseconds */
};
#endif /* _TIMEVAL_T */

#if _NO_XOPEN4
#include <utmp.h>

#define UTMPX_FILE      "/var/adm/utmpx"
#define WTMPX_FILE      "/var/adm/wtmpx"
#endif  /* _NO_XOPEN4 */

#define ut_name ut_user
#define ut_xtime ut_tv.tv_sec

#ifndef _EXIT_STATUS_
#define _EXIT_STATUS_
struct __exit_status {
    short __e_termination ;     /* Process termination status */
    short __e_exit ;            /* Process exit status */
};
#if _NO_XOPEN4
#define exit_status __exit_status
#define e_termination __e_termination
#define e_exit __e_exit
#endif
#endif

struct utmpx
  {
        char            ut_user[32];            /* user login name */
        char            ut_id[4];               /* inittab id */
        char            ut_line[32];            /* device name (console, lnxx) */
        pid_t           ut_pid;                 /* process id */
        short           ut_type;                /* type of entry */
        struct __exit_status ut_exit;           /* process termination/exit status */
#if (_MIPS_SZLONG == 64)
        struct __irix5_timeval  ut_tv;          /* time entry was made */
        __int32_t       ut_session;             /* session ID, used for windowing */
        __int32_t       ut_pad[5];              /* reserved for future use */
#else
        struct timeval  ut_tv;                  /* time entry was made */
        long            ut_session;             /* session ID, used for windowing */
        long            ut_pad[5];              /* reserved for future use */
#endif
        short           ut_syslen;              /* significant length of ut_host */
                                                /*   including terminating null */
        char            ut_host[257];           /* remote host name */
  } ;

/*      Definitions for ut_type                                         */

#define EMPTY           0
#define RUN_LVL         1
#define BOOT_TIME       2
#define OLD_TIME        3
#define NEW_TIME        4
#define INIT_PROCESS    5       /* Process spawned by "init" */
#define LOGIN_PROCESS   6       /* A "getty" process waiting for login */
#define USER_PROCESS    7       /* A user process */
#define DEAD_PROCESS    8
#if _ABIAPI || _SGIAPI
#define ACCOUNTING      9
#define UTMAXTYPE       ACCOUNTING      /* Largest legal value of ut_type */
#endif /* _ABIAPI || _SGIAPI */

#if _NO_XOPEN4
/*      Special strings or formats used in the "ut_line" field when     */
/*      accounting for something other than a process.                  */
/*      No string for the ut_line field can be more than                */
/*      31 chars + NULL in length.                                      */

#define RUNLVL_MSG      "run-level %c"
#define BOOT_MSG        "system boot"
#define OTIME_MSG       "old time"
#define NTIME_MSG       "new time"
#define MOD_WIN         10
#endif  /* _NO_XOPEN4 */

extern void endutxent(void);
extern struct utmpx *getutxent(void);
extern struct utmpx *getutxid(const struct utmpx *);
extern struct utmpx *getutxline(const struct utmpx *);
extern struct utmpx *pututxline(const struct utmpx *); 
extern void setutxent(void);

#if _NO_XOPEN4

extern int utmpxname(const char *);
extern struct utmpx *makeutx(const struct utmpx *);
extern struct utmpx *modutx(const struct utmpx *);
extern void getutmp(const struct utmpx *, struct utmp *);
extern void getutmpx(const struct utmp *, struct utmpx *);
extern void updwtmp(const char *, struct utmp *);
extern void updwtmpx(const char *, struct utmpx *);

#endif  /* _NO_XOPEN4 */

-- 
Allen Smith                     http://cesario.rutgers.edu/easmith/
September 11, 2001              A Day That Shall Live In Infamy II
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." - Benjamin Franklin

Reply via email to