Ticket #18502: patch-utils.c.diff

File patch-utils.c.diff, 971 bytes (added by 0xffea@…, 16 years ago)
  • utils.c

    old new  
    1818
    1919#define _XOPEN_SOURCE 600
    2020#define __USE_XOPEN2K
     21#define _DARWIN_C_SOURCE
    2122#include <stdio.h>
    2223#include <stdlib.h>
    2324#ifndef __CHECKER__
     
    3031#include <dirent.h>
    3132#include <fcntl.h>
    3233#include <unistd.h>
     34#ifdef __APPLE__
     35#include <sys/disk.h>
     36#else
    3337#include <mntent.h>
     38#endif
     39
     40
    3441#include "kerncompat.h"
    3542#include "radix-tree.h"
    3643#include "ctree.h"
     
    393400        if (!S_ISBLK(st->st_mode)) {
    394401                return 0;
    395402        }
     403#ifdef __APPLE__
     404        if (ioctl(fd, DKIOCGETBLOCKCOUNT, &size) >= 0) {
     405#else
    396406        if (ioctl(fd, BLKGETSIZE64, &size) >= 0) {
     407#endif
    397408                return size;
    398409        }
    399410        return 0;
     
    594605 */
    595606int check_mounted(char *file)
    596607{
     608#ifdef __APPLE__
     609        return 0;
     610#else
    597611        struct mntent *mnt;
    598612        struct stat st_buf;
    599613        dev_t file_dev = 0;
     
    638652
    639653        endmntent (f);
    640654        return ret;
     655#endif
    641656}
    642657
    643658struct pending_dir {