Thread View: comp.sys.sgi.bugs
2 messages
2 total messages
Started by Bill Carson
Wed, 06 Jan 1993 18:14
PIOCPSINFO (proc) always EINVAL
Author: Bill Carson
Date: Wed, 06 Jan 1993 18:14
Date: Wed, 06 Jan 1993 18:14
104 lines
2898 bytes
2898 bytes
Has anyone had any luck with the PIOCPSINFO ioctl?
According to the 4.0.5 proc(4) man page:
> void *p;
> retval = ioctl(fildes, code, p);
>
> The argument p is a generic pointer whose type depends on the specific
> ioctl code. Where not specifically mentioned below, its value should be
> zero. <sys/procfs.h> contains definitions of ioctl codes and data
> structures used by the operations.
> ...
> PIOCPSINFO
> This returns miscellaneous process information such as that reported by
> ps(1). p is a pointer to a prpsinfo structure containing at least the
> following fields:
>
> typedef struct prpsinfo {
> ...
> } prpsinfo_t
Enclosed is a program that demonstrates the failure of the PIOCPSINFO ioctl.
$ cc -o prps prps.c
$ prps (uses getpid(), or give a PID as first arg)
prps: using path: /debug/12850
prst.pr_pid 12850
prps: ioctl PIOCPSINFO: Invalid argument
[IRIX stimpy 4.0.5 06151813 IP12]
[also compiled/tried under 4.0.4 and 4.0.5F]
Any and all insight appreciated. Thanks!
- Bill Carson / brighton@pixar.com
--------------------------------------------------------------------
#include <sys/types.h>
#include <stdio.h>
#include <errno.h>
#include <malloc.h>
#include <string.h>
#include <fcntl.h>
#include <sys/time.h>
#include <sys/signal.h>
#include <sys/fault.h>
#include <sys/syscall.h>
#include <sys/procfs.h>
static char *PGM = "prps";
#define ERR sys_errlist[errno]
main(ac, av)
char **av;
{
FILE *pf;
int pid, ret, fd;
char path[1024];
prstatus_t prst;
prpsinfo_t prps;
void *v;
if (ac > 1)
pid = atoi(av[1]);
else
pid = getpid();
sprintf(path, "/debug/%05d", pid);
setbuf(stdout, NULL);
printf("%s: using path: %s\n", PGM, path);
if ((fd = open(path, O_RDONLY, 0)) < 0) {
fprintf(stderr, "%s: open \"%s\": %s\n", PGM, path, ERR);
exit(1);
}
if ((ret = ioctl(fd, PIOCSTATUS, &prst)) < 0) {
fprintf(stderr, "%s: ioctl PIOCSTATUS: %s\n", PGM, ERR);
exit(1);
}
printf("prst.pr_pid %d\n", prst.pr_pid);
/*
* no matter what, this always fails with EINVAL
*/
if ((ret = ioctl(fd, PIOCPSINFO, &prps)) < 0) {
fprintf(stderr, "%s: ioctl PIOCPSINFO: %s\n", PGM, ERR);
exit(1);
}
printf("prps.pr_pid %d\n", prps.pr_pid);
if (close(fd) < 0) {
fprintf(stderr, "%s: close: %s\n", PGM, ERR);
exit(1);
}
exit(0);
}
Re: PIOCPSINFO (proc) always EINVAL
Author: Dave Ciemiewicz
Date: Wed, 06 Jan 1993 23:07
Date: Wed, 06 Jan 1993 23:07
22 lines
1648 bytes
1648 bytes
In article <1993Jan6.181444.26115@pixar.com>, brighton@pixar.com (Bill Carson) writes: |> Has anyone had any luck with the PIOCPSINFO ioctl? |> According to the 4.0.5 proc(4) man page: |> |> > void *p; |> > retval = ioctl(fildes, code, p); |> > |> > The argument p is a generic pointer whose type depends on the specific |> > ioctl code. Where not specifically mentioned below, its value should be |> > zero. <sys/procfs.h> contains definitions of ioctl codes and data |> > structures used by the operations. |> > ... |> > PIOCPSINFO |> > This returns miscellaneous process information such as that reported by |> > ps(1). p is a pointer to a prpsinfo structure containing at least the |> > following fields: |> > Unfortunately, the PIOCPSINFO ioctl is currently unimplemented, thus the EINVAL error. This will be remedied in the next major operating system release but there are currently no plans to have it implemented as part of the 4.0.5 series.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads