1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
|
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
|
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
}
/*
* Hot-restart support
*/
/* Initiate a hot-restart */
static void appfs_hot_restart(void) {
APPFS_DEBUG("Asked to initiate hot restart");
appfs_tcl_ResetInterps();
appfs_get_path_info_cache_flush(-1, -1);
return;
}
/*
* Terminate a thread and release resources
*/
static void appfs_thread_exit(void) {
Tcl_Interp *interp;
pthread_exit(NULL);
interp = pthread_getspecific(interpKey);
if (interp != NULL) {
Tcl_DeleteInterp(interp);
}
return;
}
/*
* Signal handler
* SIGHUP initiates a hot restart
* SIGUSR1 terminates the current thread
*/
static void appfs_signal_handler(int sig) {
/* Do not handle signals until FUSE has been started */
if (!appfs_fuse_started) {
return;
}
/* Request to perform a "hot" restart */
if (sig == SIGHUP) {
appfs_hot_restart();
}
/* Request to terminate the current request/thread */
if (sig == SIGUSR1) {
appfs_thread_exit();
}
return;
}
/*
* FUSE operations structure
*/
static struct fuse_operations appfs_operations = {
|
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
|
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
|
-
+
|
fprintf(stderr, "Hot-restart will not be available.\n");
}
/*
* Add FUSE arguments which we always supply
*/
fuse_opt_parse(&args, NULL, NULL, appfs_fuse_opt_cb);
fuse_opt_add_arg(&args, "-odefault_permissions,fsname=appfs,subtype=appfsd,use_ino,kernel_cache,entry_timeout=0,attr_timeout=0,intr,big_writes,hard_remove");
fuse_opt_add_arg(&args, "-odefault_permissions,fsname=appfs,subtype=appfsd,use_ino,kernel_cache,entry_timeout=0,attr_timeout=0,big_writes,hard_remove");
if (getuid() == 0) {
fuse_opt_parse(&args, NULL, NULL, NULL);
fuse_opt_add_arg(&args, "-oallow_other");
}
/*
|