+#if defined BB_FEATURE_USE_DEVPS_PATCH
+ if (argc == 1) {
+ int fd, i, numfilesystems;
+ char device[] = "/dev/mtab";
+ struct k_mntent *mntentlist;
+
+ /* open device */
+ fd = open(device, O_RDONLY);
+ if (fd < 0)
+ fatalError("open failed for `%s': %s\n", device, strerror (errno));
+
+ /* How many mounted filesystems? We need to know to
+ * allocate enough space for later... */
+ numfilesystems = ioctl (fd, DEVMTAB_COUNT_MOUNTS);
+ if (numfilesystems<0)
+ fatalError( "\nDEVMTAB_COUNT_MOUNTS: %s\n", strerror (errno));
+ mntentlist = (struct k_mntent *) calloc ( numfilesystems, sizeof(struct k_mntent));
+
+ /* Grab the list of mounted filesystems */
+ if (ioctl (fd, DEVMTAB_GET_MOUNTS, mntentlist)<0)
+ fatalError( "\nDEVMTAB_GET_MOUNTS: %s\n", strerror (errno));
+
+ for( i = 0 ; i < numfilesystems ; i++) {
+ fprintf( stdout, "%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);
+ }
+ /* Don't bother to close files or free memory. Exit
+ * does that automagically, so we can save a few bytes */
+#if 0
+ free( mntentlist);
+ close(fd);
+#endif
+ exit(TRUE);
+ }
+#else