/*1* Copyright (c) 2005 Apple Computer, Inc. All rights reserved.2*3* @APPLE_APACHE_LICENSE_HEADER_START@4*5* Licensed under the Apache License, Version 2.0 (the "License");6* you may not use this file except in compliance with the License.7* You may obtain a copy of the License at8*9* http://www.apache.org/licenses/LICENSE-2.010*11* Unless required by applicable law or agreed to in writing, software12* distributed under the License is distributed on an "AS IS" BASIS,13* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14* See the License for the specific language governing permissions and15* limitations under the License.16*17* @APPLE_APACHE_LICENSE_HEADER_END@18*/19#include <sys/types.h>20#include <sys/stat.h>21#include <sys/event.h>22#include <sys/time.h>23#include <sys/param.h>24#include <stdlib.h>25#include <stdio.h>26#include <unistd.h>27#include <errno.h>28#include <string.h>2930int main(int argc, char *argv[])31{32int kq = kqueue();33struct kevent kev;34struct stat sb;3536if (argc != 2) {37fprintf(stderr, "usage: %s <object on mount point>\n", argv[0]);38exit(EXIT_FAILURE);39}4041EV_SET(&kev, 0, EVFILT_FS, EV_ADD, 0, 0, 0);4243if (kevent(kq, &kev, 1, NULL, 0, NULL) == -1) {44fprintf(stderr, "adding EVFILT_FS to kqueue failed: %s\n", strerror(errno));45exit(EXIT_FAILURE);46}4748if (stat(argv[1], &sb) == 0) {49exit(EXIT_SUCCESS);50}5152for (;;) {53kevent(kq, NULL, 0, &kev, 1, NULL);54if (stat(argv[1], &sb) == 0) {55break;56}57}5859exit(EXIT_SUCCESS);60}616263