xref: /freebsd/tools/build/cross-build/fflags.c (revision 4e64fb9f4901e99ce02f13d45f370e75d53075a6)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright 2018-2020 Alex Richardson <arichardson@FreeBSD.org>
5  *
6  * This software was developed by SRI International and the University of
7  * Cambridge Computer Laboratory (Department of Computer Science and
8  * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
9  * DARPA SSITH research programme.
10  *
11  * This software was developed by SRI International and the University of
12  * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
13  * ("CTSRD"), as part of the DARPA CRASH research programme.
14  *
15  * This work was supported by Innovate UK project 105694, "Digital Security by
16  * Design (DSbD) Technology Platform Prototype".
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions
20  * are met:
21  * 1. Redistributions of source code must retain the above copyright
22  *    notice, this list of conditions and the following disclaimer.
23  * 2. Redistributions in binary form must reproduce the above copyright
24  *    notice, this list of conditions and the following disclaimer in the
25  *    documentation and/or other materials provided with the distribution.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
28  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
31  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37  * SUCH DAMAGE.
38  */
39 
40 #include <string.h>
41 #include <unistd.h>
42 
43 char *
fflagstostr(u_long flags __unused)44 fflagstostr(u_long flags __unused)
45 {
46 	return strdup("");
47 }
48 
49 int
strtofflags(char ** stringp __unused,u_long * setp,u_long * clrp)50 strtofflags(char **stringp __unused, u_long *setp, u_long *clrp)
51 {
52 	/* On linux just ignore the file flags for now */
53 	/*
54 	 * XXX: this will prevent makefs from setting noschg on libc, etc.
55 	 * so we should really find a way to support flags in disk images.
56 	 */
57 	if (setp)
58 		*setp = 0;
59 	if (clrp)
60 		*clrp = 0;
61 	return (0); /* success */
62 }
63