Overview
Comment: | Allow user to specify log file |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
4540126d595023a4597cb9bea7cda448 |
User & Date: | rkeene on 2014-02-08 00:29:58 |
Other Links: | manifest | tags |
Context
2014-02-08
| ||
00:43 | Updated to open log file early (as documented) and to also flush the log file after every entry check-in: 0c9ffb4cd9 user: rkeene tags: trunk | |
00:29 | Allow user to specify log file check-in: 4540126d59 user: rkeene tags: trunk | |
00:20 | Implemented logging check-in: a31015a6d2 user: rkeene tags: trunk | |
Changes
Modified filed.1 from [88912a76e0] to [52947f6bdf].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | .IR address ] .RB [{ \-p | \-\-port } .IR port ] .RB [{ \-t | \-\-threads } .IR count ] .RB [{ \-c | \-\-cache } .IR entries ] .RB [{ \-u | \-\-user } .IR user ] .RB [{ \-r | \-\-root } .IR directory ] .ll -10 .SH DESCRIPTION | > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | .IR address ] .RB [{ \-p | \-\-port } .IR port ] .RB [{ \-t | \-\-threads } .IR count ] .RB [{ \-c | \-\-cache } .IR entries ] .RB [{ \-l | \-\-log } .IR file ] .RB [{ \-u | \-\-user } .IR user ] .RB [{ \-r | \-\-root } .IR directory ] .ll -10 .SH DESCRIPTION |
︙ | ︙ | |||
56 57 58 59 60 61 62 63 64 65 66 67 68 69 | .B -c (or --cache) Specifies the number of file information cache entries to allocate. Each cache entry holds file information as well as an open file descriptor to the file, so resource limits (i.e., ulimit) should be considered. This should be a prime number for ideal use with the lookup method. .TP .B -u (or --user) Specifies the user to switch user IDs to before servicing requests. The default is not change user IDs. .TP .B -r (or --root) | > > > > > > > > > > | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | .B -c (or --cache) Specifies the number of file information cache entries to allocate. Each cache entry holds file information as well as an open file descriptor to the file, so resource limits (i.e., ulimit) should be considered. This should be a prime number for ideal use with the lookup method. .TP .B -l (or --log) Specifies a filename to open for writing log entries. Log entries are made for various stages in transfering files. The log file is opened before switching users (see "-u") and root directories (see "-r"). The log file is never closed so log rotation without stopping the daemon is will not work. The value of "-" indicates that standard output should be used for logging. .TP .B -u (or --user) Specifies the user to switch user IDs to before servicing requests. The default is not change user IDs. .TP .B -r (or --root) |
︙ | ︙ |
Modified filed.c from [c536c43e85] to [fcb400b744].
︙ | ︙ | |||
844 845 846 847 848 849 850 851 852 853 854 855 856 857 | fprintf(output, " Options:\n"); fprintf(output, " -h, --help\n"); fprintf(output, " -d, --daemon\n"); fprintf(output, " -b <address>, --bind <address>\n"); fprintf(output, " -p <port>, --port <port>\n"); fprintf(output, " -t <count>, --threads <count>\n"); fprintf(output, " -c <entries>, --cache <entries>\n"); fprintf(output, " -u <user>, --user <user>\n"); fprintf(output, " -r <directory>, --root <directory>\n"); if (long_help) { fprintf(output, "\n"); fprintf(output, " Usage:\n"); fprintf(output, " -h (or --help) prints this usage information\n"); | > | 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 | fprintf(output, " Options:\n"); fprintf(output, " -h, --help\n"); fprintf(output, " -d, --daemon\n"); fprintf(output, " -b <address>, --bind <address>\n"); fprintf(output, " -p <port>, --port <port>\n"); fprintf(output, " -t <count>, --threads <count>\n"); fprintf(output, " -c <entries>, --cache <entries>\n"); fprintf(output, " -l <file>, --log <file>\n"); fprintf(output, " -u <user>, --user <user>\n"); fprintf(output, " -r <directory>, --root <directory>\n"); if (long_help) { fprintf(output, "\n"); fprintf(output, " Usage:\n"); fprintf(output, " -h (or --help) prints this usage information\n"); |
︙ | ︙ | |||
874 875 876 877 878 879 880 881 882 883 884 885 886 887 | fprintf(output, " -c (or --cache) specifies the number of file information cache entries\n"); fprintf(output, " to allocate. Each cache entry holds file information as\n"); fprintf(output, " well as an open file descriptor to the file, so resource\n"); fprintf(output, " limits (i.e., ulimit) should be considered. This should\n"); fprintf(output, " be a prime number for ideal use with the lookup method.\n"); fprintf(output, " The default is %lu.\n", (unsigned long) CACHE_SIZE); fprintf(output, "\n"); fprintf(output, " -u (or --user) specifies the user to switch user IDs to before servicing\n"); fprintf(output, " requests. The default is not change user IDs.\n"); fprintf(output, "\n"); fprintf(output, " -r (or --root) specifies the directory to act as the root directory for\n"); fprintf(output, " the file server. If this option is specified, chroot(2)\n"); fprintf(output, " is called. The default is not change root directories,\n"); fprintf(output, " that is, the \"/\" directory is shared out. This will\n"); | > > > > > > > > | 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 | fprintf(output, " -c (or --cache) specifies the number of file information cache entries\n"); fprintf(output, " to allocate. Each cache entry holds file information as\n"); fprintf(output, " well as an open file descriptor to the file, so resource\n"); fprintf(output, " limits (i.e., ulimit) should be considered. This should\n"); fprintf(output, " be a prime number for ideal use with the lookup method.\n"); fprintf(output, " The default is %lu.\n", (unsigned long) CACHE_SIZE); fprintf(output, "\n"); fprintf(output, " -l (or --log) specifies a filename to open for writing log entries. Log\n"); fprintf(output, " entries are made for various stages in transfering files.\n"); fprintf(output, " The log file is opened before switching users (see \"-u\")\n"); fprintf(output, " and root directories (see \"-r\"). The log file is never\n"); fprintf(output, " closed so log rotation without stopping the daemon is will\n"); fprintf(output, " not work. The value of \"-\" indicates that standard output\n"); fprintf(output, " should be used for logging. The default is \"%s\".\n", LOG_FILE); fprintf(output, "\n"); fprintf(output, " -u (or --user) specifies the user to switch user IDs to before servicing\n"); fprintf(output, " requests. The default is not change user IDs.\n"); fprintf(output, "\n"); fprintf(output, " -r (or --root) specifies the directory to act as the root directory for\n"); fprintf(output, " the file server. If this option is specified, chroot(2)\n"); fprintf(output, " is called. The default is not change root directories,\n"); fprintf(output, " that is, the \"/\" directory is shared out. This will\n"); |
︙ | ︙ | |||
991 992 993 994 995 996 997 | close(fd_out); return(0); } /* Run process */ int main(int argc, char **argv) { | | | > | | 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 | close(fd_out); return(0); } /* Run process */ int main(int argc, char **argv) { struct option options[10]; const char *bind_addr = BIND_ADDR, *newroot = NULL, *log_file = LOG_FILE; uid_t user = 0; int port = PORT, thread_count = THREAD_COUNT; int cache_size = CACHE_SIZE; int init_ret, chroot_ret, setuid_ret, lookup_ret, chdir_ret; int setuid_enabled = 0, daemon_enabled = 0; int ch; int fd; /* Process arguments */ filed_getopt_long_setopt(&options[0], "port", required_argument, 'p'); filed_getopt_long_setopt(&options[1], "threads", required_argument, 't'); filed_getopt_long_setopt(&options[2], "cache", required_argument, 'c'); filed_getopt_long_setopt(&options[3], "bind", required_argument, 'b'); filed_getopt_long_setopt(&options[4], "user", required_argument, 'u'); filed_getopt_long_setopt(&options[5], "root", required_argument, 'r'); filed_getopt_long_setopt(&options[6], "help", no_argument, 'h'); filed_getopt_long_setopt(&options[7], "daemon", no_argument, 'd'); filed_getopt_long_setopt(&options[8], "log", required_argument, 'l'); filed_getopt_long_setopt(&options[9], NULL, 0, 0); while ((ch = getopt_long(argc, argv, "p:t:c:b:u:r:l:hd", options, NULL)) != -1) { switch(ch) { case 'p': port = atoi(optarg); break; case 't': thread_count = atoi(optarg); break; |
︙ | ︙ | |||
1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 | return(1); } break; case 'r': newroot = strdup(optarg); break; case 'd': daemon_enabled = 1; break; case '?': case ':': filed_print_help(stderr, 0, NULL); | > > > | 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 | return(1); } break; case 'r': newroot = strdup(optarg); break; case 'l': log_file = strdup(optarg); break; case 'd': daemon_enabled = 1; break; case '?': case ':': filed_print_help(stderr, 0, NULL); |
︙ | ︙ |