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