1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/libsystypes/lib/Makefile Sun Mar 06 01:06:30 2022 +0100
1.3 @@ -0,0 +1,4 @@
1.4 +PKGDIR ?= ..
1.5 +L4DIR ?= $(PKGDIR)/../../..
1.6 +
1.7 +include $(L4DIR)/mk/subdir.mk
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/libsystypes/lib/src/Makefile Sun Mar 06 01:06:30 2022 +0100
2.3 @@ -0,0 +1,14 @@
2.4 +PKGDIR ?= ../..
2.5 +L4DIR ?= $(PKGDIR)/../../..
2.6 +
2.7 +TARGET = libsystypes.so libsystypes.a
2.8 +PC_FILENAME = libsystypes
2.9 +
2.10 +SRC_C = stat.c
2.11 +
2.12 +REQUIRES_LIBS = l4re_c-util
2.13 +
2.14 +PRIVATE_INCDIR = $(PKGDIR)/include/systypes
2.15 +CONTRIB_INCDIR = libsystypes
2.16 +
2.17 +include $(L4DIR)/mk/lib.mk
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/libsystypes/lib/src/stat.c Sun Mar 06 01:06:30 2022 +0100
3.3 @@ -0,0 +1,52 @@
3.4 +/*
3.5 + * Utility functions for stat structures.
3.6 + *
3.7 + * Copyright (C) 2022 Paul Boddie <paul@boddie.org.uk>
3.8 + *
3.9 + * This program is free software; you can redistribute it and/or
3.10 + * modify it under the terms of the GNU General Public License as
3.11 + * published by the Free Software Foundation; either version 2 of
3.12 + * the License, or (at your option) any later version.
3.13 + *
3.14 + * This program is distributed in the hope that it will be useful,
3.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.17 + * GNU General Public License for more details.
3.18 + *
3.19 + * You should have received a copy of the GNU General Public License
3.20 + * along with this program; if not, write to the Free Software
3.21 + * Foundation, Inc., 51 Franklin Street, Fifth Floor,
3.22 + * Boston, MA 02110-1301, USA
3.23 + */
3.24 +
3.25 +#include "stat.h"
3.26 +
3.27 +#define COPY_STAT(s1, s2) \
3.28 + s1->st_dev = s2->st_dev; \
3.29 + s1->st_ino = s2->st_ino; \
3.30 + s1->st_mode = s2->st_mode; \
3.31 + s1->st_nlink = s2->st_nlink; \
3.32 + s1->st_uid = s2->st_uid; \
3.33 + s1->st_gid = s2->st_gid; \
3.34 + s1->st_rdev = s2->st_rdev; \
3.35 + s1->st_size = s2->st_size; \
3.36 + s1->st_atim.tv_sec = s2->st_atim.tv_sec; \
3.37 + s1->st_atim.tv_nsec = s2->st_atim.tv_nsec; \
3.38 + s1->st_mtim.tv_sec = s2->st_mtim.tv_sec; \
3.39 + s1->st_mtim.tv_nsec = s2->st_mtim.tv_nsec; \
3.40 + s1->st_ctim.tv_sec = s2->st_ctim.tv_sec; \
3.41 + s1->st_ctim.tv_nsec = s2->st_ctim.tv_nsec; \
3.42 + s1->st_blksize = s2->st_blksize; \
3.43 + s1->st_blocks = s2->st_blocks;
3.44 +
3.45 +void systypes_copy_from_sys_stat(struct stat *st, sys_stat_t *sst)
3.46 +{
3.47 + COPY_STAT(st, sst)
3.48 +}
3.49 +
3.50 +void systypes_copy_to_sys_stat(struct stat *st, sys_stat_t *sst)
3.51 +{
3.52 + COPY_STAT(sst, st)
3.53 +}
3.54 +
3.55 +// vim: tabstop=2 expandtab shiftwidth=2