Overview
Comment: | Updated to support arguments, updated hashing algorithm, and minor cleanup |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
613c9bd3465ee12adca5240bbe844c47 |
User & Date: | rkeene on 2014-02-06 20:43:30 |
Other Links: | manifest | tags |
Context
2014-02-06
| ||
22:37 | Changed default port to 80 and added man page check-in: a00dfe0a20 user: rkeene tags: trunk | |
20:43 | Updated to support arguments, updated hashing algorithm, and minor cleanup check-in: 613c9bd346 user: rkeene tags: trunk | |
08:42 | Updated to use off_t to represent disk sizes check-in: b040037186 user: rkeene tags: trunk | |
Changes
Modified Makefile from [e246314724] to [982e814a3a].
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | CC = gcc CFLAGS = -Wall -Werror -W -pthread -O3 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE |
︙ |
Modified filed.c from [5f7a2da005] to [d5944384cb].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | + + + - - + - + | #include <sys/sendfile.h> #include <sys/socket.h> #include <sys/types.h> #include <arpa/inet.h> #include <sys/mman.h> #include <sys/stat.h> #include <pthread.h> #include <strings.h> #include <signal.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <getopt.h> #include <fcntl.h> #include <stdio.h> #include <errno.h> #include <time.h> #include <pwd.h> /* Compile time constants */ #define FILED_SENDFILE_MAX 16777215 #define MAX_FAILURE_COUNT 30 /* Default values */ |
︙ | |||
58 59 60 61 62 63 64 | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | off_t length; /*** Range length ***/ } range; } headers; }; /* Global variables */ /** Open File cache **/ |
︙ | |||
149 150 151 152 153 154 155 | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | - + + - + + + + + + + + + - - + + | static void filed_log_msg(const char *buffer) { /* XXX:TODO: Unimplemented */ fprintf(stderr, "%s\n", buffer); return; } |
︙ | |||
636 637 638 639 640 641 642 643 644 645 646 | 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + | if (pthread_ret != 0) { return(-1); } } return(0); } /* Display help */ static void filed_print_help(FILE *output, const char *extra) { if (extra) { fprintf(output, "%s\n", extra); } fprintf(output, "Usage: filed [<options>]\n"); return; } /* Add a getopt option */ static void filed_getopt_long_setopt(struct option *opt, const char *name, int has_arg, int val) { opt->name = name; opt->has_arg = has_arg; opt->flag = NULL; opt->val = val; return; } /* Resolve a username to a UID */ static int filed_user_lookup(const char *user, uid_t *user_id) { struct passwd *ent; ent = getpwnam(user); if (ent == NULL) { return(1); } *user_id = ent->pw_uid; return(0); } /* Run process */ int main(int argc, char **argv) { struct option options[8]; const char *bind_addr = BIND_ADDR, *newroot = NULL; uid_t user = 0; int port = PORT, thread_count = THREAD_COUNT; |
︙ |