chiark / gitweb /
Make postinst group modification call less quiet.
[disorder] / lib / syscalls.h
CommitLineData
460b9539 1/*
2 * This file is part of DisOrder.
5aff007d 3 * Copyright (C) 2004, 2005, 2007, 2008 Richard Kettlewell
460b9539 4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18 * USA
19 */
20
21#ifndef SYSCALLS_H
22#define SYSCALLS_H
23
24/* various error-handling wrappers. Not actually all system calls! */
25
26struct sockaddr;
27struct sigaction;
28struct timezone;
29
30#include <sys/socket.h>
31#include <signal.h>
460b9539 32
33pid_t xfork(void);
8bb67afe
RK
34void xclose_guts(const char *, int, int);
35#define xclose(fd) xclose_guts(__FILE__, __LINE__, fd)
460b9539 36void xdup2(int, int);
37void xpipe(int *);
38int xfcntl(int, int, long);
39void xlisten(int, int);
40void xshutdown(int, int);
41void xsetsockopt(int, int, int, const void *, socklen_t);
42int xsocket(int, int, int);
43void xconnect(int, const struct sockaddr *, socklen_t);
44void xsigprocmask(int how, const sigset_t *set, sigset_t *oldset);
45void xsigaction(int sig, const struct sigaction *sa, struct sigaction *oldsa);
46int xprintf(const char *, ...)
47 attribute((format (printf, 1, 2)));
48void xfclose(FILE *);
49int xnice(int);
50void xgettimeofday(struct timeval *, struct timezone *);
51/* the above all call @fatal@ if the system call fails */
52
53void nonblock(int fd);
937be4c0 54void blocking(int fd);
460b9539 55void cloexec(int fd);
937be4c0 56/* make @fd@ non-blocking/blocking/close-on-exec; call @fatal@ on error. */
460b9539 57
58int mustnotbeminus1(const char *what, int value);
59/* If @value@ is -1, report an error including @what@. */
60
61int xstrtol(long *n, const char *s, char **ep, int base);
62int xstrtoll(long_long *n, const char *s, char **ep, int base);
63/* like strtol() but returns errno on error, 0 on success */
64
65#endif /* SYSCALLS_H */
66
67/*
68Local Variables:
69c-basic-offset:2
70comment-column:40
71End:
72*/