Artifact d62e07fe874274aa5ed1080d5c8e9592274186b8:
0000: 66 69 6c 65 64 0a 3d 3d 3d 3d 3d 0a 0a 49 6e 74 filed.=====..Int
0010: 72 6f 64 75 63 74 69 6f 6e 0a 2d 2d 2d 2d 2d 2d roduction.------
0020: 2d 2d 2d 2d 2d 2d 0a 22 66 69 6c 65 64 22 20 69 ------."filed" i
0030: 73 20 61 20 73 69 6d 70 6c 65 20 48 54 54 50 20 s a simple HTTP
0040: 73 65 72 76 65 72 20 66 6f 72 20 73 65 72 76 69 server for servi
0050: 6e 67 20 6c 6f 63 61 6c 20 73 74 61 74 69 63 20 ng local static
0060: 66 69 6c 65 73 20 6f 76 65 72 20 48 54 54 50 20 files over HTTP
0070: 66 72 6f 6d 0a 4c 69 6e 75 78 2e 20 49 74 20 64 from.Linux. It d
0080: 6f 65 73 20 74 68 65 20 6c 65 61 73 74 20 61 6d oes the least am
0090: 6f 75 6e 74 20 6f 66 20 65 66 66 6f 72 74 20 70 ount of effort p
00a0: 6f 73 73 69 62 6c 65 20 74 6f 20 67 65 74 20 74 ossible to get t
00b0: 6f 20 74 68 65 20 70 6f 69 6e 74 20 6f 66 0a 68 o the point of.h
00c0: 61 6e 64 69 6e 67 20 74 68 65 20 61 63 74 75 61 anding the actua
00d0: 6c 20 74 72 61 6e 73 66 65 72 20 6f 76 65 72 20 l transfer over
00e0: 74 6f 20 74 68 65 20 6b 65 72 6e 65 6c 2e 0a 0a to the kernel...
00f0: 49 74 20 69 73 20 6d 75 6c 74 69 74 68 72 65 61 It is multithrea
0100: 64 65 64 20 77 68 65 72 65 20 65 76 65 72 79 20 ded where every
0110: 74 68 72 65 61 64 20 73 65 72 76 69 63 65 73 20 thread services
0120: 61 20 73 69 6e 67 6c 65 20 63 6f 6e 63 75 72 72 a single concurr
0130: 65 6e 74 20 63 6c 69 65 6e 74 2e 0a 49 74 20 61 ent client..It a
0140: 74 74 65 6d 70 74 73 20 74 6f 20 72 65 64 75 63 ttempts to reduc
0150: 65 20 6c 61 74 65 6e 63 79 20 62 79 20 63 61 63 e latency by cac
0160: 68 69 6e 67 20 6f 70 65 6e 20 66 69 6c 65 20 64 hing open file d
0170: 65 73 63 72 69 70 74 6f 72 73 20 61 73 20 77 65 escriptors as we
0180: 6c 6c 2e 0a 0a 49 74 20 68 61 73 20 6e 6f 20 63 ll...It has no c
0190: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 66 69 6c onfiguration fil
01a0: 65 20 61 6e 64 20 73 75 70 70 6f 72 74 73 20 6f e and supports o
01b0: 6e 6c 79 20 6d 69 6e 69 6d 61 6c 20 63 6f 6e 66 nly minimal conf
01c0: 69 67 75 72 61 74 69 6f 6e 2e 0a 4f 70 65 72 61 iguration..Opera
01d0: 74 69 6f 6e 20 69 73 20 64 65 73 63 72 69 62 65 tion is describe
01e0: 64 20 69 6e 20 74 68 65 20 6d 61 6e 75 61 6c 20 d in the manual
01f0: 70 61 67 65 2e 0a 0a 55 73 61 67 65 0a 2d 2d 2d page...Usage.---
0200: 2d 2d 0a 54 68 65 20 73 69 6d 70 6c 65 73 74 20 --.The simplest
0210: 75 73 61 67 65 20 6f 66 20 22 66 69 6c 65 64 22 usage of "filed"
0220: 20 69 73 20 74 6f 20 72 75 6e 20 69 74 20 77 69 is to run it wi
0230: 74 68 20 6e 6f 20 61 72 67 75 6d 65 6e 74 73 2e th no arguments.
0240: 20 20 54 68 69 73 20 77 69 6c 6c 20 73 74 61 72 This will star
0250: 74 0a 75 70 20 61 6e 20 48 54 54 50 20 73 65 72 t.up an HTTP ser
0260: 76 65 72 20 6c 69 73 74 65 6e 69 6e 67 20 6f 6e ver listening on
0270: 20 70 6f 72 74 20 38 30 20 61 6e 64 20 73 68 61 port 80 and sha
0280: 72 69 6e 67 20 6f 75 74 20 74 68 65 20 72 6f 6f ring out the roo
0290: 74 20 66 69 6c 65 73 79 73 74 65 6d 20 66 6f 72 t filesystem for
02a0: 0a 74 68 65 20 73 79 73 74 65 6d 20 61 73 20 74 .the system as t
02b0: 68 65 20 63 75 72 72 65 6e 74 20 75 73 65 72 2e he current user.
02c0: 20 20 59 6f 75 20 70 72 6f 62 61 62 6c 79 20 64 You probably d
02d0: 6f 20 6e 6f 74 20 77 61 6e 74 20 74 6f 20 73 68 o not want to sh
02e0: 61 72 65 20 6f 75 74 20 79 6f 75 72 0a 72 6f 6f are out your.roo
02f0: 74 20 66 69 6c 65 73 79 73 74 65 6d 20 73 69 6e t filesystem sin
0300: 63 65 20 74 68 61 74 20 77 69 6c 6c 20 65 78 70 ce that will exp
0310: 6f 73 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 ose information
0320: 73 75 63 68 20 61 73 20 22 2f 65 74 63 2f 70 61 such as "/etc/pa
0330: 73 73 77 64 22 20 74 6f 0a 61 6e 6f 6e 79 6d 6f sswd" to.anonymo
0340: 75 73 20 61 63 63 65 73 73 2e 20 20 59 6f 75 20 us access. You
0350: 70 72 6f 62 61 62 6c 79 20 61 6c 73 6f 20 64 6f probably also do
0360: 6e 27 74 20 77 61 6e 74 20 74 6f 20 64 6f 20 74 n't want to do t
0370: 68 61 74 20 61 73 20 72 6f 6f 74 20 73 69 6e 63 hat as root sinc
0380: 65 20 74 68 65 6e 0a 73 65 6e 73 69 74 69 76 65 e then.sensitive
0390: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 73 75 63 information suc
03a0: 68 20 61 73 20 22 2f 65 74 63 2f 73 68 61 64 6f h as "/etc/shado
03b0: 77 22 20 63 6f 75 6c 64 20 62 65 20 75 73 65 64 w" could be used
03c0: 20 74 6f 20 63 6f 6d 70 72 6f 6d 69 73 65 20 74 to compromise t
03d0: 68 65 0a 73 79 73 74 65 6d 2e 0a 0a 54 68 65 72 he.system...Ther
03e0: 65 66 6f 72 65 2c 20 74 68 65 20 22 2d 2d 75 73 efore, the "--us
03f0: 65 72 22 20 61 6e 64 20 22 2d 2d 72 6f 6f 74 22 er" and "--root"
0400: 20 6f 70 74 69 6f 6e 73 20 73 68 6f 75 6c 64 20 options should
0410: 62 65 20 75 73 65 64 20 74 6f 20 73 70 65 63 69 be used to speci
0420: 66 79 20 61 20 75 73 65 72 0a 66 6f 72 20 22 66 fy a user.for "f
0430: 69 6c 65 64 22 20 74 6f 20 72 75 6e 20 61 73 20 iled" to run as
0440: 69 6e 20 61 64 64 69 74 69 6f 6e 20 74 6f 20 61 in addition to a
0450: 20 64 69 72 65 63 74 6f 72 79 20 74 6f 20 63 68 directory to ch
0460: 61 6e 67 65 20 72 6f 6f 74 20 28 63 68 72 6f 6f ange root (chroo
0470: 74 28 32 29 29 20 74 6f 0a 70 72 69 6f 72 20 74 t(2)) to.prior t
0480: 6f 20 73 65 72 76 69 6e 67 20 6f 75 74 20 66 69 o serving out fi
0490: 6c 65 73 2e 0a 0a 45 78 61 6d 70 6c 65 20 31 2c les...Example 1,
04a0: 20 69 6e 73 65 63 75 72 65 20 66 69 6c 65 20 73 insecure file s
04b0: 68 61 72 69 6e 67 3a 0a 09 24 20 66 69 6c 65 64 haring:..$ filed
04c0: 0a 0a 45 78 61 6d 70 6c 65 20 32 2c 20 73 68 61 ..Example 2, sha
04d0: 72 69 6e 67 20 73 65 6e 73 69 74 69 76 65 20 69 ring sensitive i
04e0: 6e 66 6f 72 6d 61 74 69 6f 6e 3a 0a 09 23 20 66 nformation:..# f
04f0: 69 6c 65 64 0a 0a 45 78 61 6d 70 6c 65 20 33 2c iled..Example 3,
0500: 20 73 68 61 72 69 6e 67 20 6f 6e 6c 79 20 61 20 sharing only a
0510: 73 70 65 63 69 66 69 63 20 64 69 72 65 63 74 6f specific directo
0520: 72 79 3a 0a 09 23 20 66 69 6c 65 64 20 2d 2d 72 ry:..# filed --r
0530: 6f 6f 74 20 2f 77 77 77 20 2d 2d 75 73 65 72 20 oot /www --user
0540: 6e 6f 62 6f 64 79 0a 0a 45 78 61 6d 70 6c 65 20 nobody..Example
0550: 34 2c 20 72 75 6e 6e 69 6e 67 20 61 73 20 61 20 4, running as a
0560: 64 61 65 6d 6f 6e 3a 0a 09 23 20 66 69 6c 65 64 daemon:..# filed
0570: 20 2d 2d 72 6f 6f 74 20 2f 77 77 77 20 2d 2d 75 --root /www --u
0580: 73 65 72 20 6e 6f 62 6f 64 79 20 2d 2d 64 61 65 ser nobody --dae
0590: 6d 6f 6e 0a 0a 42 75 69 6c 64 20 54 69 6d 65 20 mon..Build Time
05a0: 43 6f 6e 73 69 64 65 72 61 74 69 6f 6e 73 0a 2d Considerations.-
05b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
05c0: 2d 2d 2d 2d 2d 2d 2d 2d 0a 49 6e 20 67 65 6e 65 --------.In gene
05d0: 72 61 6c 2c 20 69 74 20 69 73 20 62 65 73 74 20 ral, it is best
05e0: 74 6f 20 6c 65 61 76 65 20 61 6c 6c 20 63 6f 6e to leave all con
05f0: 66 69 67 75 72 61 74 69 6f 6e 20 74 6f 20 72 75 figuration to ru
0600: 6e 2d 74 69 6d 65 20 73 6f 20 74 68 61 74 20 61 n-time so that a
0610: 0a 63 6f 6d 70 69 6c 65 64 20 62 69 6e 61 72 79 .compiled binary
0620: 20 63 61 6e 20 64 6f 20 61 73 20 6d 75 63 68 20 can do as much
0630: 61 73 20 70 6f 73 73 69 62 6c 65 20 77 69 74 68 as possible with
0640: 6f 75 74 20 6e 65 65 64 69 6e 67 20 74 6f 20 62 out needing to b
0650: 65 20 72 65 63 6f 6d 70 69 6c 65 64 2e 0a 48 6f e recompiled..Ho
0660: 77 65 76 65 72 2c 20 74 68 65 72 65 20 61 72 65 wever, there are
0670: 20 73 6f 6d 65 20 74 68 69 6e 67 73 20 74 68 61 some things tha
0680: 74 20 61 72 65 20 62 65 73 74 20 64 6f 6e 65 20 t are best done
0690: 61 74 20 63 6f 6d 70 69 6c 65 20 74 69 6d 65 20 at compile time
06a0: 66 6f 72 0a 76 61 72 69 6f 75 73 20 72 65 61 73 for.various reas
06b0: 6f 6e 73 2c 20 65 73 70 65 63 69 61 6c 6c 79 20 ons, especially
06c0: 69 6e 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 70 in the name of p
06d0: 65 72 66 6f 72 6d 61 6e 63 65 20 6f 72 20 65 78 erformance or ex
06e0: 65 63 75 74 61 62 6c 65 20 73 69 7a 65 2e 0a 0a ecutable size...
06f0: 66 69 6c 65 64 20 61 64 6d 69 74 73 20 74 68 6f filed admits tho
0700: 73 65 20 74 72 61 64 65 2d 6f 66 66 73 20 61 72 se trade-offs ar
0710: 65 20 6f 63 63 61 73 69 6f 6e 61 6c 6c 79 20 72 e occasionally r
0720: 65 71 75 69 72 65 64 20 61 6e 64 20 6f 66 66 65 equired and offe
0730: 72 73 20 74 68 65 0a 66 6f 6c 6c 6f 77 69 6e 67 rs the.following
0740: 20 74 75 6e 61 62 6c 65 73 20 74 68 61 74 20 63 tunables that c
0750: 61 6e 20 6f 6e 6c 79 20 62 65 20 74 6f 67 67 6c an only be toggl
0760: 65 64 20 64 75 72 69 6e 67 20 63 6f 6d 70 69 6c ed during compil
0770: 65 2d 74 69 6d 65 3a 0a 0a 20 20 20 31 2e 20 4c e-time:.. 1. L
0780: 6f 67 67 69 6e 67 20 28 43 46 4c 41 47 53 2c 20 ogging (CFLAGS,
0790: 2d 44 46 49 4c 45 44 5f 44 4f 4e 54 5f 4c 4f 47 -DFILED_DONT_LOG
07a0: 3d 31 29 0a 09 49 74 20 69 73 20 70 6f 73 73 69 =1)..It is possi
07b0: 62 6c 65 20 74 6f 20 64 69 73 61 62 6c 65 20 41 ble to disable A
07c0: 4c 4c 20 6c 6f 67 67 69 6e 67 20 66 72 6f 6d 20 LL logging from
07d0: 66 69 6c 65 64 2e 20 20 57 68 65 6e 20 6c 6f 67 filed. When log
07e0: 67 69 6e 67 20 69 73 0a 09 63 6f 6d 70 6c 65 74 ging is..complet
07f0: 65 6c 79 20 64 69 73 61 62 6c 65 64 20 69 6e 74 ely disabled int
0800: 65 72 6c 6f 63 6b 73 20 28 6d 75 74 65 78 65 73 erlocks (mutexes
0810: 29 20 66 6f 72 20 74 68 65 20 6c 6f 67 67 69 6e ) for the loggin
0820: 67 20 70 6f 69 6e 74 65 72 20 61 72 65 0a 09 6e g pointer are..n
0830: 6f 74 20 65 6e 67 61 67 65 64 20 61 6e 64 20 74 ot engaged and t
0840: 68 65 20 6c 6f 67 67 69 6e 67 20 66 75 6e 63 74 he logging funct
0850: 69 6f 6e 73 20 61 72 65 20 6e 6f 74 20 63 6f 6d ions are not com
0860: 70 69 6c 65 64 20 61 74 20 61 6c 6c 2e 0a 09 54 piled at all...T
0870: 68 69 73 20 72 65 73 75 6c 74 73 20 69 6e 20 61 his results in a
0880: 20 73 6c 69 67 68 74 6c 79 20 73 6d 61 6c 6c 65 slightly smalle
0890: 72 20 61 6e 64 20 66 61 73 74 65 72 20 62 69 6e r and faster bin
08a0: 61 72 79 0a 0a 20 20 20 32 2e 20 4b 69 6c 6c 20 ary.. 2. Kill
08b0: 69 64 6c 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 idle connections
08c0: 20 28 43 46 4c 41 47 53 2c 20 2d 44 46 49 4c 45 (CFLAGS, -DFILE
08d0: 44 5f 44 4f 4e 54 5f 54 49 4d 45 4f 55 54 3d 31 D_DONT_TIMEOUT=1
08e0: 29 0a 20 20 20 20 20 20 20 20 4b 69 6c 6c 69 6e ). Killin
08f0: 67 20 69 64 6c 65 20 63 6f 6e 6e 65 63 74 69 6f g idle connectio
0900: 6e 73 20 72 65 6c 69 65 73 20 68 65 61 76 69 6c ns relies heavil
0910: 79 20 75 70 6f 6e 20 43 31 31 20 61 74 6f 6d 69 y upon C11 atomi
0920: 63 73 2e 20 20 54 68 69 73 0a 20 20 20 20 20 20 cs. This.
0930: 20 20 72 65 71 75 69 72 65 73 20 61 20 72 65 6c requires a rel
0940: 61 74 69 76 65 6c 79 20 6e 65 77 20 76 65 72 73 atively new vers
0950: 69 6f 6e 20 6f 66 20 47 43 43 20 28 34 2e 39 2b ion of GCC (4.9+
0960: 29 20 6f 72 20 6f 74 68 65 72 20 43 20 63 6f 6d ) or other C com
0970: 70 69 6c 65 72 0a 20 20 20 20 20 20 20 20 74 68 piler. th
0980: 61 74 20 69 6d 70 6c 65 6d 65 6e 74 73 20 74 68 at implements th
0990: 69 73 20 61 73 70 65 63 74 20 6f 66 20 43 31 31 is aspect of C11
09a0: 20 61 6e 64 20 73 6f 20 69 74 20 63 61 6e 20 62 and so it can b
09b0: 65 20 64 69 73 61 62 6c 65 64 20 61 74 0a 20 20 e disabled at.
09c0: 20 20 20 20 20 20 63 6f 6d 70 69 6c 65 20 74 69 compile ti
09d0: 6d 65 20 28 77 68 69 63 68 20 69 73 20 74 68 65 me (which is the
09e0: 20 6f 6e 6c 79 20 74 69 6d 65 20 69 74 20 6d 61 only time it ma
09f0: 6b 65 73 20 73 65 6e 73 65 29 2e 20 20 4f 6e 65 kes sense). One
0a00: 20 64 61 79 20 61 6e 0a 20 20 20 20 20 20 20 20 day an.
0a10: 61 6c 74 65 72 6e 61 74 65 20 69 6d 70 6c 65 6d alternate implem
0a20: 65 6e 74 61 74 69 6f 6e 20 6d 69 67 68 74 20 62 entation might b
0a30: 65 20 70 72 65 73 65 6e 74 20 74 68 61 74 20 75 e present that u
0a40: 73 65 73 20 61 20 6d 75 74 65 78 20 69 6e 73 74 ses a mutex inst
0a50: 65 61 64 0a 20 20 20 20 20 20 20 20 6f 66 20 61 ead. of a
0a60: 74 6f 6d 69 63 73 20 61 74 20 77 68 69 63 68 20 tomics at which
0a70: 70 6f 69 6e 74 20 74 68 69 73 20 64 6f 63 75 6d point this docum
0a80: 65 6e 74 61 74 69 6f 6e 20 77 69 6c 6c 20 62 65 entation will be
0a90: 20 75 70 64 61 74 65 64 2e 0a 0a 20 20 20 33 2e updated... 3.
0aa0: 20 44 65 62 75 67 67 69 6e 67 20 28 43 46 4c 41 Debugging (CFLA
0ab0: 47 53 2c 20 2d 44 46 49 4c 45 44 5f 44 45 42 55 GS, -DFILED_DEBU
0ac0: 47 3d 31 29 0a 09 54 68 69 73 20 69 73 20 61 6e G=1)..This is an
0ad0: 20 69 6e 74 65 72 6e 61 6c 20 6f 70 74 69 6f 6e internal option
0ae0: 20 61 6e 64 20 73 68 6f 75 6c 64 20 6f 6e 6c 79 and should only
0af0: 20 62 65 20 75 73 65 64 20 64 75 72 69 6e 67 20 be used during
0b00: 64 65 76 65 6c 6f 70 6d 65 6e 74 2e 0a 0a 20 20 development...
0b10: 20 34 2e 20 44 69 66 66 65 72 69 6e 67 20 48 54 4. Differing HT
0b20: 54 50 20 73 65 6d 61 6e 74 69 63 73 20 28 43 46 TP semantics (CF
0b30: 4c 41 47 53 2c 20 2d 44 46 49 4c 45 44 5f 4e 4f LAGS, -DFILED_NO
0b40: 4e 42 4c 4f 43 4b 5f 48 54 54 50 3d 31 29 0a 09 NBLOCK_HTTP=1)..
0b50: 49 74 20 69 73 20 70 6f 73 73 69 62 6c 65 20 74 It is possible t
0b60: 68 61 74 20 73 6f 6d 65 20 48 54 54 50 20 63 6c hat some HTTP cl
0b70: 69 65 6e 74 73 20 6d 61 79 20 6e 6f 74 20 70 72 ients may not pr
0b80: 6f 63 65 73 73 20 74 68 65 20 48 54 54 50 20 73 ocess the HTTP s
0b90: 74 72 65 61 6d 0a 09 62 65 69 6e 67 20 64 65 6c tream..being del
0ba0: 69 76 65 72 65 64 20 69 66 20 74 68 65 79 20 63 ivered if they c
0bb0: 61 6e 6e 6f 74 20 77 72 69 74 65 20 74 6f 20 74 annot write to t
0bc0: 68 65 20 48 54 54 50 20 73 74 72 65 61 6d 20 69 he HTTP stream i
0bd0: 74 73 65 6c 66 2e 20 20 54 68 69 73 0a 09 68 61 tself. This..ha
0be0: 73 20 6e 6f 74 20 62 65 65 6e 20 6f 62 73 65 72 s not been obser
0bf0: 76 65 64 20 79 65 74 2c 20 62 75 74 20 69 74 20 ved yet, but it
0c00: 69 73 20 70 6f 73 73 69 62 6c 65 2e 20 20 49 66 is possible. If
0c10: 20 74 68 65 73 65 20 73 65 6d 61 6e 74 69 63 73 these semantics
0c20: 20 61 72 65 0a 09 6e 65 65 64 65 64 20 28 61 6e are..needed (an
0c30: 64 20 74 68 65 79 20 73 68 6f 75 6c 64 20 6e 6f d they should no
0c40: 74 20 62 65 29 20 74 68 65 6e 20 74 68 65 79 20 t be) then they
0c50: 63 61 6e 20 62 65 20 65 6e 61 62 6c 65 64 20 77 can be enabled w
0c60: 69 74 68 20 74 68 69 73 0a 09 66 6c 61 67 20 61 ith this..flag a
0c70: 74 20 74 68 65 20 63 6f 73 74 20 6f 66 20 70 65 t the cost of pe
0c80: 72 66 6f 72 6d 61 6e 63 65 0a 0a 20 20 20 35 2e rformance.. 5.
0c90: 20 4d 49 4d 45 20 54 79 70 65 73 20 28 4d 49 4d MIME Types (MIM
0ca0: 45 54 59 50 45 53 29 0a 09 46 6f 72 20 73 69 6e ETYPES)..For sin
0cb0: 67 6c 65 2d 66 69 6c 65 20 63 6f 6e 76 69 65 6e gle-file convien
0cc0: 63 65 20 22 66 69 6c 65 64 22 20 63 6f 6d 70 69 ce "filed" compi
0cd0: 6c 65 73 20 74 68 65 20 6d 61 70 70 69 6e 67 20 les the mapping
0ce0: 6f 66 20 66 69 6c 65 0a 09 65 78 74 65 6e 73 69 of file..extensi
0cf0: 6f 6e 73 20 28 74 68 65 20 73 74 72 69 6e 67 20 ons (the string
0d00: 69 6e 20 74 68 65 20 66 69 6c 65 6e 61 6d 65 20 in the filename
0d10: 66 6f 6c 6c 6f 77 69 6e 67 20 69 74 73 20 6c 61 following its la
0d20: 73 74 20 64 6f 74 20 28 22 2e 22 29 29 0a 09 69 st dot ("."))..i
0d30: 6e 74 6f 20 74 68 65 20 65 78 65 63 75 74 61 62 nto the executab
0d40: 6c 65 2e 20 20 54 68 69 73 20 6d 61 70 70 69 6e le. This mappin
0d50: 67 20 63 6f 6d 65 73 20 66 72 6f 6d 20 61 20 66 g comes from a f
0d60: 69 6c 65 20 69 6e 20 74 68 65 20 66 6f 72 6d 61 ile in the forma
0d70: 74 20 6f 66 0a 09 09 74 79 70 65 31 20 20 20 74 t of...type1 t
0d80: 79 70 65 31 5f 65 78 74 65 6e 73 69 6f 6e 31 20 ype1_extension1
0d90: 74 79 70 65 31 5f 65 78 74 65 6e 73 69 6f 6e 32 type1_extension2
0da0: 2e 2e 2e 0a 09 09 74 79 70 65 32 20 20 20 74 79 ......type2 ty
0db0: 70 65 32 5f 65 78 74 65 6e 73 69 6f 6e 31 20 74 pe2_extension1 t
0dc0: 79 70 65 32 5f 65 78 74 65 6e 73 69 6f 6e 32 2e ype2_extension2.
0dd0: 2e 2e 0a 09 09 2e 2e 2e 0a 09 48 6f 77 65 76 65 ..........Howeve
0de0: 72 20 69 74 20 6d 61 79 20 6e 6f 74 20 62 65 20 r it may not be
0df0: 64 65 73 69 72 61 62 6c 65 20 74 6f 20 69 6e 63 desirable to inc
0e00: 6c 75 64 65 20 74 68 69 73 20 6d 61 70 70 69 6e lude this mappin
0e10: 67 2c 20 6f 72 20 69 74 20 6d 61 79 20 62 65 0a g, or it may be.
0e20: 09 64 65 73 69 72 61 62 6c 65 20 74 6f 20 75 73 .desirable to us
0e30: 65 20 79 6f 75 72 20 6f 77 6e 20 6d 61 70 70 69 e your own mappi
0e40: 6e 67 20 72 61 74 68 65 72 20 74 68 61 6e 20 74 ng rather than t
0e50: 68 65 20 64 65 66 61 75 6c 74 20 6f 6e 65 2e 20 he default one.
0e60: 20 54 68 69 73 0a 09 63 61 6e 20 62 65 20 64 6f This..can be do
0e70: 6e 65 20 62 79 20 73 70 65 63 69 66 79 69 6e 67 ne by specifying
0e80: 20 74 68 65 20 4d 49 4d 45 54 59 50 45 53 20 6d the MIMETYPES m
0e90: 61 63 72 6f 20 74 6f 20 22 6d 61 6b 65 22 2e 20 acro to "make".
0ea0: 20 49 66 20 6e 6f 0a 09 6d 61 70 70 69 6e 67 20 If no..mapping
0eb0: 69 73 20 64 65 73 69 72 65 64 2c 20 22 2f 64 65 is desired, "/de
0ec0: 76 2f 6e 75 6c 6c 22 20 6d 61 79 20 62 65 20 73 v/null" may be s
0ed0: 70 65 63 69 66 69 65 64 2e 0a 0a 4c 6f 67 20 46 pecified...Log F
0ee0: 69 6c 65 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 42 iles.---------.B
0ef0: 65 63 61 75 73 65 20 22 66 69 6c 65 64 22 20 72 ecause "filed" r
0f00: 65 6c 69 65 73 20 6f 6e 20 63 68 72 6f 6f 74 28 elies on chroot(
0f10: 32 29 20 61 6e 64 20 73 65 74 75 69 64 28 32 29 2) and setuid(2)
0f20: 2c 20 6c 6f 67 20 66 69 6c 65 73 20 63 61 6e 6e , log files cann
0f30: 6f 74 20 72 65 6c 69 61 62 6c 79 0a 62 65 20 72 ot reliably.be r
0f40: 65 2d 6f 70 65 6e 65 64 2e 20 20 49 66 20 79 6f e-opened. If yo
0f50: 75 20 6e 65 65 64 20 6c 6f 67 20 72 6f 74 61 74 u need log rotat
0f60: 69 6f 6e 20 74 68 65 6e 20 61 20 73 65 63 6f 6e ion then a secon
0f70: 64 20 70 72 6f 63 65 73 73 2c 20 77 68 69 63 68 d process, which
0f80: 20 63 61 6e 20 63 6c 6f 73 65 0a 61 6e 64 20 72 can close.and r
0f90: 65 2d 6f 70 65 6e 20 6c 6f 67 20 66 69 6c 65 73 e-open log files
0fa0: 2c 20 6d 75 73 74 20 62 65 20 75 73 65 64 2e 20 , must be used.
0fb0: 20 41 6e 79 20 70 72 6f 63 65 73 73 20 6d 61 79 Any process may
0fc0: 20 62 65 20 75 73 65 64 20 66 6f 72 20 77 72 69 be used for wri
0fd0: 74 69 6e 67 20 6c 6f 67 73 0a 62 75 74 20 69 66 ting logs.but if
0fe0: 20 74 68 65 20 70 72 6f 63 65 73 73 20 64 6f 65 the process doe
0ff0: 73 20 6e 6f 74 20 73 75 70 70 6f 72 74 20 6c 6f s not support lo
1000: 67 20 72 6f 74 61 74 69 6f 6e 20 74 68 65 6e 20 g rotation then
1010: 69 74 20 77 69 6c 6c 20 6e 6f 74 20 70 72 6f 76 it will not prov
1020: 69 64 65 20 74 68 61 74 0a 62 65 6e 65 66 69 74 ide that.benefit
1030: 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 . For example,
1040: 69 66 20 79 6f 75 20 77 69 73 68 20 74 6f 20 77 if you wish to w
1050: 72 69 74 65 20 6c 6f 67 73 20 74 6f 20 73 79 73 rite logs to sys
1060: 6c 6f 67 64 28 38 29 20 79 6f 75 20 63 61 6e 20 logd(8) you can
1070: 75 73 65 0a 6c 6f 67 67 65 72 28 31 29 2c 20 73 use.logger(1), s
1080: 75 63 68 20 61 73 3a 0a 09 23 20 2e 2f 66 69 6c uch as:..# ./fil
1090: 65 64 20 2d 2d 72 6f 6f 74 20 2f 77 77 77 20 2d ed --root /www -
10a0: 2d 75 73 65 72 20 6e 6f 62 6f 64 79 20 2d 2d 6c -user nobody --l
10b0: 6f 67 20 27 7c 6c 6f 67 67 65 72 20 2d 74 20 66 og '|logger -t f
10c0: 69 6c 65 64 27 20 2d 2d 64 61 65 6d 6f 6e 0a 0a iled' --daemon..
10d0: 54 72 6f 75 62 6c 65 73 68 6f 6f 74 69 6e 67 0a Troubleshooting.
10e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a ---------------.
10f0: 20 20 20 31 2e 20 49 74 20 77 6f 6e 27 74 20 63 1. It won't c
1100: 6f 6d 70 69 6c 65 2c 20 73 6f 6d 65 74 68 69 6e ompile, somethin
1110: 67 20 61 62 6f 75 74 20 73 74 64 61 74 6f 6d 69 g about stdatomi
1120: 63 2e 68 20 6e 6f 74 20 66 6f 75 6e 64 20 6f 72 c.h not found or
1130: 20 5f 41 74 6f 6d 69 63 20 6e 6f 74 0a 20 20 20 _Atomic not.
1140: 20 20 20 61 20 76 61 6c 69 64 20 74 79 70 65 2e a valid type.
1150: 0a 0a 20 20 20 20 20 20 3d 3e 20 54 68 69 73 20 .. => This
1160: 69 73 20 61 20 62 75 67 20 69 6e 20 79 6f 75 72 is a bug in your
1170: 20 63 6f 6d 70 69 6c 65 72 3a 0a 20 20 20 20 20 compiler:.
1180: 20 20 20 20 20 20 20 68 74 74 70 73 3a 2f 2f 67 https://g
1190: 63 63 2e 67 6e 75 2e 6f 72 67 2f 62 75 67 7a 69 cc.gnu.org/bugzi
11a0: 6c 6c 61 2f 73 68 6f 77 5f 62 75 67 2e 63 67 69 lla/show_bug.cgi
11b0: 3f 69 64 3d 35 38 30 31 36 0a 0a 20 20 20 20 20 ?id=58016..
11c0: 20 20 20 20 47 43 43 20 34 2e 37 2e 78 20 61 6e GCC 4.7.x an
11d0: 64 20 34 2e 38 2e 78 20 64 65 66 69 6e 65 20 74 d 4.8.x define t
11e0: 68 65 20 6d 61 63 72 6f 20 69 6e 64 69 63 61 74 he macro indicat
11f0: 69 6e 67 20 74 68 61 74 20 74 68 65 79 20 68 61 ing that they ha
1200: 76 65 20 43 31 31 0a 20 20 20 20 20 20 20 20 20 ve C11.
1210: 73 75 70 70 6f 72 74 20 61 6e 64 20 64 6f 20 6e support and do n
1220: 6f 74 20 64 65 66 69 6e 65 20 74 68 65 20 6d 61 ot define the ma
1230: 63 72 6f 20 74 68 61 74 20 43 31 31 20 72 65 71 cro that C11 req
1240: 75 69 72 65 73 20 74 6f 20 69 6e 64 69 63 61 74 uires to indicat
1250: 65 0a 20 20 20 20 20 20 20 20 20 74 68 61 74 20 e. that
1260: 43 31 31 20 61 74 6f 6d 69 63 73 20 61 72 65 20 C11 atomics are
1270: 6e 6f 74 20 61 76 61 69 6c 61 62 6c 65 2e 20 20 not available.
1280: 54 68 65 79 20 73 68 6f 75 6c 64 20 64 65 66 69 They should defi
1290: 6e 65 20 74 68 61 74 20 6d 61 63 72 6f 2e 0a 0a ne that macro...
12a0: 20 20 20 20 20 20 20 20 20 59 6f 75 20 63 61 6e You can
12b0: 20 64 69 73 61 62 6c 65 20 74 68 65 20 66 65 61 disable the fea
12c0: 74 75 72 65 73 20 69 6e 20 22 66 69 6c 65 64 22 tures in "filed"
12d0: 20 74 68 61 74 20 72 65 71 75 69 72 65 20 43 31 that require C1
12e0: 31 20 61 74 6f 6d 69 63 73 20 62 79 0a 20 20 20 1 atomics by.
12f0: 20 20 20 20 20 20 64 65 66 69 6e 69 6e 67 20 46 defining F
1300: 49 4c 45 44 5f 44 4f 4e 54 5f 54 49 4d 45 4f 55 ILED_DONT_TIMEOU
1310: 54 20 69 6e 20 74 68 65 20 4d 61 6b 65 66 69 6c T in the Makefil
1320: 65 2e 0a e..