dist_noinst_HEADERS += \
include/all-io.h \
- include/at.h \
include/bitops.h \
include/blkdev.h \
include/canonicalize.h \
+++ /dev/null
-/*
- * wrappers for "at" functions.
- *
- * Copyright (C) 2010 Karel Zak <kzak@redhat.com>
- *
- * This file may be redistributed under the terms of the
- * GNU Lesser General Public License.
- */
-#ifndef UTIL_LINUX_AT_H
-#define UTIL_LINUX_AT_H
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "c.h"
-
-extern FILE *fopen_at(int dir, const char *filename,
- int flags, const char *mode);
-
-#endif /* UTIL_LINUX_AT_H */
return ret;
}
+static inline FILE *fopen_at(int dir, const char *filename,
+ int flags, const char *mode)
+{
+ int fd = openat(dir, filename, flags);
+ if (fd < 0)
+ return NULL;
+
+ return fdopen(fd, mode);
+}
+
static inline int is_same_inode(const int fd, const struct stat *st)
{
struct stat f;
noinst_LTLIBRARIES += libcommon.la
libcommon_la_CFLAGS = $(AM_CFLAGS)
libcommon_la_SOURCES = \
- lib/at.c \
lib/blkdev.c \
lib/canonicalize.c \
lib/crc32.c \
test_randutils_SOURCES = lib/randutils.c
test_randutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM
-test_procutils_SOURCES = lib/procutils.c lib/at.c
+test_procutils_SOURCES = lib/procutils.c
test_procutils_CFLAGS = $(AM_CFLAGS) -DTEST_PROGRAM
if LINUX
+++ /dev/null
-/*
- * Portable xxxat() functions.
- *
- * No copyright is claimed. This code is in the public domain; do with
- * it what you wish.
- *
- * Written by Karel Zak <kzak@redhat.com>
- */
-#include <stdio.h>
-#include <fcntl.h>
-
-#include "at.h"
-#include "c.h"
-
-FILE *fopen_at(int dir, const char *filename, int flags,
- const char *mode)
-{
- int fd = openat(dir, filename, flags);
-
- if (fd < 0)
- return NULL;
-
- return fdopen(fd, mode);
-}
#include <ctype.h>
#include "procutils.h"
-#include "at.h"
+#include "fileutils.h"
#include "all-io.h"
#include "c.h"
#include <fcntl.h>
#include <sys/stat.h>
-#include "at.h"
+#include "fileutils.h"
#include "mangle.h"
#include "mountP.h"
#include "pathnames.h"