- added "day" query format which is like date, but doesn't print
any time
- added --changelog alias to query a packages changelog entry
+ - added mntctl() support for AIX (I think, I can't test this)
2.4 -> 2.4.1:
- take advantage of lchown() if it's available
AC_CHECK_FUNC(inet_aton, AC_DEFINE(HAVE_INET_ATON), MISCOBJS="$MISCOBJS inet_aton.o")
AC_CHECK_FUNC(realpath, AC_DEFINE(HAVE_REALPATH), MISCOBJS="$MISCOBJS realpath.o")
AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT), MISCOBJS="$MISCOBJS getmntent.o")
+AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL))
AC_CHECK_FUNC(strerror, [], MISCOBJS="$MISCOBJS strerror.o")
AC_CHECK_FUNC(strtol, [], MISCOBJS="$MISCOBJS strtol.o")
AC_CHECK_FUNC(strtoul, [], MISCOBJS="$MISCOBJS strtoul.o")
#include "miscfn.h"
+#if HAVE_ALLOCA_H
+# include <alloca.h>
+#endif
+
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
static int getFilesystemList(void);
+#if HAVE_MNTCTL
+
+/* modeled after sample code from Till Bubeck */
+
+#include <sys/mntctl.h>
+#include <sys/vmount.h>
+
+static int getFilesystemList(void) {
+ int size;
+ void * buf;
+ struct vmount * vm;
+ int num;
+ int fsnameLength;
+ int i;
+
+ num = mntctl(MCTL_QUERY, sizeof(size), (char *) &size);
+ if (num < 0) {
+ rpmError(RPMERR_MTAB, _("mntctl() failed to return fugger size: %s"),
+ strerror(errno));
+ return 1;
+ }
+
+ buf = alloca(size);
+ num = mntctl(MCTL_QUERY, size, buf);
+
+ numFilesystems = num;
+
+ filesystems = malloc(sizeof(*filesystems) * numFilesystems);
+ fsnames = malloc(sizeof(*filesystems) * numFilesystems);
+
+ for (vm = buf, i = 0; i < num; i++) {
+ fsnameLength = vm->vmt_data[VMT_STUB].vmt_size;
+ fsnames[i] = malloc(fsnameLength + 1);
+ strncpy(fsnames[i],(char *)vm + vm->vmt_data[VMT_STUB].vmt_off,
+ fsname_len);
+
+ filesystems[i].mntPoint = fsnames[i];
+
+ if (stat(fsnames[i], &sb)) {
+ rpmError(RPMERR_STAT, "failed to stat %s: %s", fsnames[i],
+ strerror(errno));
+
+ for (i = 0; i < num; i++)
+ free(filesystems[i].mntPoint);
+ free(filesystems);
+ free(fsnameS);
+
+ filesystems = NULL;
+ }
+
+ filesystems[num].dev = sb.st_dev;
+
+ /* goto the next vmount structure: */
+ vm = (struct vmount *)((char *)vm + vm->vmt_length);
+ }
+
+ return 0;
+}
+#else
static int getFilesystemList(void) {
our_mntent item, * itemptr;
FILE * mtab;
return 0;
}
+#endif
int rpmGetFilesystemList(char *** listptr) {
if (!fsnames)
# define GETMNTENT_TWO 1
# define our_mntent struct mnttab
# define our_mntdir mnt_mountp
-#else
-# error Neither mntent.h nor mnttab.h exists. I cannot build on this system.
+#else if !HAVE_MNTCTL
+# error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
#endif
#ifndef MOUNTED