Changeset 2104:4140ab350dda in roaraudio
- Timestamp:
- 07/21/09 15:55:20 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/roard.c
r2087 r2104 29 29 #endif 30 30 31 #if defined(ROAR_HAVE_IO_POSIX) && defined(ROAR_HAVE_FS_POSIX) 32 #define SUPPORT_PIDFILE 33 char * pidfile = NULL; 34 #endif 35 31 36 #ifdef ROAR_HAVE_MAIN_ARGS 32 37 void usage (void) { … … 45 50 " --sysclocksync - calculate exact sample rate using the system clock\n" 46 51 " --location LOC - Set lion readable location of server\n" 52 #ifdef SUPPORT_PIDFILE 53 " --pidfile PIDFILE - Write a pidfile at PIDFILE\n" 54 #endif 47 55 ); 48 56 … … 533 541 char decnethost[80]; 534 542 #endif 543 #ifdef SUPPORT_PIDFILE 544 struct roar_vio_calls pidfile_vio; 545 #endif 535 546 536 547 g_standby = 0; … … 653 664 } else if ( strcmp(k, "--location") == 0 ) { 654 665 g_config->location = argv[++i]; 666 } else if ( strcmp(k, "--pidfile") == 0 ) { 667 #ifdef SUPPORT_PIDFILE 668 pidfile = argv[++i]; 669 #else 670 ROAR_ERR("--pidfile not supported"); 671 i++; 672 #endif 655 673 656 674 } else if ( strcmp(k, "--list-cf") == 0 ) { … … 1019 1037 #endif 1020 1038 1039 #ifdef SUPPORT_PIDFILE 1040 if ( roar_vio_open_file(&pidfile_vio, pidfile, O_WRONLY|O_CREAT, 0644) == -1 ) { 1041 ROAR_ERR("Can not write pidfile: %s", pidfile); 1042 } else { 1043 roar_vio_printf(&pidfile_vio, "%i\n", getpid()); 1044 roar_vio_close(&pidfile_vio); 1045 } 1046 #endif 1047 1021 1048 #ifdef ROAR_HAVE_CHROOT 1022 1049 if (chrootdir) { … … 1097 1124 midi_free(); 1098 1125 light_free(); 1126 1127 #ifdef SUPPORT_PIDFILE 1128 if ( pidfile != NULL ) 1129 unlink(pidfile); 1130 #endif 1099 1131 } 1100 1132
Note: See TracChangeset
for help on using the changeset viewer.