Print this page
5704 libzfs can only handle 255 filedescriptors


 607 void
 608 libzfs_print_on_error(libzfs_handle_t *hdl, boolean_t printerr)
 609 {
 610         hdl->libzfs_printerr = printerr;
 611 }
 612 
 613 libzfs_handle_t *
 614 libzfs_init(void)
 615 {
 616         libzfs_handle_t *hdl;
 617 
 618         if ((hdl = calloc(1, sizeof (libzfs_handle_t))) == NULL) {
 619                 return (NULL);
 620         }
 621 
 622         if ((hdl->libzfs_fd = open(ZFS_DEV, O_RDWR)) < 0) {
 623                 free(hdl);
 624                 return (NULL);
 625         }
 626 
 627         if ((hdl->libzfs_mnttab = fopen(MNTTAB, "r")) == NULL) {
 628                 (void) close(hdl->libzfs_fd);
 629                 free(hdl);
 630                 return (NULL);
 631         }
 632 
 633         hdl->libzfs_sharetab = fopen("/etc/dfs/sharetab", "r");
 634 
 635         if (libzfs_core_init() != 0) {
 636                 (void) close(hdl->libzfs_fd);
 637                 (void) fclose(hdl->libzfs_mnttab);
 638                 (void) fclose(hdl->libzfs_sharetab);
 639                 free(hdl);
 640                 return (NULL);
 641         }
 642 
 643         zfs_prop_init();
 644         zpool_prop_init();
 645         zpool_feature_init();
 646         libzfs_mnttab_init(hdl);
 647 
 648         return (hdl);
 649 }
 650 
 651 void
 652 libzfs_fini(libzfs_handle_t *hdl)
 653 {




 607 void
 608 libzfs_print_on_error(libzfs_handle_t *hdl, boolean_t printerr)
 609 {
 610         hdl->libzfs_printerr = printerr;
 611 }
 612 
 613 libzfs_handle_t *
 614 libzfs_init(void)
 615 {
 616         libzfs_handle_t *hdl;
 617 
 618         if ((hdl = calloc(1, sizeof (libzfs_handle_t))) == NULL) {
 619                 return (NULL);
 620         }
 621 
 622         if ((hdl->libzfs_fd = open(ZFS_DEV, O_RDWR)) < 0) {
 623                 free(hdl);
 624                 return (NULL);
 625         }
 626 
 627         if ((hdl->libzfs_mnttab = fopen(MNTTAB, "rF")) == NULL) {
 628                 (void) close(hdl->libzfs_fd);
 629                 free(hdl);
 630                 return (NULL);
 631         }
 632 
 633         hdl->libzfs_sharetab = fopen("/etc/dfs/sharetab", "rF");
 634 
 635         if (libzfs_core_init() != 0) {
 636                 (void) close(hdl->libzfs_fd);
 637                 (void) fclose(hdl->libzfs_mnttab);
 638                 (void) fclose(hdl->libzfs_sharetab);
 639                 free(hdl);
 640                 return (NULL);
 641         }
 642 
 643         zfs_prop_init();
 644         zpool_prop_init();
 645         zpool_feature_init();
 646         libzfs_mnttab_init(hdl);
 647 
 648         return (hdl);
 649 }
 650 
 651 void
 652 libzfs_fini(libzfs_handle_t *hdl)
 653 {