mirror of
https://github.com/sheumann/hush.git
synced 2024-12-26 10:32:02 +00:00
Kill CONFIG_FEATURE_USE_DEVPS_PATCH and the devps patch. I'm not
maintaining it anymore, and it is now terribly out of date. -Erik
This commit is contained in:
parent
6f9b45b9ef
commit
deca106b6d
@ -1,104 +0,0 @@
|
|||||||
I have been asked several times whether the devps patch will go into the
|
|
||||||
mainline Linux kernel. The following emails from Alan Cox and Linus Torvalds
|
|
||||||
make it clear that it is not going to happen. This does not mean this patch
|
|
||||||
had no value -- it does. It just means that those that like it get to apply it
|
|
||||||
themselves...
|
|
||||||
|
|
||||||
-Erik
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------
|
|
||||||
|
|
||||||
From alan@lxorguk.ukuu.org.uk Thu Apr 13 08:07:22 2000
|
|
||||||
Return-Path: <alan@lxorguk.ukuu.org.uk>
|
|
||||||
Delivered-To: andersen@dillweed.dsl.xmission.com
|
|
||||||
Received: from localhost (dillweed.dsl.xmission.com [10.0.0.1])
|
|
||||||
by dillweed.dsl.xmission.com (Postfix) with ESMTP id 1D57A11A4F5
|
|
||||||
for <andersen@dillweed.dsl.xmission.com>; Thu, 13 Apr 2000 08:07:22 -0600 (MDT)
|
|
||||||
Envelope-to: andersen@xmission.com
|
|
||||||
Received: from mail.xmission.com
|
|
||||||
by localhost with IMAP (fetchmail-5.3.3)
|
|
||||||
for andersen@dillweed.dsl.xmission.com (single-drop); Thu, 13 Apr 2000 08:07:22 -0600 (MDT)
|
|
||||||
Received: from [194.168.151.1] (helo=the-village.bc.nu)
|
|
||||||
by mail.xmission.com with esmtp (Exim 3.03 #3)
|
|
||||||
id 12fhQk-0002OZ-00
|
|
||||||
for andersen@xmission.com; Thu, 13 Apr 2000 05:05:03 -0600
|
|
||||||
Received: from alan by the-village.bc.nu with local (Exim 2.12 #1)
|
|
||||||
id 12fhQ9-0002nD-00
|
|
||||||
for andersen@xmission.com; Thu, 13 Apr 2000 12:04:25 +0100
|
|
||||||
Subject: Re: kernel ps drivers [Was: vm locking question]
|
|
||||||
To: andersen@xmission.com
|
|
||||||
Date: Thu, 13 Apr 2000 12:04:23 +0100 (BST)
|
|
||||||
In-Reply-To: <20000412224130.A2748@xmission.com> from "Erik Andersen" at Apr 12, 2000 10:41:30 PM
|
|
||||||
X-Mailer: ELM [version 2.5 PL1]
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=us-ascii
|
|
||||||
Content-Transfer-Encoding: 7bit
|
|
||||||
Message-Id: <E12fhQ9-0002nD-00@the-village.bc.nu>
|
|
||||||
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
|
|
||||||
Status: RO
|
|
||||||
X-Status: A
|
|
||||||
Content-Length: 242
|
|
||||||
Lines: 6
|
|
||||||
|
|
||||||
> On the subject of ps, would you be willing to accept my /dev/ps
|
|
||||||
> patch into the kernel? If no, any suggestions on what should
|
|
||||||
> be done differently (if anything) to make it worthy of inclusion?
|
|
||||||
|
|
||||||
For 2.2.x no, for 2.3.x ask Linus not me
|
|
||||||
|
|
||||||
|
|
||||||
From torvalds@transmeta.com Thu Apr 13 09:18:16 2000
|
|
||||||
Return-Path: <torvalds@transmeta.com>
|
|
||||||
Delivered-To: andersen@dillweed.dsl.xmission.com
|
|
||||||
Received: from localhost (dillweed.dsl.xmission.com [10.0.0.1])
|
|
||||||
by dillweed.dsl.xmission.com (Postfix) with ESMTP id 3776411A3DF
|
|
||||||
for <andersen@dillweed.dsl.xmission.com>; Thu, 13 Apr 2000 09:18:16 -0600 (MDT)
|
|
||||||
Envelope-to: andersen@xmission.com
|
|
||||||
Received: from mail.xmission.com
|
|
||||||
by localhost with IMAP (fetchmail-5.3.3)
|
|
||||||
for andersen@dillweed.dsl.xmission.com (single-drop); Thu, 13 Apr 2000 09:18:16 -0600 (MDT)
|
|
||||||
Received: from [209.10.217.66] (helo=neon-gw.transmeta.com)
|
|
||||||
by mail.xmission.com with esmtp (Exim 3.03 #3)
|
|
||||||
id 12flK2-0004dd-00
|
|
||||||
for andersen@xmission.com; Thu, 13 Apr 2000 09:14:22 -0600
|
|
||||||
Received: (from root@localhost)
|
|
||||||
by neon-gw.transmeta.com (8.9.3/8.9.3) id IAA18635;
|
|
||||||
Thu, 13 Apr 2000 08:10:51 -0700
|
|
||||||
Received: from mailhost.transmeta.com(10.1.1.15) by neon-gw.transmeta.com via smap (V2.1)
|
|
||||||
id xma018629; Thu, 13 Apr 00 08:10:25 -0700
|
|
||||||
Received: from penguin.transmeta.com (root@penguin.transmeta.com [10.1.2.202])
|
|
||||||
by deepthought.transmeta.com (8.9.3/8.9.3) with ESMTP id IAA12264;
|
|
||||||
Thu, 13 Apr 2000 08:13:53 -0700 (PDT)
|
|
||||||
Received: from localhost (torvalds@localhost) by penguin.transmeta.com (8.9.3/8.7.3) with ESMTP id IAA02051; Thu, 13 Apr 2000 08:13:53 -0700
|
|
||||||
X-Authentication-Warning: penguin.transmeta.com: torvalds owned process doing -bs
|
|
||||||
Date: Thu, 13 Apr 2000 08:13:53 -0700 (PDT)
|
|
||||||
From: Linus Torvalds <torvalds@transmeta.com>
|
|
||||||
To: Erik Andersen <andersen@xmission.com>
|
|
||||||
Cc: Alan Cox <alan@redhat.com>
|
|
||||||
Subject: Re: kernel ps drivers [Was: vm locking question]
|
|
||||||
In-Reply-To: <20000413083127.A976@xmission.com>
|
|
||||||
Message-ID: <Pine.LNX.4.10.10004130812170.2000-100000@penguin.transmeta.com>
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: TEXT/PLAIN; charset=US-ASCII
|
|
||||||
Status: RO
|
|
||||||
Content-Length: 659
|
|
||||||
Lines: 16
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
On Thu, 13 Apr 2000, Erik Andersen wrote:
|
|
||||||
>
|
|
||||||
> For 2.3.x would you be willing to accept my /dev/ps driver into the kernel?
|
|
||||||
> (Assuming I remove the /dev/modules driver (since it was pointed out that there
|
|
||||||
> is a perfectly good syscall providing that interface). If no, is there anything
|
|
||||||
> that could be done differently (if anything) to make it worthy of inclusion?
|
|
||||||
|
|
||||||
I do dislike /dev/ps mightily. If the problem is that /proc is too large,
|
|
||||||
then the right solution is to just clean up /proc. Which is getting done.
|
|
||||||
And yes, /proc will be larger than /dev/ps, but I still find that
|
|
||||||
preferable to having two incompatible ways to do the same thing.
|
|
||||||
|
|
||||||
Linus
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -27,88 +27,6 @@
|
|||||||
|
|
||||||
#define READ_BUF_SIZE 50
|
#define READ_BUF_SIZE 50
|
||||||
|
|
||||||
|
|
||||||
/* For Erik's nifty devps device driver */
|
|
||||||
#ifdef CONFIG_FEATURE_USE_DEVPS_PATCH
|
|
||||||
#include <linux/devps.h>
|
|
||||||
|
|
||||||
/* find_pid_by_name()
|
|
||||||
*
|
|
||||||
* This finds the pid of the specified process,
|
|
||||||
* by using the /dev/ps device driver.
|
|
||||||
*
|
|
||||||
* Returns a list of all matching PIDs
|
|
||||||
*/
|
|
||||||
extern long* find_pid_by_name( const char* pidName)
|
|
||||||
{
|
|
||||||
int fd, i, j;
|
|
||||||
char device[] = "/dev/ps";
|
|
||||||
pid_t num_pids;
|
|
||||||
pid_t* pid_array = NULL;
|
|
||||||
long* pidList=NULL;
|
|
||||||
|
|
||||||
/* open device */
|
|
||||||
fd = open(device, O_RDONLY);
|
|
||||||
if (fd < 0)
|
|
||||||
perror_msg_and_die("open failed for `%s'", device);
|
|
||||||
|
|
||||||
/* Find out how many processes there are */
|
|
||||||
if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0)
|
|
||||||
perror_msg_and_die("\nDEVPS_GET_PID_LIST");
|
|
||||||
|
|
||||||
/* Allocate some memory -- grab a few extras just in case
|
|
||||||
* some new processes start up while we wait. The kernel will
|
|
||||||
* just ignore any extras if we give it too many, and will trunc.
|
|
||||||
* the list if we give it too few. */
|
|
||||||
pid_array = (pid_t*) xcalloc( num_pids+10, sizeof(pid_t));
|
|
||||||
pid_array[0] = num_pids+10;
|
|
||||||
|
|
||||||
/* Now grab the pid list */
|
|
||||||
if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0)
|
|
||||||
perror_msg_and_die("\nDEVPS_GET_PID_LIST");
|
|
||||||
|
|
||||||
/* Now search for a match */
|
|
||||||
for (i=1, j=0; i<pid_array[0] ; i++) {
|
|
||||||
char* p;
|
|
||||||
struct pid_info info;
|
|
||||||
|
|
||||||
info.pid = pid_array[i];
|
|
||||||
if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0)
|
|
||||||
perror_msg_and_die("\nDEVPS_GET_PID_INFO");
|
|
||||||
|
|
||||||
/* Make sure we only match on the process name */
|
|
||||||
p=info.command_line+1;
|
|
||||||
while ((*p != 0) && !isspace(*(p)) && (*(p-1) != '\\')) {
|
|
||||||
(p)++;
|
|
||||||
}
|
|
||||||
if (isspace(*(p)))
|
|
||||||
*p='\0';
|
|
||||||
|
|
||||||
if ((strstr(info.command_line, pidName) != NULL)
|
|
||||||
&& (strlen(pidName) == strlen(info.command_line))) {
|
|
||||||
pidList=xrealloc( pidList, sizeof(long) * (j+2));
|
|
||||||
pidList[j++]=info.pid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pidList) {
|
|
||||||
pidList[j]=0;
|
|
||||||
} else {
|
|
||||||
pidList=xrealloc( pidList, sizeof(long));
|
|
||||||
pidList[0]=-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free memory */
|
|
||||||
free( pid_array);
|
|
||||||
|
|
||||||
/* close device */
|
|
||||||
if (close (fd) != 0)
|
|
||||||
perror_msg_and_die("close failed for `%s'", device);
|
|
||||||
|
|
||||||
return pidList;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* CONFIG_FEATURE_USE_DEVPS_PATCH */
|
|
||||||
|
|
||||||
/* find_pid_by_name()
|
/* find_pid_by_name()
|
||||||
*
|
*
|
||||||
* Modified by Vladimir Oleynik for use with libbb/procps.c
|
* Modified by Vladimir Oleynik for use with libbb/procps.c
|
||||||
@ -135,7 +53,6 @@ extern long* find_pid_by_name( const char* pidName)
|
|||||||
pidList[i] = i==0 ? -1 : 0;
|
pidList[i] = i==0 ? -1 : 0;
|
||||||
return pidList;
|
return pidList;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_FEATURE_USE_DEVPS_PATCH */
|
|
||||||
|
|
||||||
/* END CODE */
|
/* END CODE */
|
||||||
/*
|
/*
|
||||||
|
@ -23,16 +23,12 @@
|
|||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
|
|
||||||
|
|
||||||
/* Busybox mount uses either /proc/mounts or /dev/mtab to
|
/* Busybox mount uses either /proc/mounts or /etc/mtab to
|
||||||
* get the list of currently mounted filesystems */
|
* get the list of currently mounted filesystems */
|
||||||
#if defined CONFIG_FEATURE_MTAB_SUPPORT
|
#if defined CONFIG_FEATURE_MTAB_SUPPORT
|
||||||
const char mtab_file[] = "/etc/mtab";
|
const char mtab_file[] = "/etc/mtab";
|
||||||
#else
|
#else
|
||||||
# if defined CONFIG_FEATURE_USE_DEVPS_PATCH
|
const char mtab_file[] = "/proc/mounts";
|
||||||
const char mtab_file[] = "/dev/mtab";
|
|
||||||
# else
|
|
||||||
const char mtab_file[] = "/proc/mounts";
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if ! defined CONFIG_FEATURE_USE_DEVPS_PATCH
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -131,8 +130,6 @@ extern procps_status_t * procps_scan(int save_user_arg0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_FEATURE_USE_DEVPS_PATCH. Else this file is empty */
|
|
||||||
|
|
||||||
/* END CODE */
|
/* END CODE */
|
||||||
/*
|
/*
|
||||||
Local Variables:
|
Local Variables:
|
||||||
|
104
procps/ps.c
104
procps/ps.c
@ -20,12 +20,6 @@
|
|||||||
* Place, Suite 330, Boston, MA 02111-1307 USA
|
* Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* This contains _two_ implementations of ps for Linux. One uses the
|
|
||||||
* traditional /proc virtual filesystem, and the other use the devps kernel
|
|
||||||
* driver (written by Erik Andersen to avoid using /proc thereby saving 100k+).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -42,8 +36,6 @@ static const int TERMINAL_WIDTH = 79; /* not 80 in case terminal has linefo
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if ! defined CONFIG_FEATURE_USE_DEVPS_PATCH
|
|
||||||
|
|
||||||
extern int ps_main(int argc, char **argv)
|
extern int ps_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
procps_status_t * p;
|
procps_status_t * p;
|
||||||
@ -91,99 +83,3 @@ extern int ps_main(int argc, char **argv)
|
|||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#else /* CONFIG_FEATURE_USE_DEVPS_PATCH */
|
|
||||||
|
|
||||||
|
|
||||||
/* The following is the second ps implementation --
|
|
||||||
* this one uses the nifty new devps kernel device.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <linux/devps.h> /* For Erik's nifty devps device driver */
|
|
||||||
|
|
||||||
|
|
||||||
extern int ps_main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
char device[] = "/dev/ps";
|
|
||||||
int i, j, len, fd;
|
|
||||||
pid_t num_pids;
|
|
||||||
pid_t* pid_array = NULL;
|
|
||||||
struct pid_info info;
|
|
||||||
char uidName[9];
|
|
||||||
#ifdef CONFIG_FEATURE_AUTOWIDTH
|
|
||||||
struct winsize win = { 0, 0, 0, 0 };
|
|
||||||
int terminal_width = TERMINAL_WIDTH;
|
|
||||||
#else
|
|
||||||
#define terminal_width TERMINAL_WIDTH
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (argc > 1 && **(argv + 1) == '-')
|
|
||||||
show_usage();
|
|
||||||
|
|
||||||
/* open device */
|
|
||||||
fd = open(device, O_RDONLY);
|
|
||||||
if (fd < 0)
|
|
||||||
perror_msg_and_die( "open failed for `%s'", device);
|
|
||||||
|
|
||||||
/* Find out how many processes there are */
|
|
||||||
if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0)
|
|
||||||
perror_msg_and_die( "\nDEVPS_GET_PID_LIST");
|
|
||||||
|
|
||||||
/* Allocate some memory -- grab a few extras just in case
|
|
||||||
* some new processes start up while we wait. The kernel will
|
|
||||||
* just ignore any extras if we give it too many, and will trunc.
|
|
||||||
* the list if we give it too few. */
|
|
||||||
pid_array = (pid_t*) xcalloc( num_pids+10, sizeof(pid_t));
|
|
||||||
pid_array[0] = num_pids+10;
|
|
||||||
|
|
||||||
/* Now grab the pid list */
|
|
||||||
if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0)
|
|
||||||
perror_msg_and_die("\nDEVPS_GET_PID_LIST");
|
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_AUTOWIDTH
|
|
||||||
ioctl(fileno(stdout), TIOCGWINSZ, &win);
|
|
||||||
if (win.ws_col > 0)
|
|
||||||
terminal_width = win.ws_col - 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Print up a ps listing */
|
|
||||||
printf(" PID Uid Stat Command\n");
|
|
||||||
|
|
||||||
for (i=1; i<pid_array[0] ; i++) {
|
|
||||||
info.pid = pid_array[i];
|
|
||||||
|
|
||||||
if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0)
|
|
||||||
perror_msg_and_die("\nDEVPS_GET_PID_INFO");
|
|
||||||
|
|
||||||
/* Make some adjustments as needed */
|
|
||||||
my_getpwuid(uidName, info.euid);
|
|
||||||
|
|
||||||
if(p.vmsize == 0)
|
|
||||||
len = printf("%5d %-8s %c ", p.pid, uidName, p.state);
|
|
||||||
else
|
|
||||||
len = printf("%5d %-8s %6d %c ", p.pid, uidName, p.vmsize, p.state);
|
|
||||||
if (strlen(info.command_line) > 1) {
|
|
||||||
for( j=0; j<(sizeof(info.command_line)-1) && j < (terminal_width-len); j++) {
|
|
||||||
if (*(info.command_line+j) == '\0' && *(info.command_line+j+1) != '\0') {
|
|
||||||
*(info.command_line+j) = ' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*(info.command_line+j) = '\0';
|
|
||||||
puts(info.command_line);
|
|
||||||
} else {
|
|
||||||
printf("[%s]\n", info.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free memory */
|
|
||||||
free( pid_array);
|
|
||||||
|
|
||||||
/* close device */
|
|
||||||
if (close (fd) != 0)
|
|
||||||
perror_msg_and_die("close failed for `%s'", device);
|
|
||||||
|
|
||||||
exit (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* CONFIG_FEATURE_USE_DEVPS_PATCH */
|
|
||||||
|
|
||||||
|
@ -53,9 +53,6 @@
|
|||||||
#include <mntent.h>
|
#include <mntent.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "busybox.h"
|
#include "busybox.h"
|
||||||
#if defined CONFIG_FEATURE_USE_DEVPS_PATCH
|
|
||||||
# include <linux/devmtab.h> /* For Erik's nifty devmtab device driver */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MS_MGC_VAL = 0xc0ed0000, /* Magic number indicatng "new" flags */
|
MS_MGC_VAL = 0xc0ed0000, /* Magic number indicatng "new" flags */
|
||||||
@ -247,39 +244,6 @@ static int mount_one(char *blockDevice, char *directory, char *filesystemType,
|
|||||||
int mount_all)
|
int mount_all)
|
||||||
{
|
{
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
#if defined CONFIG_FEATURE_USE_DEVPS_PATCH
|
|
||||||
if (strcmp(filesystemType, "auto") == 0) {
|
|
||||||
static const char *noauto_array[] =
|
|
||||||
{ "tmpfs", "shm", "proc", "ramfs", "devpts", "devfs", "usbdevfs",
|
|
||||||
0 };
|
|
||||||
const char **noauto_fstype;
|
|
||||||
const int num_of_filesystems = sysfs(3, 0, 0);
|
|
||||||
char buf[255];
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
filesystemType = buf;
|
|
||||||
|
|
||||||
while (i < num_of_filesystems) {
|
|
||||||
sysfs(2, i++, filesystemType);
|
|
||||||
for (noauto_fstype = noauto_array; *noauto_fstype;
|
|
||||||
noauto_fstype++) {
|
|
||||||
if (!strcmp(filesystemType, *noauto_fstype)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!*noauto_fstype) {
|
|
||||||
status =
|
|
||||||
do_mount(blockDevice, directory, filesystemType,
|
|
||||||
flags | MS_MGC_VAL, string_flags, useMtab,
|
|
||||||
fakeIt, mtab_opts, mount_all);
|
|
||||||
if (status) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (strcmp(filesystemType, "auto") == 0) {
|
if (strcmp(filesystemType, "auto") == 0) {
|
||||||
char buf[255];
|
char buf[255];
|
||||||
FILE *f;
|
FILE *f;
|
||||||
@ -346,9 +310,7 @@ static int mount_one(char *blockDevice, char *directory, char *filesystemType,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
} else {
|
||||||
#endif
|
|
||||||
else {
|
|
||||||
status =
|
status =
|
||||||
do_mount(blockDevice, directory, filesystemType,
|
do_mount(blockDevice, directory, filesystemType,
|
||||||
flags | MS_MGC_VAL, string_flags, useMtab, fakeIt,
|
flags | MS_MGC_VAL, string_flags, useMtab, fakeIt,
|
||||||
@ -366,47 +328,6 @@ static int mount_one(char *blockDevice, char *directory, char *filesystemType,
|
|||||||
|
|
||||||
static void show_mounts(char *onlytype)
|
static void show_mounts(char *onlytype)
|
||||||
{
|
{
|
||||||
#if defined CONFIG_FEATURE_USE_DEVPS_PATCH
|
|
||||||
int fd, i, numfilesystems;
|
|
||||||
char device[] = "/dev/mtab";
|
|
||||||
struct k_mntent *mntentlist;
|
|
||||||
|
|
||||||
/* open device */
|
|
||||||
fd = open(device, O_RDONLY);
|
|
||||||
if (fd < 0) {
|
|
||||||
perror_msg_and_die("open failed for `%s'", device);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* How many mounted filesystems? We need to know to
|
|
||||||
* allocate enough space for later... */
|
|
||||||
numfilesystems = ioctl(fd, DEVMTAB_COUNT_MOUNTS);
|
|
||||||
if (numfilesystems < 0) {
|
|
||||||
perror_msg_and_die("\nDEVMTAB_COUNT_MOUNTS");
|
|
||||||
}
|
|
||||||
mntentlist =
|
|
||||||
(struct k_mntent *) xcalloc(numfilesystems, sizeof(struct k_mntent));
|
|
||||||
|
|
||||||
/* Grab the list of mounted filesystems */
|
|
||||||
if (ioctl(fd, DEVMTAB_GET_MOUNTS, mntentlist) < 0) {
|
|
||||||
perror_msg_and_die("\nDEVMTAB_GET_MOUNTS");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < numfilesystems; i++) {
|
|
||||||
if (!onlytype || (strcmp(mntentlist[i].mnt_type, onlytype) == 0)) {
|
|
||||||
printf("%s %s %s %s %d %d\n", mntentlist[i].mnt_fsname,
|
|
||||||
mntentlist[i].mnt_dir, mntentlist[i].mnt_type,
|
|
||||||
mntentlist[i].mnt_opts, mntentlist[i].mnt_freq,
|
|
||||||
mntentlist[i].mnt_passno);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef CONFIG_FEATURE_CLEAN_UP
|
|
||||||
/* Don't bother to close files or free memory. Exit
|
|
||||||
* does that automagically, so we can save a few bytes */
|
|
||||||
free(mntentlist);
|
|
||||||
close(fd);
|
|
||||||
#endif
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
#else
|
|
||||||
FILE *mountTable = setmntent(mtab_file, "r");
|
FILE *mountTable = setmntent(mtab_file, "r");
|
||||||
|
|
||||||
if (mountTable) {
|
if (mountTable) {
|
||||||
@ -433,7 +354,6 @@ static void show_mounts(char *onlytype)
|
|||||||
perror_msg_and_die("%s", mtab_file);
|
perror_msg_and_die("%s", mtab_file);
|
||||||
}
|
}
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int mount_main(int argc, char **argv)
|
extern int mount_main(int argc, char **argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user