# HG changeset patch # User Paul Boddie # Date 1646525190 -3600 # Node ID ddd3835aeaab147922805f11199e80bf7d19ee05 # Parent 55e4cd2dd48fb1bc07d55367c69381a154416358 Added missing libsystypes functionality. diff -r 55e4cd2dd48f -r ddd3835aeaab libsystypes/lib/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libsystypes/lib/Makefile Sun Mar 06 01:06:30 2022 +0100 @@ -0,0 +1,4 @@ +PKGDIR ?= .. +L4DIR ?= $(PKGDIR)/../../.. + +include $(L4DIR)/mk/subdir.mk diff -r 55e4cd2dd48f -r ddd3835aeaab libsystypes/lib/src/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libsystypes/lib/src/Makefile Sun Mar 06 01:06:30 2022 +0100 @@ -0,0 +1,14 @@ +PKGDIR ?= ../.. +L4DIR ?= $(PKGDIR)/../../.. + +TARGET = libsystypes.so libsystypes.a +PC_FILENAME = libsystypes + +SRC_C = stat.c + +REQUIRES_LIBS = l4re_c-util + +PRIVATE_INCDIR = $(PKGDIR)/include/systypes +CONTRIB_INCDIR = libsystypes + +include $(L4DIR)/mk/lib.mk diff -r 55e4cd2dd48f -r ddd3835aeaab libsystypes/lib/src/stat.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libsystypes/lib/src/stat.c Sun Mar 06 01:06:30 2022 +0100 @@ -0,0 +1,52 @@ +/* + * Utility functions for stat structures. + * + * Copyright (C) 2022 Paul Boddie + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA + */ + +#include "stat.h" + +#define COPY_STAT(s1, s2) \ + s1->st_dev = s2->st_dev; \ + s1->st_ino = s2->st_ino; \ + s1->st_mode = s2->st_mode; \ + s1->st_nlink = s2->st_nlink; \ + s1->st_uid = s2->st_uid; \ + s1->st_gid = s2->st_gid; \ + s1->st_rdev = s2->st_rdev; \ + s1->st_size = s2->st_size; \ + s1->st_atim.tv_sec = s2->st_atim.tv_sec; \ + s1->st_atim.tv_nsec = s2->st_atim.tv_nsec; \ + s1->st_mtim.tv_sec = s2->st_mtim.tv_sec; \ + s1->st_mtim.tv_nsec = s2->st_mtim.tv_nsec; \ + s1->st_ctim.tv_sec = s2->st_ctim.tv_sec; \ + s1->st_ctim.tv_nsec = s2->st_ctim.tv_nsec; \ + s1->st_blksize = s2->st_blksize; \ + s1->st_blocks = s2->st_blocks; + +void systypes_copy_from_sys_stat(struct stat *st, sys_stat_t *sst) +{ + COPY_STAT(st, sst) +} + +void systypes_copy_to_sys_stat(struct stat *st, sys_stat_t *sst) +{ + COPY_STAT(sst, st) +} + +// vim: tabstop=2 expandtab shiftwidth=2