[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [UNIKRAFT RFC PATCH] Added the irq-safe (I hope) memcpy in isrlibc
Hi Christian,thanks a lot for this RFC regarding issue to have IRQ-safe libc functions for interrupts. It is a really important component that we are going to need. First of all, thanks a lot for your work! I understand that you copied nolibc as base but I do not think we need all defintions and all provided functionality for driving interrupt contexts. The `isrlib` should not stay in conflict to any libc (nolibc, newlib, or musl). It will always be used together with one of them. I would not copy everything from nolibc, it is better to start the library from scratch and add functions as they come and get needed. This makes the patch also much smaller. I add some more comments inline. I am looking forward to your next RPC. Thanks a lot, Simon On 31.07.20 13:05, cristian-vijelie wrote: --- lib/Makefile.uk | 1 + lib/isrlibc/Config.uk | 16 ++ lib/isrlibc/Makefile.uk | 28 ++++ lib/isrlibc/arch/arm/bits/fcntl.h | 40 +++++ lib/isrlibc/arch/arm64/bits/fcntl.h | 38 +++++ lib/isrlibc/arch/x86_64/bits/fcntl.h | 40 +++++ lib/isrlibc/exportsyms.uk | 2 + .../include/isrlibc-internal/shareddefs.h | 146 ++++++++++++++++++ lib/isrlibc/include/string.h | 53 +++++++ lib/isrlibc/include/sys/file.h | 21 +++ lib/isrlibc/include/sys/mount.h | 109 +++++++++++++ lib/isrlibc/include/sys/param.h | 38 +++++ lib/isrlibc/include/sys/select.h | 82 ++++++++++ lib/isrlibc/include/sys/stat.h | 135 ++++++++++++++++ lib/isrlibc/include/sys/statfs.h | 36 +++++ lib/isrlibc/include/sys/statvfs.h | 54 +++++++ lib/isrlibc/include/sys/types.h | 69 +++++++++ lib/isrlibc/include/sys/uio.h | 76 +++++++++ lib/isrlibc/string.c | 16 ++ 19 files changed, 1000 insertions(+) create mode 100644 lib/isrlibc/Config.uk create mode 100644 lib/isrlibc/Makefile.uk create mode 100644 lib/isrlibc/arch/arm/bits/fcntl.h create mode 100644 lib/isrlibc/arch/arm64/bits/fcntl.h create mode 100644 lib/isrlibc/arch/x86_64/bits/fcntl.h create mode 100644 lib/isrlibc/exportsyms.uk create mode 100644 lib/isrlibc/include/isrlibc-internal/shareddefs.h create mode 100644 lib/isrlibc/include/string.h create mode 100644 lib/isrlibc/include/sys/file.h create mode 100644 lib/isrlibc/include/sys/mount.h create mode 100644 lib/isrlibc/include/sys/param.h create mode 100644 lib/isrlibc/include/sys/select.h create mode 100644 lib/isrlibc/include/sys/stat.h create mode 100644 lib/isrlibc/include/sys/statfs.h create mode 100644 lib/isrlibc/include/sys/statvfs.h create mode 100644 lib/isrlibc/include/sys/types.h create mode 100644 lib/isrlibc/include/sys/uio.h create mode 100644 lib/isrlibc/string.c diff --git a/lib/Makefile.uk b/lib/Makefile.uk index aa7e730..b43234b 100644 --- a/lib/Makefile.uk +++ b/lib/Makefile.uk @@ -11,6 +11,7 @@ $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/posix-sysinfo)) $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukdebug)) $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukargparse)) $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/uktimeconv)) +$(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/isrlibc)) $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/nolibc)) $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukalloc)) $(eval $(call _import_lib,$(CONFIG_UK_BASE)/lib/ukallocbbuddy)) diff --git a/lib/isrlibc/Config.uk b/lib/isrlibc/Config.uk new file mode 100644 index 0000000..b4d4b5a --- /dev/null +++ b/lib/isrlibc/Config.uk @@ -0,0 +1,16 @@ +menuconfig LIBISRLIBC + bool "isrlibc: IRQ-safe subset of libc functionality" I remember we briefly discussed to call it `isrlibc`. In the meantime, I think naming it just `isrlib` would fit better since it is not a libc anymore. It provides helpers for developing isr handlers. What do you think? + depends on !HAVE_LIBC + default y if !HAVE_LIBC + imply LIBUKTIME + +if LIBISRLIBC + config LIBISRLIBC_UKDEBUG_ASSERT + bool "Implement assertions with libukdebug" + default y if LIBUKDEBUG + default n + help + Assertions (`assert()` defined in `<assert.h>`) are mapped to `UK_ASSERT()`. + If selected, please note that libc assertions are also removed from the code + when assertions are disabled in libukdebug. +endif diff --git a/lib/isrlibc/Makefile.uk b/lib/isrlibc/Makefile.uk new file mode 100644 index 0000000..42e0e85 --- /dev/null +++ b/lib/isrlibc/Makefile.uk @@ -0,0 +1,28 @@ +$(eval $(call addlib_s,libisrlibc,$(CONFIG_LIBISRLIBC))) + +LIBISRLIBC_NO_EXTENDED += -mno-mmx +LIBISRLIBC_NO_EXTENDED += -mno-sse +LIBISRLIBC_NO_EXTENDED += -mno-sse2 +LIBISRLIBC_NO_EXTENDED += -mno-sse3 +LIBISRLIBC_NO_EXTENDED += -mno-ssse3 +LIBISRLIBC_NO_EXTENDED += -mno-sse4 +LIBISRLIBC_NO_EXTENDED += -mno-sse4a +LIBISRLIBC_NO_EXTENDED += -mno-sse4.1 +LIBISRLIBC_NO_EXTENDED += -mno-sse4.2 +LIBISRLIBC_NO_EXTENDED += -mno-avx +LIBISRLIBC_NO_EXTENDED += -mfpmath=387 Instead of defining the flags by the library, assign the source files to the extra `|isr` variant. Depending on the target architecture, you are going to have different flags to disable extended registers. The architectures already define those for the special ISR variant. You can read about the "special" ISR variant here: http://docs.unikraft.org/developers-app.html#makefile-uk I think the first version of the library will have just the following includes:+ +CFLAGS-$(CONFIG_LIBISRLIBC) += $(LIBISRLIBC_NO_EXTENDED) +CXXFLAGS-$(CONFIG_LIBISRLIBC) += $(LIBISRLIBC_NO_EXTENDED) + +LIBISRLIBC_GLOBAL_INCLUDES-y += -I$(LIBISRLIBC_BASE)/include +LIBISRLIBC_GLOBAL_INCLUDES-y += -I$(LIBISRLIBC_BASE)/arch/$(ARCH) +LIBISRLIBC_GLOBAL_INCLUDES-y += -I$(LIBISRLIBC_BASE)/musl-imported/include +LIBISRLIBC_GLOBAL_INCLUDES-y += -I$(LIBISRLIBC_BASE)/musl-imported/arch/generic +CINCLUDES-$(CONFIG_LIBISRLIBC) += $(LIBISRLIBC_GLOBAL_INCLUDES-y) +CXXINCLUDES-$(CONFIG_LIBISRLIBC) += $(LIBISRLIBC_GLOBAL_INCLUDES-y) > +CINCLUDES-$(CONFIG_LIBISRLIBC) += -I$(LIBISRLIBC_BASE)/include > +CXXINCLUDES-$(CONFIG_LIBISRLIBC) += -I$(LIBISRLIBC_BASE)/include + +LIBISRLIBC_SRCS-y += $(LIBISRLIBC_BASE)/string.c To compile the file with the ISR-safe variant would look like: LIBISRLIBC_SRCS-y += $(LIBISRLIBC_BASE)/string.c|isr + +# Localize internal symbols (starting with __*) +LIBISRLIBC_OBJCFLAGS-y += -w -L __* diff --git a/lib/isrlibc/arch/arm/bits/fcntl.h b/lib/isrlibc/arch/arm/bits/fcntl.h new file mode 100644 index 0000000..4cb1753 --- /dev/null +++ b/lib/isrlibc/arch/arm/bits/fcntl.h @@ -0,0 +1,40 @@ +#define O_CREAT 0100 +#define O_EXCL 0200 +#define O_NOCTTY 0400 +#define O_TRUNC 01000 +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_DSYNC 010000 +#define O_SYNC 04010000 +#define O_RSYNC 04010000 +#define O_DIRECTORY 040000 +#define O_NOFOLLOW 0100000 +#define O_CLOEXEC 02000000 + +#define O_ASYNC 020000 +#define O_DIRECT 0200000 +#define O_LARGEFILE 0400000 +#define O_NOATIME 01000000 +#define O_PATH 010000000 +#define O_TMPFILE 020040000 +#define O_NDELAY O_NONBLOCK + +#define F_DUPFD 0 +#define F_GETFD 1 +#define F_SETFD 2 +#define F_GETFL 3 +#define F_SETFL 4 + +#define F_SETOWN 8 +#define F_GETOWN 9 +#define F_SETSIG 10 +#define F_GETSIG 11 + +#define F_GETLK 12 +#define F_SETLK 13 +#define F_SETLKW 14 + +#define F_SETOWN_EX 15 +#define F_GETOWN_EX 16 + +#define F_GETOWNER_UIDS 17 diff --git a/lib/isrlibc/arch/arm64/bits/fcntl.h b/lib/isrlibc/arch/arm64/bits/fcntl.h new file mode 100644 index 0000000..9278797 --- /dev/null +++ b/lib/isrlibc/arch/arm64/bits/fcntl.h @@ -0,0 +1,38 @@ +#define O_CREAT 0100 +#define O_EXCL 0200 +#define O_NOCTTY 0400 +#define O_TRUNC 01000 +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_DSYNC 010000 +#define O_SYNC 04010000 +#define O_RSYNC 04010000 +#define O_DIRECTORY 040000 +#define O_NOFOLLOW 0100000 +#define O_CLOEXEC 02000000 + +#define O_ASYNC 020000 +#define O_DIRECT 0200000 +#define O_LARGEFILE 0400000 +#define O_NOATIME 01000000 +#define O_PATH 010000000 +#define O_TMPFILE 020040000 +#define O_NDELAY O_NONBLOCK + +#define F_DUPFD 0 +#define F_GETFD 1 +#define F_SETFD 2 +#define F_GETFL 3 +#define F_SETFL 4 +#define F_GETLK 5 +#define F_SETLK 6 +#define F_SETLKW 7 +#define F_SETOWN 8 +#define F_GETOWN 9 +#define F_SETSIG 10 +#define F_GETSIG 11 + +#define F_SETOWN_EX 15 +#define F_GETOWN_EX 16 + +#define F_GETOWNER_UIDS 17 diff --git a/lib/isrlibc/arch/x86_64/bits/fcntl.h b/lib/isrlibc/arch/x86_64/bits/fcntl.h new file mode 100644 index 0000000..1b88ad3 --- /dev/null +++ b/lib/isrlibc/arch/x86_64/bits/fcntl.h @@ -0,0 +1,40 @@ +#define O_CREAT 0100 +#define O_EXCL 0200 +#define O_NOCTTY 0400 +#define O_TRUNC 01000 +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_DSYNC 010000 +#define O_SYNC 04010000 +#define O_RSYNC 04010000 +#define O_DIRECTORY 0200000 +#define O_NOFOLLOW 0400000 +#define O_CLOEXEC 02000000 + +#define O_ASYNC 020000 +#define O_DIRECT 040000 +#define O_LARGEFILE 0 +#define O_NOATIME 01000000 +#define O_PATH 010000000 +#define O_TMPFILE 020200000 +#define O_NDELAY O_NONBLOCK + +#define F_DUPFD 0 +#define F_GETFD 1 +#define F_SETFD 2 +#define F_GETFL 3 +#define F_SETFL 4 + +#define F_SETOWN 8 +#define F_GETOWN 9 +#define F_SETSIG 10 +#define F_GETSIG 11 + +#define F_GETLK 5 +#define F_SETLK 6 +#define F_SETLKW 7 + +#define F_SETOWN_EX 15 +#define F_GETOWN_EX 16 + +#define F_GETOWNER_UIDS 17 diff --git a/lib/isrlibc/exportsyms.uk b/lib/isrlibc/exportsyms.uk new file mode 100644 index 0000000..5986f7e --- /dev/null +++ b/lib/isrlibc/exportsyms.uk @@ -0,0 +1,2 @@ +# string +isr_memcpy I saw that you named the symbol memcpy_isr. diff --git a/lib/isrlibc/include/isrlibc-internal/shareddefs.h b/lib/isrlibc/include/isrlibc-internal/shareddefs.h new file mode 100644 index 0000000..d386820 --- /dev/null +++ b/lib/isrlibc/include/isrlibc-internal/shareddefs.h @@ -0,0 +1,146 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * Authors: Florian Schmidt <florian.schmidt@xxxxxxxxx> + * + * Copyright (c) 2018, NEC Labs Europe, NEC Corporation. All rights reserved. + * + * 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. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. + * + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY. + */ + +/* This header does by design not have include guards, so that it can be + * included from multiple files. The __NEED_x macros instead make sure that + * only those definitions are included that are required by that specific + * file, and only if they haven't been defined on a previous pass through + * this file. + */ + +#include <uk/config.h> +#include <uk/arch/types.h> + +#if (defined __NEED_NULL && !defined __DEFINED_NULL) +#ifdef __cplusplus +#define NULL 0L +#else +#define NULL ((void *) 0) +#endif +#define __DEFINED__NULL +#endif + +#if (defined __NEED_size_t && !defined __DEFINED_size_t) +typedef __sz size_t; +#define __DEFINED_size_t +#endif + +#if (defined __NEED_ssize_t && !defined __DEFINED_ssize_t) +typedef __ssz ssize_t; +#define __DEFINED_ssize_t +#endif + +#if (defined __NEED_off_t && !defined __DEFINED_off_t) +typedef __off off_t; +#define __DEFINED_off_t +#endif + +#if CONFIG_HAVE_TIME +#include <uk/time_types.h> +#endif + +#if (defined __NEED_mode_t && !defined __DEFINED_mode_t) +typedef unsigned mode_t; +#define __DEFINED_mode_t +#endif + +#if defined(__NEED_uid_t) && !defined(__DEFINED_uid_t) +typedef unsigned uid_t; +#define __DEFINED_uid_t +#endif + +#if defined(__NEED_gid_t) && !defined(__DEFINED_gid_t) +typedef unsigned gid_t; +#define __DEFINED_gid_t +#endif + +#if defined(__NEED_useconds_t) && !defined(__DEFINED_useconds_t) +typedef unsigned useconds_t; +#define __DEFINED_useconds_t +#endif + +#if defined(__NEED_pid_t) && !defined(__DEFINED_pid_t) +typedef int pid_t; +#define __DEFINED_pid_t +#endif + +#if defined(__NEED_id_t) && !defined(__DEFINED_id_t) +typedef unsigned id_t; +#define __DEFINED_id_t +#endif + +#if defined(__NEED_dev_t) && !defined(__DEFINED_dev_t) +typedef __u64 dev_t; +#define __DEFINED_dev_t +#endif + +#if defined(__NEED_ino_t) && !defined(__DEFINED_ino_t) +typedef __u64 ino_t; +#define __DEFINED_ino_t +#endif + +#if defined(__NEED_nlink_t) && !defined(__DEFINED_nlink_t) +typedef __u32 nlink_t; +#define __DEFINED_nlink_t +#endif + +#if defined(__NEED_blkcnt_t) && !defined(__DEFINED_blkcnt_t) +typedef __s64 blkcnt_t; +#define __DEFINED_blkcnt_t +#endif + +#if defined(__NEED_blksize_t) && !defined(__DEFINED_blksize_t) +typedef long blksize_t; +#define __DEFINED_blksize_t +#endif + +#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t) +typedef struct __locale_struct *locale_t; +#define __DEFINED_locale_t +#endif + +#if defined(__NEED_struct_iovec) && !defined(__DEFINED_struct_iovec) +struct iovec { void *iov_base; size_t iov_len; }; +#define __DEFINED_struct_iovec +#endif + +#if defined(__NEED_fsblkcnt_t) && !defined(__DEFINED_fsblkcnt_t) +typedef unsigned long long fsblkcnt_t; +#define __DEFINED_fsblkcnt_t +#endif + +#if defined(__NEED_fsfilcnt_t) && !defined(__DEFINED_fsfilcnt_t) +typedef unsigned long long fsfilcnt_t; +#define __DEFINED_fsfilcnt_t +#endif diff --git a/lib/isrlibc/include/string.h b/lib/isrlibc/include/string.h new file mode 100644 index 0000000..84e4acf --- /dev/null +++ b/lib/isrlibc/include/string.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * Authors: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> + * + * + * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved. + * + * 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. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. + * + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY. + */ + +#ifndef __STRING_H__ +#define __STRING_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_NULL +#define __NEED_size_t +#include <isrlibc-internal/shareddefs.h> + +void *memcpy_isr(void *dst, const void *src, size_t len); + +#ifdef __cplusplus +} +#endif + +#endif /* __STRING_H__ */ You should create a new header. Especially the inlcude guard __STRING_H__ conflicts here with nolibc's string.h. You risk that only one of your both defintions get defined. Actually, since this is a Unikraft-specific (non-generic) lib, I would put the header under uk/isr/ subdirectory. How about: <uk/isr/string.h>? The include guard could then be called __UK_ISR_STRING_H__ . Any other suggestion is also fine. You do not have to follow the string.h name scheme. It just makes it easier to grasp where a developer finds what if we follow a bit the libc scheme. If you need type definitions, just include them from the libc. Use the standard libc provided headers (e.g., <stdint.h>). This way we are making sure that `isrlib` works together with any libc that is selected to the build. diff --git a/lib/isrlibc/include/sys/file.h b/lib/isrlibc/include/sys/file.h new file mode 100644 index 0000000..4fc83b9 --- /dev/null +++ b/lib/isrlibc/include/sys/file.h @@ -0,0 +1,21 @@ +#ifndef _SYS_FILE_H +#define _SYS_FILE_H +#ifdef __cplusplus +extern "C" { +#endif + +#define LOCK_SH 1 +#define LOCK_EX 2 +#define LOCK_NB 4 +#define LOCK_UN 8 + +#define L_SET 0 +#define L_INCR 1 +#define L_XTND 2 + +int flock(int, int); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/lib/isrlibc/include/sys/mount.h b/lib/isrlibc/include/sys/mount.h new file mode 100644 index 0000000..c8b1fe2 --- /dev/null +++ b/lib/isrlibc/include/sys/mount.h @@ -0,0 +1,109 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * Copyright (C) 2013 Cloudius Systems, Ltd. + * Copyright (c) 2019, NEC Europe Ltd., NEC Corporation. + * + * All rights reserved. + * + * 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. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. + * + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY. + */ + +#ifndef _SYS_MOUNT_H +#define _SYS_MOUNT_H + +#ifdef __cplusplus +extern "C" { +#endif + + +#define BLKROSET _IO(0x12, 93) +#define BLKROGET _IO(0x12, 94) +#define BLKRRPART _IO(0x12, 95) +#define BLKGETSIZE _IO(0x12, 96) +#define BLKFLSBUF _IO(0x12, 97) +#define BLKRASET _IO(0x12, 98) +#define BLKRAGET _IO(0x12, 99) +#define BLKFRASET _IO(0x12, 100) +#define BLKFRAGET _IO(0x12, 101) +#define BLKSECTSET _IO(0x12, 102) +#define BLKSECTGET _IO(0x12, 103) +#define BLKSSZGET _IO(0x12, 104) +#define BLKBSZGET _IOR(0x12, 112, size_t) +#define BLKBSZSET _IOW(0x12, 113, size_t) +#define BLKGETSIZE64 _IOR(0x12, 114, size_t) + +#define MS_RDONLY 1 +#define MS_NOSUID 2 +#define MS_NODEV 4 +#define MS_NOEXEC 8 +#define MS_SYNCHRONOUS 16 +#define MS_REMOUNT 32 +#define MS_MANDLOCK 64 +#define MS_DIRSYNC 128 +#define MS_NOATIME 1024 +#define MS_NODIRATIME 2048 +#define MS_BIND 4096 +#define MS_MOVE 8192 +#define MS_REC 16384 +#define MS_SILENT 32768 +#define MS_POSIXACL (1<<16) +#define MS_UNBINDABLE (1<<17) +#define MS_PRIVATE (1<<18) +#define MS_SLAVE (1<<19) +#define MS_SHARED (1<<20) +#define MS_RELATIME (1<<21) +#define MS_KERNMOUNT (1<<22) +#define MS_I_VERSION (1<<23) +#define MS_STRICTATIME (1<<24) +#define MS_LAZYTIME (1<<25) +#define MS_NOREMOTELOCK (1<<27) +#define MS_NOSEC (1<<28) +#define MS_BORN (1<<29) +#define MS_ACTIVE (1<<30) +#define MS_NOUSER (1U<<31) + +#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|MS_LAZYTIME) + +#define MS_MGC_VAL 0xc0ed0000 +#define MS_MGC_MSK 0xffff0000 + +#define MNT_FORCE 0x00000001 +#define MNT_DETACH 0x00000002 +#define MNT_EXPIRE 0x00000004 +#define UMOUNT_NOFOLLOW 0x00000008 + +int mount(const char *dev, const char *dir, const char *fsname, + unsigned long flags, const void *data); +int umount(const char *path); +int umount2(const char *path, int flags); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/isrlibc/include/sys/param.h b/lib/isrlibc/include/sys/param.h new file mode 100644 index 0000000..f5928d0 --- /dev/null +++ b/lib/isrlibc/include/sys/param.h @@ -0,0 +1,38 @@ +#ifndef _SYS_PARAM_H +#define _SYS_PARAM_H + +#define MAXSYMLINKS 20 +#define MAXHOSTNAMELEN 64 +#define MAXNAMLEN 255 +#define MAXPATHLEN 4096 +#define NBBY 8 +#define NGROUPS 32 +#define CANBSIZ 255 +#define NOFILE 256 +#define NCARGS 131072 +#define DEV_BSIZE 512 +#define NOGROUP (-1) + +#undef MIN +#undef MAX +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) + +#define __bitop(x, i, o) ((x)[(i) / 8] o(1 << (i) % 8)) +#define setbit(x, i) __bitop(x, i, |=) +#define clrbit(x, i) __bitop(x, i, &= ~) +#define isset(x, i) __bitop(x, i, &) +#define isclr(x, i) !isset(x, i) + +#define howmany(n, d) (((n) + ((d) - 1)) / (d)) +#define roundup(n, d) (howmany(n, d) * (d)) +#define powerof2(n) !(((n) - 1) & (n)) + +/* TODO: This includes are not needed currently. Lets leave them + * commented out as a reminder + */ +/* #include <sys/resource.h> */ +/* #include <endian.h> */ +#include <limits.h> + +#endif diff --git a/lib/isrlibc/include/sys/select.h b/lib/isrlibc/include/sys/select.h new file mode 100644 index 0000000..e981b7c --- /dev/null +++ b/lib/isrlibc/include/sys/select.h @@ -0,0 +1,82 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved. + * + * 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + */ +/* Derived from FreeBSD commit 4736ccf (Nov 20, 2017) */ + +#ifndef __SYS_SELECT_H__ +#define __SYS_SELECT_H__ + +#include <sys/param.h> +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_time_t +#define __NEED_suseconds_t +#define __NEED_struct_timespec +#include <nolibc-internal/shareddefs.h> + +typedef unsigned long __fd_mask; + +/* + * Select uses bit masks of file descriptors in longs. These macros + * manipulate such bit fields (the filesystem macros use chars). + * FD_SETSIZE may be defined by the user, but the default here should + * be enough for most uses. + */ +#ifndef FD_SETSIZE +#define FD_SETSIZE 64 +#endif + +#define _NFDBITS (sizeof(__fd_mask) * 8) /* bits per mask */ + +typedef struct fd_set { + __fd_mask __fds_bits[howmany(FD_SETSIZE, _NFDBITS)]; +} fd_set; + +#define __fdset_mask(n) ((__fd_mask)1 << ((n) % _NFDBITS)) +#define FD_CLR(n, p) ((p)->__fds_bits[(n)/_NFDBITS] &= ~__fdset_mask(n)) +#define FD_ISSET(n, p) (((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) != 0) +#define FD_SET(n, p) ((p)->__fds_bits[(n)/_NFDBITS] |= __fdset_mask(n)) +#define FD_ZERO(p) do { \ + fd_set *_p; \ + __ssz _n; \ + \ + _p = (p); \ + _n = howmany(FD_SETSIZE, _NFDBITS); \ + while (_n > 0) \ + _p->__fds_bits[--_n] = 0; \ +} while (0) + +#ifdef __cplusplus +} +#endif + +#endif /* __SYS_SELECT_H__ */ diff --git a/lib/isrlibc/include/sys/stat.h b/lib/isrlibc/include/sys/stat.h new file mode 100644 index 0000000..407bc20 --- /dev/null +++ b/lib/isrlibc/include/sys/stat.h @@ -0,0 +1,135 @@ +#ifndef _SYS_STAT_H +#define _SYS_STAT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* #include <features.h> */ + +#define __NEED_dev_t +#define __NEED_ino_t +#define __NEED_mode_t +#define __NEED_nlink_t +#define __NEED_uid_t +#define __NEED_gid_t +#define __NEED_off_t +#define __NEED_time_t +#define __NEED_blksize_t +#define __NEED_blkcnt_t +#define __NEED_struct_timespec + +#include <nolibc-internal/shareddefs.h> + +struct stat { + dev_t st_dev; + ino_t st_ino; + nlink_t st_nlink; + + mode_t st_mode; + uid_t st_uid; + gid_t st_gid; + unsigned int __pad0; + dev_t st_rdev; + off_t st_size; + blksize_t st_blksize; + blkcnt_t st_blocks; + + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; +}; + +#define st_atime st_atim.tv_sec +#define st_mtime st_mtim.tv_sec +#define st_ctime st_ctim.tv_sec + +#define S_IFMT 0170000 + +#define S_IFDIR 0040000 +#define S_IFCHR 0020000 +#define S_IFBLK 0060000 +#define S_IFREG 0100000 +#define S_IFIFO 0010000 +#define S_IFLNK 0120000 +#define S_IFSOCK 0140000 + +#define S_TYPEISMQ(buf) 0 +#define S_TYPEISSEM(buf) 0 +#define S_TYPEISSHM(buf) 0 +#define S_TYPEISTMO(buf) 0 + +#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) +#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) +#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) +#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO) +#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) +#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) + +#ifndef S_IRUSR +#define S_ISUID 04000 +#define S_ISGID 02000 +#define S_ISVTX 01000 +#define S_IRUSR 0400 +#define S_IWUSR 0200 +#define S_IXUSR 0100 +#define S_IRWXU 0700 +#define S_IRGRP 0040 +#define S_IWGRP 0020 +#define S_IXGRP 0010 +#define S_IRWXG 0070 +#define S_IROTH 0004 +#define S_IWOTH 0002 +#define S_IXOTH 0001 +#define S_IRWXO 0007 +#endif + +#define UTIME_NOW 0x3fffffff +#define UTIME_OMIT 0x3ffffffe + +int stat(const char *__restrict, struct stat *__restrict); +int fstat(int, struct stat *); +int lstat(const char *__restrict, struct stat *__restrict); +int fstatat(int, const char *__restrict, struct stat *__restrict, int); +int chmod(const char *, mode_t); +int fchmod(int, mode_t); +int fchmodat(int, const char *, mode_t, int); +mode_t umask(mode_t); +int mkdir(const char *, mode_t); +int mkfifo(const char *, mode_t); +int mkdirat(int, const char *, mode_t); +int mkfifoat(int, const char *, mode_t); + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int mknod(const char *, mode_t, dev_t); +int mknodat(int, const char *, mode_t, dev_t); +#endif + +int futimens(int, const struct timespec [2]); +int utimensat(int, const char *, const struct timespec [2], int); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +int lchmod(const char *, mode_t); +#define S_IREAD S_IRUSR +#define S_IWRITE S_IWUSR +#define S_IEXEC S_IXUSR +#endif + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define stat64 stat +#define fstat64 fstat +#define lstat64 lstat +#define fstatat64 fstatat +#define blkcnt64_t blkcnt_t +#define fsblkcnt64_t fsblkcnt_t +#define fsfilcnt64_t fsfilcnt_t +#define ino64_t ino_t +#define off64_t off_t +#endif + +#ifdef __cplusplus +} +#endif +#endif + + diff --git a/lib/isrlibc/include/sys/statfs.h b/lib/isrlibc/include/sys/statfs.h new file mode 100644 index 0000000..59de629 --- /dev/null +++ b/lib/isrlibc/include/sys/statfs.h @@ -0,0 +1,36 @@ +#ifndef _SYS_STATFS_H +#define _SYS_STATFS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <sys/statvfs.h> + +typedef struct __fsid_t { + int __val[2]; +} fsid_t; + +struct statfs { + unsigned long f_type, f_bsize; + fsblkcnt_t f_blocks, f_bfree, f_bavail; + fsfilcnt_t f_files, f_ffree; + fsid_t f_fsid; + unsigned long f_namelen, f_frsize, f_flags, f_spare[4]; +}; + +int statfs(const char *path, struct statfs *buf); +int fstatfs(int fd, struct statfs *buf); + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define statfs64 statfs +#define fstatfs64 fstatfs +#define fsblkcnt64_t fsblkcnt_t +#define fsfilcnt64_t fsfilcnt_t +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/isrlibc/include/sys/statvfs.h b/lib/isrlibc/include/sys/statvfs.h new file mode 100644 index 0000000..85a2ff9 --- /dev/null +++ b/lib/isrlibc/include/sys/statvfs.h @@ -0,0 +1,54 @@ +#ifndef _SYS_STATVFS_H +#define _SYS_STATVFS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_fsblkcnt_t +#define __NEED_fsfilcnt_t +#include <nolibc-internal/shareddefs.h> + +struct statvfs { + unsigned long f_bsize, f_frsize; + fsblkcnt_t f_blocks, f_bfree, f_bavail; + fsfilcnt_t f_files, f_ffree, f_favail; +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned long f_fsid; + unsigned :8*(2*sizeof(int)-sizeof(long)); +#else + unsigned :8*(2*sizeof(int)-sizeof(long)); + unsigned long f_fsid; +#endif + unsigned long f_flag, f_namemax; + int __reserved[6]; +}; + +int statvfs (const char *__restrict, struct statvfs *__restrict); +int fstatvfs (int, struct statvfs *); + +#define ST_RDONLY 1 +#define ST_NOSUID 2 +#define ST_NODEV 4 +#define ST_NOEXEC 8 +#define ST_SYNCHRONOUS 16 +#define ST_MANDLOCK 64 +#define ST_WRITE 128 +#define ST_APPEND 256 +#define ST_IMMUTABLE 512 +#define ST_NOATIME 1024 +#define ST_NODIRATIME 2048 +#define ST_RELATIME 4096 + +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define statvfs64 statvfs +#define fstatvfs64 fstatvfs +#define fsblkcnt64_t fsblkcnt_t +#define fsfilcnt64_t fsfilcnt_t +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/isrlibc/include/sys/types.h b/lib/isrlibc/include/sys/types.h new file mode 100644 index 0000000..4da777c --- /dev/null +++ b/lib/isrlibc/include/sys/types.h @@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * Authors: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> + * + * + * Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved. + * + * 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. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. + * + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY. + */ + + +#ifndef __SYS_TYPES_H__ +#define __SYS_TYPES_H__ + +#include <uk/arch/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_off_t +#define __NEED_time_t +#define __NEED_timer_t +#define __NEED_suseconds_t +#define __NEED_clock_t +#define __NEED_clockid_t +#define __NEED_locale_t +#define __NEED_mode_t +#define __NEED_uid_t +#define __NEED_gid_t +#define __NEED_pid_t +#define __NEED_id_t +#define __NEED_dev_t +#define __NEED_ino_t +#define __NEED_nlink_t +#include <nolibc-internal/shareddefs.h> + +#ifdef __cplusplus +} +#endif + +#endif /* __SYS_TYPES_H__ */ diff --git a/lib/isrlibc/include/sys/uio.h b/lib/isrlibc/include/sys/uio.h new file mode 100644 index 0000000..d1a4b48 --- /dev/null +++ b/lib/isrlibc/include/sys/uio.h @@ -0,0 +1,76 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * Copyright (C) 2013 Cloudius Systems, Ltd. + * Copyright (c) 2019, NEC Europe Ltd., NEC Corporation. + * + * All rights reserved. + * + * 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. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. + * + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY. + */ + +#ifndef _SYS_UIO_H +#define _SYS_UIO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define __NEED_size_t +#define __NEED_ssize_t +#define __NEED_struct_iovec + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define __NEED_off_t +#endif + +#ifdef _GNU_SOURCE +#define __NEED_pid_t +#endif + +#include <nolibc-internal/shareddefs.h> + +#define UIO_MAXIOV 1024 + +ssize_t readv(int fd, const struct iovec *iov, int iovcnt); +ssize_t writev(int fd, const struct iovec *iov, int iovcnt); + +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +ssize_t preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset); +ssize_t pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset); +#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) +#define preadv64 preadv +#define pwritev64 pwritev +#define off64_t off_t +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/isrlibc/string.c b/lib/isrlibc/string.c new file mode 100644 index 0000000..8425202 --- /dev/null +++ b/lib/isrlibc/string.c @@ -0,0 +1,16 @@ +#include <stdlib.h> +#include <stdint.h> +#include <string.h> +#include <limits.h> +#include <errno.h> +#include <stdio.h> + This makes sense. I would start with a lib that just has this memcpy function and a minimal skeleton. We continue from there then... +void *memcpy_isr(void *dst, const void *src, size_t len) +{ + size_t p; + + for (p = 0; p < len; ++p) + *((__u8 *)(((__uptr)dst) + p)) = *((__u8 *)(((__uptr)src) + p)); + + return dst; +} \ No newline at end of file Make sure you have a ending newline in your files in order to avoid this warning.
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |