Fix unused parameter warnings
[cu.git] / bsd.c
blob3e520cf247d0d9c4fcd4e3ed6aac6372644264f3
1 /* -*- Mode: C ; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2 -*- */
2 /*
3 * Copyright (c) 2013-2023 Nedko Arnaudov
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
14 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
15 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #include <unistd.h>
19 #include <sys/time.h>
20 #include <sys/resource.h>
22 void closefrom(int start)
24 struct rlimit max_fds;
25 rlim_t fd;
27 getrlimit(RLIMIT_NOFILE, &max_fds);
29 for (fd = start; fd < max_fds.rlim_cur; fd++) {
30 close(fd);