]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/unlinkd_daemon.cc
2 * DEBUG: section -- Unlink Daemon
3 * AUTHOR: Duane Wessels
5 * SQUID Web Proxy Cache http://www.squid-cache.org/
6 * ----------------------------------------------------------
8 * Squid is the result of efforts by numerous individuals from
9 * the Internet community; see the CONTRIBUTORS file for full
10 * details. Many organizations have provided support for Squid's
11 * development; see the SPONSORS file for full details. Squid is
12 * Copyrighted (C) 2001 by the Regents of the University of
13 * California; see the COPYRIGHT file for full details. Squid
14 * incorporates software developed and/or copyrighted by other
15 * sources; see the CREDITS file for full details.
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
33 #define SQUID_HELPER 1
42 \defgroup unlinkd unlinkd
43 \ingroup ExternalPrograms
45 The unlink(2) system call can cause a process to block
46 for a significant amount of time. Therefore we do not want
47 to make unlink() calls from Squid. Instead we pass them
48 to this external process.
52 #define UNLINK_BUF_LEN 1024
56 \par This is the unlinkd external process.
59 * unlinkd receives the full path of any files to be removed
60 * from stdin, each on its own line.
63 * The results for each file are printed to stdout in the order
68 \retval ERR An error occured removing the file.
69 \retval OK The file has been removed.
72 main(int argc
, char *argv
[])
74 char buf
[UNLINK_BUF_LEN
];
80 open(_PATH_DEVNULL
, O_RDWR
);
82 while (fgets(buf
, UNLINK_BUF_LEN
, stdin
)) {
83 if ((t
= strchr(buf
, '\n')))