The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
libraries pil888 UNIX for Dummies Questions & Answers 0 08-29-2007 10:17 PM
v2 standard libraries cactuar HP-UX 0 08-10-2007 11:59 AM
Libraries netsavy IP Networking 1 08-21-2005 06:21 AM
Graphics libraries robotronic High Level Programming 1 05-08-2002 02:02 AM
shared libraries thalex High Level Programming 2 11-29-2001 06:32 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #8  
Old 07-08-2004
Registered User
 

Join Date: May 2004
Posts: 66
Driver, thank you so much for all your explanations. you make everything so easy to understand.
Reply With Quote
Forum Sponsor
  #9  
Old 07-08-2004
Registered User
 

Join Date: May 2004
Posts: 66
In following the above error, the following is noticed:

C library on Linux, specifically file /usr/include/sys/procfs.h has an incomplete struct of:

Code:
 

struct elf_prpsinfo

  {

    char pr_state;                      /* Numeric process state.  */

    char pr_sname;                      /* Char for pr_state.  */

    char pr_zomb;                       /* Zombie.  */

    char pr_nice;                       /* Nice val.  */

    unsigned long int pr_flag;          /* Flags.  */

    unsigned short int pr_uid;

    unsigned short int pr_gid;

    int pr_pid, pr_ppid, pr_pgrp, pr_sid;

    /* Lots missing */

    char pr_fname[16];                  /* Filename of executable.  */

    char pr_psargs[ELF_PRARGSZ];        /* Initial part of arg list.  */

  };

On Solaris, file /usr/indlue/sys/old_procfs.h has a complete stuct of:

Code:
 

typedef struct prpsinfo {

        char    pr_state;       /* numeric process state (see pr_sname) */

        char    pr_sname;       /* printable character representing pr_state */

        char    pr_zomb;        /* !=0: process terminated but not waited for */

        char    pr_nice;        /* nice for cpu usage */

        uint_t  pr_flag;        /* process flags */

        uid_t   pr_uid;         /* real user id */

        gid_t   pr_gid;         /* real group id */

        pid_t   pr_pid;         /* unique process id */

        pid_t   pr_ppid;        /* process id of parent */

        pid_t   pr_pgrp;        /* pid of process group leader */

        pid_t   pr_sid;         /* session id */

        caddr_t pr_addr;        /* physical address of process */

        size_t  pr_size;        /* size of process image in pages */

        size_t  pr_rssize;      /* resident set size in pages */

        caddr_t pr_wchan;       /* wait addr for sleeping process */

        timestruc_t pr_start;   /* process start time, sec+nsec since epoch */

        timestruc_t pr_time;    /* usr+sys cpu time for this process */

        int     pr_pri;         /* priority, high value is high priority */

        char    pr_oldpri;      /* pre-SVR4, low value is high priority */

        char    pr_cpu;         /* pre-SVR4, cpu usage for scheduling */

        o_dev_t pr_ottydev;     /* short tty device number */

        dev_t   pr_lttydev;     /* controlling tty device (PRNODEV if none) */

        char    pr_clname[PRCLSZ];      /* scheduling class name */

        char    pr_fname[PRFNSZ];       /* last component of execed pathname */

        char    pr_psargs[PRARGSZ];     /* initial characters of arg list */

        short   pr_syscall;     /* system call number (if in syscall) */

        short   pr_fill;

        timestruc_t pr_ctime;   /* usr+sys cpu time for reaped children */

        size_t  pr_bysize;      /* size of process image in bytes */

        size_t  pr_byrssize;    /* resident set size in bytes */

        int     pr_argc;        /* initial argument count */

        char    **pr_argv;      /* initial argument vector */

        char    **pr_envp;      /* initial environment vector */

        int     pr_wstat;       /* if zombie, the wait() status */

                        /* The following percent numbers are 16-bit binary */

                        /* fractions [0 .. 1] with the binary point to the */

                        /* right of the high-order bit (one == 0x8000) */

        ushort_t pr_pctcpu;     /* % of recent cpu time, one or all lwps */

        ushort_t pr_pctmem;     /* % of of system memory used by the process */

        uid_t   pr_euid;        /* effective user id */

        gid_t   pr_egid;        /* effective group id */

        id_t    pr_aslwpid;     /* lwp id of the aslwp; zero if no aslwp */

        char    pr_dmodel;      /* data model of the process */

        char    pr_pad[3];

        int     pr_filler[6];   /* for future expansion */

} prpsinfo_t;
My application needs to access the psinfo, how can i solve this problem? also, my application needs to be able to port across the two OS. I have no clue on how to do this. Any suggestions would be greatly appreciated. I'm trying to develop an app. to monitor cpu usage of active processes, if there's an easier way to do this in C please please direct me to it. I think i'm beating myself up with trying to use the library.

very frustrated!!
Reply With Quote
  #10  
Old 07-08-2004
Registered User
 

Join Date: May 2004
Posts: 66
By saying a structure is incomplete simply b/c it says so right in the middle of the struct:

Code:
struct elf_prpsinfo

  {

    char pr_state;                      /* Numeric process state.  */

    char pr_sname;                      /* Char for pr_state.  */

    char pr_zomb;                       /* Zombie.  */

    char pr_nice;                       /* Nice val.  */

    unsigned long int pr_flag;          /* Flags.  */

    unsigned short int pr_uid;

    unsigned short int pr_gid;

    int pr_pid, pr_ppid, pr_pgrp, pr_sid;

    /* Lots missing */

    char pr_fname[16];                  /* Filename of executable.  */

    char pr_psargs[ELF_PRARGSZ];        /* Initial part of arg list.  */

  };
In comparision to the equivalent struct of Solaris, there are many fields that supposed to be in this stuct.

i'll look into the top program as you suggested. however, i have already written a shell script to use top, but i wanted to further create a C app. Can i access top's functions in my app? i'll investigate on this. Again, thanks for your suggestion.
[b]
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux, solaris

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:33 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0