library: Remove tty_to_dev()

This library call was imported into w as it was only used in
this program.  Converting a tty to a device is not really the
work for libprocps.
This commit is contained in:
Craig Small 2015-09-01 20:41:25 +10:00
parent a02911c1ea
commit 6252bf439f
3 changed files with 0 additions and 18 deletions

View File

@ -36,7 +36,6 @@
/* Who uses what: /* Who uses what:
* *
* tty_to_dev w (there is a fancy version in ps)
* dev_to_tty top, ps * dev_to_tty top, ps
*/ */
@ -319,17 +318,3 @@ abbrev:
*ret = '\0'; *ret = '\0';
return i; return i;
} }
/* name --> number */
int tty_to_dev(const char *restrict const name) {
struct stat sbuf;
static char buf[32];
if(name[0]=='/' && stat(name, &sbuf) >= 0) return sbuf.st_rdev;
snprintf(buf,32,"/dev/%s",name);
if(stat(buf, &sbuf) >= 0) return sbuf.st_rdev;
snprintf(buf,32,"/dev/tty%s",name);
if(stat(buf, &sbuf) >= 0) return sbuf.st_rdev;
snprintf(buf,32,"/dev/pts/%s",name);
if(stat(buf, &sbuf) >= 0) return sbuf.st_rdev;
return -1;
}

View File

@ -11,7 +11,5 @@ __BEGIN_DECLS
extern unsigned dev_to_tty(char *__restrict ret, unsigned chop, dev_t dev_t_dev, int pid, unsigned int flags); extern unsigned dev_to_tty(char *__restrict ret, unsigned chop, dev_t dev_t_dev, int pid, unsigned int flags);
extern int tty_to_dev(const char *__restrict const name);
__END_DECLS __END_DECLS
#endif #endif

View File

@ -19,7 +19,6 @@ global:
readproctab3; readproctab3;
readproctab; readproctab;
readtask; readtask;
tty_to_dev;
user_from_uid; user_from_uid;
procps_cpu_count; procps_cpu_count;
procps_diskstat_dev_count; procps_diskstat_dev_count;