Page MenuHomeFreeBSD

D38460.id116834.diff
No OneTemporary

D38460.id116834.diff

diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -154,6 +154,7 @@
telldir.c \
termios.c \
time.c \
+ timerfd.c \
times.c \
timespec_get.c \
timezone.c \
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -436,6 +436,9 @@
};
FBSD_1.7 {
+ timerfd_create;
+ timerfd_gettime;
+ timerfd_settime;
posix_spawn_file_actions_addchdir_np;
posix_spawn_file_actions_addclosefrom_np;
posix_spawn_file_actions_addfchdir_np;
diff --git a/lib/libc/gen/timerfd.c b/lib/libc/gen/timerfd.c
new file mode 100644
--- /dev/null
+++ b/lib/libc/gen/timerfd.c
@@ -0,0 +1,68 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2023 Jake Freeland <jfree@FreeBSD.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/specialfd.h>
+#include <sys/timerfd.h>
+
+#include <unistd.h>
+
+#include "namespace.h"
+#include "un-namespace.h"
+#include "libc_private.h"
+
+int timerfd_create(int clockid, int flags)
+{
+ struct specialfd_timerfd_create args;
+
+ args.clockid = clockid;
+ args.flags = flags;
+ return (__sys___specialfd(SPECIALFD_TIMERFD_CREATE, &args, sizeof(args)));
+}
+
+int timerfd_gettime(int fd, struct itimerspec *curr_value)
+{
+ struct specialfd_timerfd_gettime args;
+
+ args.fd = fd;
+ args.curr_value = curr_value;
+ return (__sys___specialfd(SPECIALFD_TIMERFD_GETTIME, &args, sizeof(args)));
+}
+
+int timerfd_settime(int fd, int flags, const struct itimerspec *new_value,
+ struct itimerspec *old_value)
+{
+ struct specialfd_timerfd_settime args;
+
+ args.fd = fd;
+ args.flags = flags;
+ args.new_value = new_value;
+ args.old_value = old_value;
+ return (__sys___specialfd(SPECIALFD_TIMERFD_SETTIME, &args, sizeof(args)));
+}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 23, 1:01 PM (6 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26014371
Default Alt Text
D38460.id116834.diff (3 KB)

Event Timeline