Use <dirent.h> instead of <sys/dir.h>
Using <dirent.h> and struct dirent instead of <sys/dir.h> and struct direct is preferred and works on Android which lacks sys/dir.h. See: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/dirent.h.html
This commit is contained in:
parent
5d818a7a6d
commit
00279d692a
@ -34,7 +34,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/dir.h>
|
#include <dirent.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#ifdef WITH_SYSTEMD
|
#ifdef WITH_SYSTEMD
|
||||||
@ -1099,7 +1099,7 @@ next_task:
|
|||||||
// This finds processes in /proc in the traditional way.
|
// This finds processes in /proc in the traditional way.
|
||||||
// Return non-zero on success.
|
// Return non-zero on success.
|
||||||
static int simple_nextpid(PROCTAB *restrict const PT, proc_t *restrict const p) {
|
static int simple_nextpid(PROCTAB *restrict const PT, proc_t *restrict const p) {
|
||||||
static struct direct *ent; /* dirent handle */
|
static struct dirent *ent; /* dirent handle */
|
||||||
char *restrict const path = PT->path;
|
char *restrict const path = PT->path;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ent = readdir(PT->procfs);
|
ent = readdir(PT->procfs);
|
||||||
@ -1117,7 +1117,7 @@ static int simple_nextpid(PROCTAB *restrict const PT, proc_t *restrict const p)
|
|||||||
// This finds tasks in /proc/*/task/ in the traditional way.
|
// This finds tasks in /proc/*/task/ in the traditional way.
|
||||||
// Return non-zero on success.
|
// Return non-zero on success.
|
||||||
static int simple_nexttid(PROCTAB *restrict const PT, const proc_t *restrict const p, proc_t *restrict const t, char *restrict const path) {
|
static int simple_nexttid(PROCTAB *restrict const PT, const proc_t *restrict const p, proc_t *restrict const t, char *restrict const path) {
|
||||||
static struct direct *ent; /* dirent handle */
|
static struct dirent *ent; /* dirent handle */
|
||||||
if(PT->taskdir_user != p->tgid){
|
if(PT->taskdir_user != p->tgid){
|
||||||
if(PT->taskdir){
|
if(PT->taskdir){
|
||||||
closedir(PT->taskdir);
|
closedir(PT->taskdir);
|
||||||
|
@ -399,7 +399,7 @@ static void crash(const char *filename) {
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
static void getrunners(unsigned int *restrict running, unsigned int *restrict blocked) {
|
static void getrunners(unsigned int *restrict running, unsigned int *restrict blocked) {
|
||||||
struct direct *ent;
|
struct dirent *ent;
|
||||||
DIR *proc;
|
DIR *proc;
|
||||||
|
|
||||||
*running=0;
|
*running=0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef PROC_SYSINFO_H
|
#ifndef PROC_SYSINFO_H
|
||||||
#define PROC_SYSINFO_H
|
#define PROC_SYSINFO_H
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/dir.h>
|
#include <dirent.h>
|
||||||
#include "procps.h"
|
#include "procps.h"
|
||||||
|
|
||||||
EXTERN_C_BEGIN
|
EXTERN_C_BEGIN
|
||||||
|
1
vmstat.c
1
vmstat.c
@ -38,7 +38,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/dir.h>
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user