Changeset 13975
- Timestamp:
- Feb 5, 2013, 2:35:01 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/platform.c
r13969 r13975 15 15 #ifdef __FreeBSD__ 16 16 #include <ufs/ufs/quota.h> /* quotactl() */ 17 #elif defined (__sun) 18 #include <sys/fs/ufs_quota.h> /* quotactl */ 17 19 #else 18 20 #include <sys/quota.h> /* quotactl() */ 19 21 #endif 20 22 #ifdef HAVE_GETMNTENT 21 #include <mntent.h> 22 #include <paths.h> /* _PATH_MOUNTED */ 23 #ifdef __sun 24 #include <stdio.h> 25 #include <sys/mntent.h> 26 #include <sys/mnttab.h> 27 #define _PATH_MOUNTED MNTTAB 28 #else 29 #include <mntent.h> 30 #include <paths.h> /* _PATH_MOUNTED */ 31 #endif 23 32 #else /* BSD derived systems */ 24 33 #include <sys/param.h> … … 730 739 731 740 FILE * fp; 741 742 #ifdef __sun 743 struct mnttab * mnt; 744 fp = fopen(_PATH_MOUNTED, "r"); 745 if (fp == NULL) 746 return NULL; 747 748 while (getmntent(fp, mnt)) 749 if (!tr_strcmp0 (path, mnt->mnt_mountp)) 750 break; 751 fclose(fp); 752 return mnt ? mnt->mnt_fstype : NULL; 753 #else 732 754 struct mntent * mnt; 733 755 … … 742 764 endmntent(fp); 743 765 return mnt ? mnt->mnt_fsname : NULL; 744 766 #endif 745 767 #else /* BSD derived systems */ 746 768 … … 769 791 770 792 FILE * fp; 793 #ifdef __sun 794 struct mnttab *mnt; 795 fp = fopen(_PATH_MOUNTED, "r"); 796 if (fp == NULL) 797 return NULL; 798 while (getmntent(fp, mnt)) 799 if (!tr_strcmp0 (device, mnt->mnt_mountp)) 800 break; 801 fclose(fp); 802 return mnt ? mnt->mnt_fstype : NULL; 803 #else 771 804 struct mntent *mnt; 772 805 … … 781 814 endmntent(fp); 782 815 return mnt ? mnt->mnt_type : NULL; 783 816 #endif 784 817 #else /* BSD derived systems */ 785 818 … … 837 870 #if defined(__FreeBSD__) || defined(SYS_DARWIN) 838 871 if (quotactl(device, QCMD(Q_GETQUOTA, USRQUOTA), getuid(), (caddr_t) &dq) == 0) 872 { 873 #elif defined(__sun) 874 struct quotctl op; 875 int fd = open(device, O_RDONLY); 876 if (fd < 0) 877 return -1; 878 op.op = Q_GETQUOTA; 879 op.uid = getuid(); 880 op.addr = (caddr_t) &dq; 881 if (ioctl(fd, Q_QUOTACTL, &op) == 0) 882 { 883 close(fd); 839 884 #else 840 885 if (quotactl(QCMD(Q_GETQUOTA, USRQUOTA), device, getuid(), (caddr_t) &dq) == 0) 841 #endif 842 { 886 { 887 #endif 843 888 if (dq.dqb_bsoftlimit > 0) 844 889 { … … 861 906 #elif defined(__UCLIBC__) 862 907 spaceused = (int64_t) btodb(dq.dqb_curblocks); 908 #elif defined(__sun) 909 spaceused = (int64_t) dq.dqb_curblocks >> 1; 863 910 #else 864 911 spaceused = btodb(dq.dqb_curspace); … … 871 918 #endif 872 919 } 873 920 #if defined(__sun) 921 close(fd); 922 #endif 874 923 /* something went wrong */ 875 924 return -1;
Note: See TracChangeset
for help on using the changeset viewer.