/[hurd]/hurd/proc/info.c
ViewVC logotype

Diff of /hurd/proc/info.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.43 by roland, Sat Dec 22 21:00:25 2001 UTC revision 1.44 by roland, Wed May 8 09:24:49 2002 UTC
# Line 1  Line 1 
1  /* Process information queries  /* Process information queries
2     Copyright (C) 1992,93,94,95,96,99,2000,01 Free Software Foundation, Inc.     Copyright (C) 1992,93,94,95,96,99,2000,01,02 Free Software Foundation, Inc.
3    
4  This file is part of the GNU Hurd.  This file is part of the GNU Hurd.
5    
# Line 165  get_string (task_t t, Line 165  get_string (task_t t,
165    
166    vm_address_t readaddr;    vm_address_t readaddr;
167    vm_address_t data;    vm_address_t data;
168    u_int readlen;    size_t readlen;
169    error_t err;    error_t err;
170    char *c;    char *c;
171    
# Line 261  static error_t Line 261  static error_t
261  get_string_array (task_t t,  get_string_array (task_t t,
262                    vm_address_t loc,                    vm_address_t loc,
263                    vm_address_t *buf,                    vm_address_t *buf,
264                    u_int *buflen)                    size_t *buflen)
265  {  {
266    char *bp;    char *bp;
267    int *vector, *vp;    int *vector, *vp;
# Line 334  kern_return_t Line 334  kern_return_t
334  S_proc_getprocargs (struct proc *callerp,  S_proc_getprocargs (struct proc *callerp,
335                    pid_t pid,                    pid_t pid,
336                    char **buf,                    char **buf,
337                    u_int *buflen)                    size_t *buflen)
338  {  {
339    struct proc *p = pid_find (pid);    struct proc *p = pid_find (pid);
340    
# Line 351  kern_return_t Line 351  kern_return_t
351  S_proc_getprocenv (struct proc *callerp,  S_proc_getprocenv (struct proc *callerp,
352                   pid_t pid,                   pid_t pid,
353                   char **buf,                   char **buf,
354                   u_int *buflen)                   size_t *buflen)
355  {  {
356    struct proc *p = pid_find (pid);    struct proc *p = pid_find (pid);
357    
# Line 373  S_proc_getprocinfo (struct proc *callerp Line 373  S_proc_getprocinfo (struct proc *callerp
373                      pid_t pid,                      pid_t pid,
374                      int *flags,                      int *flags,
375                      int **piarray,                      int **piarray,
376                      u_int *piarraylen,                      size_t *piarraylen,
377                      char **waits, mach_msg_type_number_t *waits_len)                      char **waits, mach_msg_type_number_t *waits_len)
378  {  {
379    struct proc *p = pid_find (pid);    struct proc *p = pid_find (pid);
380    struct procinfo *pi;    struct procinfo *pi;
381    int nthreads;    size_t nthreads;
382    thread_t *thds;    thread_t *thds;
383    error_t err = 0;    error_t err = 0;
384    size_t structsize;    size_t structsize;
# Line 386  S_proc_getprocinfo (struct proc *callerp Line 386  S_proc_getprocinfo (struct proc *callerp
386    int pi_alloced = 0, waits_alloced = 0;    int pi_alloced = 0, waits_alloced = 0;
387    /* The amount of WAITS we've filled in so far.  */    /* The amount of WAITS we've filled in so far.  */
388    mach_msg_type_number_t waits_used = 0;    mach_msg_type_number_t waits_used = 0;
389    u_int tkcount, thcount;    size_t tkcount, thcount;
390    struct proc *tp;    struct proc *tp;
391    task_t task;                  /* P's task port.  */    task_t task;                  /* P's task port.  */
392    mach_port_t msgport;          /* P's msgport, or MACH_PORT_NULL if none.  */    mach_port_t msgport;          /* P's msgport, or MACH_PORT_NULL if none.  */
# Line 470  S_proc_getprocinfo (struct proc *callerp Line 470  S_proc_getprocinfo (struct proc *callerp
470    if (*flags & PI_FETCH_TASKINFO)    if (*flags & PI_FETCH_TASKINFO)
471      {      {
472        tkcount = TASK_BASIC_INFO_COUNT;        tkcount = TASK_BASIC_INFO_COUNT;
473        err = task_info (task, TASK_BASIC_INFO, (int *)&pi->taskinfo, &tkcount);        err = task_info (task, TASK_BASIC_INFO,
474                           (task_info_t) &pi->taskinfo, &tkcount);
475        if (err == MACH_SEND_INVALID_DEST)        if (err == MACH_SEND_INVALID_DEST)
476          err = ESRCH;          err = ESRCH;
477    #ifdef TASK_SCHED_TIMESHARE_INFO
478          if (!err)
479            {
480              tkcount = TASK_SCHED_TIMESHARE_INFO_COUNT;
481              err = task_info (task, TASK_SCHED_TIMESHARE_INFO,
482                               (int *)&pi->timeshare_base_info, &tkcount);
483              if (err == KERN_INVALID_POLICY)
484                {
485                  pi->timeshare_base_info.base_priority = -1;
486                  err = 0;
487                }
488            }
489    #endif
490      }      }
491    
492    for (i = 0; i < nthreads; i++)    for (i = 0; i < nthreads; i++)
# Line 483  S_proc_getprocinfo (struct proc *callerp Line 497  S_proc_getprocinfo (struct proc *callerp
497          {          {
498            thcount = THREAD_BASIC_INFO_COUNT;            thcount = THREAD_BASIC_INFO_COUNT;
499            err = thread_info (thds[i], THREAD_BASIC_INFO,            err = thread_info (thds[i], THREAD_BASIC_INFO,
500                               (int *)&pi->threadinfos[i].pis_bi,                               (thread_info_t) &pi->threadinfos[i].pis_bi,
501                               &thcount);                               &thcount);
502            if (err == MACH_SEND_INVALID_DEST)            if (err == MACH_SEND_INVALID_DEST)
503              {              {
# Line 503  S_proc_getprocinfo (struct proc *callerp Line 517  S_proc_getprocinfo (struct proc *callerp
517          {          {
518            thcount = THREAD_SCHED_INFO_COUNT;            thcount = THREAD_SCHED_INFO_COUNT;
519            err = thread_info (thds[i], THREAD_SCHED_INFO,            err = thread_info (thds[i], THREAD_SCHED_INFO,
520                               (int *)&pi->threadinfos[i].pis_si,                               (thread_info_t) &pi->threadinfos[i].pis_si,
521                               &thcount);                               &thcount);
522            if (err == MACH_SEND_INVALID_DEST)            if (err == MACH_SEND_INVALID_DEST)
523              {              {
# Line 629  kern_return_t Line 643  kern_return_t
643  S_proc_getloginpids (struct proc *callerp,  S_proc_getloginpids (struct proc *callerp,
644                       pid_t id,                       pid_t id,
645                       pid_t **pids,                       pid_t **pids,
646                       u_int *npids)                       size_t *npids)
647  {  {
648    error_t err = 0;    error_t err = 0;
649    struct proc *l = pid_find (id);    struct proc *l = pid_find (id);

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.44

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26