mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-11 13:50:06 +00:00
11160cb76f
The types u_char, u_short, u_int, u_long, ushort, uint, ulong, u_int8_t, u_int16_t, u_int32_t, u_int64_t, quad_t, and u_quad_t are BSDisms that have never been standardized. While glibc should continue to *provide* these types for compatibility's sake, its public headers should not use them. The meat of this change was mechanically generated by the following shell command: perl -pi~ -e ' s/\b(__)?u_char\b/unsigned char/g; s/\b(__)?u_?short\b/unsigned short/g; s/\b(__)?u_?int\b/unsigned int/g; s/\b(__)?u_?long\b/unsigned long/g; s/\b(__)?u_int8_t\b/uint8_t/g; s/\b(__)?u_int16_t\b/uint16_t/g; s/\b(__)?u_int32_t\b/uint32_t/g; s/\b(__)?u_int64_t\b/uint64_t/g; s/\b(__)?u_quad_t\b/uint64_t/g; s/\b(__)?quad_t\b/uint64_t/g; ' $(grep -lE -e '\<((__)?(quad_t|u(short|int|long|_(char|short|int([0-9]+_t)?|long|quad_t))))\>' \ $(grep -LE '\<(_(SYS|BITS)_TYPES_H|rpc/(rpc|rpc_msg|types|xdr)\.h)\>' \ $(find . \( -false $(sed 's/^/-o -name /' all-installed-headers) \ \) -printf '%P\n' | sort -u))) where 'all-installed-headers' was a list of the basenames of all installed header files, manually extracted from the Makefiles. Non-installed wrapper headers in include/ are also adjusted, for consistency. I then manually fixed up indentation and line-wrapping. sys/types.h and bits/types.h are excluded because they must continue to define the u_* types (under __USE_MISC) for compatibility with applications. They do not use these types themselves. All headers that (transitively) include rpc/types.h are also excluded, for three reasons. First, the u_* types are defined by rpc/types.h, unconditionally (not just under __USE_MISC) so they are logically part of the SunRPC API. Second, many of those headers appear to be machine-generated. Third, it's my understanding that we are getting rid of as much of SunRPC as possible in the near future. (The one file under sunrpc/ that's touched, sunrpc/rpc/rpc_des.h, does *not* include rpc/types.h. This may itself be a bug.) After changing from u_intNN_t to uintNN_t, a number of headers now need to include stdint.h to pick up those types. It might be more hygenic, namespace-wise, to use __uintNN_t instead, but none of these headers are bound by ISO or POSIX to do so, and it's unlikely that anyone using them will be bothered. (The two files that were using __-prefixed versions of the u_types, sysdeps/mach/hurd/net/route.h and sysdeps/unix/sysv/linux/net/route.h, both already also contained uses of the unprefixed versions.) Some of these files directly included features.h and/or sys/cdefs.h, which I removed, as the style generally seems to be to let sys/types.h do that for us. (This does not change the set of definitions exposed by any header; sys/types.h unconditionally includes both features.h and sys/cdefs.h.) One file included asm/types.h unnecessarily. * bits/in.h, gmon/sys/gmon.h, inet/netinet/igmp.h * inet/protocols/routed.h, inet/protocols/talkd.h * inet/protocols/timed.h, io/fts.h, nptl_db/thread_db.h * resolv/arpa/nameser.h, resolv/resolv.h, sunrpc/rpc/rpc_des.h * sysdeps/generic/netinet/if_ether.h * sysdeps/generic/netinet/in_systm.h * sysdeps/generic/netinet/ip.h, sysdeps/generic/netinet/tcp.h * sysdeps/gnu/netinet/ip_icmp.h, sysdeps/gnu/netinet/tcp.h * sysdeps/gnu/netinet/udp.h, sysdeps/mach/hurd/net/ethernet.h * sysdeps/mach/hurd/net/if_arp.h * sysdeps/mach/hurd/net/if_ppp.h * sysdeps/mach/hurd/net/route.h, sysdeps/mach/sys/reboot.h * sysdeps/unix/sysv/linux/bits/in.h * sysdeps/unix/sysv/linux/net/ethernet.h * sysdeps/unix/sysv/linux/net/if_arp.h * sysdeps/unix/sysv/linux/net/if_ppp.h * sysdeps/unix/sysv/linux/net/if_shaper.h * sysdeps/unix/sysv/linux/net/route.h * sysdeps/unix/sysv/linux/netinet/if_ether.h * sysdeps/unix/sysv/linux/netinet/if_fddi.h * sysdeps/unix/sysv/linux/netinet/if_tr.h * sysdeps/unix/sysv/linux/netipx/ipx.h * sysdeps/unix/sysv/linux/sys/acct.h * include/arpa/nameser.h, include/resolv.h: Change all uses of u_char to unsigned char, u_short and ushort to unsigned short, u_int and uint to unsigned int, u_long and ulong to unsigned long, u_int8_t to uint8_t, u_int16_t to uint16_t, u_int32_t to uint32_t, quad_t to int64_t, and u_int64_t and u_quad_t to uint64_t. * mach/sys/reboot.h: Remove two casts of integer literals to the types they already have. * bits/in.h: Correct error in description of IP_MULTICAST_LOOP. * sysdeps/unix/sysv/linux/bits/in.h: Likewise. * sysdeps/unix/sysv/linux/netinet/if_ether.h: Change a comment from referring to 'unsigned char' to 'uint8_t' for consistency with the macro definition below. * gmon/sys/gmon.h, inet/netinet/igmp.h, inet/protocols/talkd.h * io/fts.h, resolv/arpa/nameser.h, resolv/resolv.h * sunrpc/rpc/rpc_des.h, sysdeps/generic/netinet/ip.h * sysdeps/gnu/netinet/tcp.h, sysdeps/gnu/netinet/udp.h * sysdeps/mach/hurd/net/if_ppp.h, sysdeps/unix/sysv/linux/net/if_ppp.h * sysdeps/unix/sysv/linux/sys/acct.h * include/arpa/nameser.h, include/resolv.h: Fix indentation disrupted by mechanical edits. * inet/protocols/talkd.h, resolv/arpa/nameser.h * sysdeps/generic/netinet/in_systm.h * sysdeps/gnu/netinet/ip_icmp.h, sysdeps/gnu/netinet/tcp.h * sysdeps/gnu/netinet/udp.h * sysdeps/unix/sysv/linux/net/ethernet.h * sysdeps/unix/sysv/linux/net/if_arp.h * sysdeps/unix/sysv/linux/net/if_ppp.h * sysdeps/unix/sysv/linux/net/if_shaper.h * sysdeps/unix/sysv/linux/netinet/if_fddi.h * sysdeps/unix/sysv/linux/netinet/if_tr.h * sysdeps/unix/sysv/linux/netipx/ipx.h * sysdeps/unix/sysv/linux/sys/acct.h Include stdint.h for uintNN_t definitions. Don't include sys/cdefs.h, features.h, or asm/types.h directly.
172 lines
6.1 KiB
C
172 lines
6.1 KiB
C
/*
|
|
* Mach Operating System
|
|
* Copyright (C) 1993,1991,1990 Carnegie Mellon University
|
|
* All Rights Reserved.
|
|
*
|
|
* Permission to use, copy, modify and distribute this software and its
|
|
* documentation is hereby granted, provided that both the copyright
|
|
* notice and this permission notice appear in all copies of the
|
|
* software, derivative works or modified versions, and any portions
|
|
* thereof, and that both notices appear in supporting documentation.
|
|
*
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
|
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
|
*
|
|
* Carnegie Mellon requests users of this software to return to
|
|
*
|
|
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
|
* School of Computer Science
|
|
* Carnegie Mellon University
|
|
* Pittsburgh PA 15213-3890
|
|
*
|
|
* any improvements or extensions that they make and grant Carnegie Mellon
|
|
* the rights to redistribute these changes.
|
|
*/
|
|
/*
|
|
* (pre-GNU) HISTORY
|
|
*
|
|
* Revision 2.8 93/03/11 13:46:40 danner
|
|
* unsigned long -> unsigned int.
|
|
* [93/03/09 danner]
|
|
*
|
|
* Revision 2.7 92/05/21 17:25:11 jfriedl
|
|
* Appended 'U' to constants that would otherwise be signed.
|
|
* [92/05/16 jfriedl]
|
|
*
|
|
* Revision 2.6 91/06/19 11:59:44 rvb
|
|
* Second byte of boothowto is flags for "startup" program.
|
|
* [91/06/18 rvb]
|
|
* Add ifndef __ASSEMBLER__ so that vax_init.s can include it.
|
|
* [91/06/11 rvb]
|
|
*
|
|
* Revision 2.5 91/05/14 17:40:11 mrt
|
|
* Correcting copyright
|
|
*
|
|
* Revision 2.4 91/02/05 17:56:48 mrt
|
|
* Changed to new Mach copyright
|
|
* [91/02/01 17:49:12 mrt]
|
|
*
|
|
* Revision 2.3 90/08/27 22:12:56 dbg
|
|
* Added definitions used by Mach Kernel: RB_DEBUGGER, RB_UNIPROC,
|
|
* RB_NOBOOTRC, RB_ALTBOOT. Moved RB_KDB to 0x04 (Mach value).
|
|
* Removed RB_RDONLY, RB_DUMP, RB_NOSYNC.
|
|
* [90/08/14 dbg]
|
|
*
|
|
*/
|
|
|
|
/*
|
|
Copyright (C) 1982, 1986, 1988 Regents of the University of California.
|
|
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.
|
|
4. 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.*/
|
|
|
|
/*
|
|
* @(#)reboot.h 7.5 (Berkeley) 6/27/88
|
|
*/
|
|
|
|
#ifndef _SYS_REBOOT_H_
|
|
#define _SYS_REBOOT_H_
|
|
|
|
#include <features.h>
|
|
|
|
/*
|
|
* Arguments to reboot system call.
|
|
* These are converted to switches, and passed to startup program,
|
|
* and on to init.
|
|
*/
|
|
#define RB_AUTOBOOT 0 /* flags for system auto-booting itself */
|
|
|
|
#define RB_ASKNAME 0x01 /* -a: ask for file name to reboot from */
|
|
#define RB_SINGLE 0x02 /* -s: reboot to single user only */
|
|
#define RB_KDB 0x04 /* -d: kernel debugger symbols loaded */
|
|
#define RB_HALT 0x08 /* -h: enter KDB at bootup */
|
|
/* for host_reboot(): don't reboot,
|
|
just halt */
|
|
#define RB_INITNAME 0x10 /* -i: name given for /etc/init (unused) */
|
|
#define RB_DFLTROOT 0x20 /* use compiled-in rootdev */
|
|
#define RB_NOBOOTRC 0x20 /* -b: don't run /etc/rc.boot */
|
|
#define RB_ALTBOOT 0x40 /* use /boot.old vs /boot */
|
|
#define RB_UNIPROC 0x80 /* -u: start only one processor */
|
|
|
|
#define RB_SHIFT 8 /* second byte is for ux */
|
|
|
|
#define RB_DEBUGGER 0x1000 /* for host_reboot(): enter kernel
|
|
debugger from user level */
|
|
|
|
/*
|
|
* Constants for converting boot-style device number to type,
|
|
* adaptor (uba, mba, etc), unit number and partition number.
|
|
* Type (== major device number) is in the low byte
|
|
* for backward compatibility. Except for that of the "magic
|
|
* number", each mask applies to the shifted value.
|
|
* Format:
|
|
* (4) (4) (4) (4) (8) (8)
|
|
* --------------------------------
|
|
* |MA | AD| CT| UN| PART | TYPE |
|
|
* --------------------------------
|
|
*/
|
|
#define B_ADAPTORSHIFT 24
|
|
#define B_ADAPTORMASK 0x0f
|
|
#define B_ADAPTOR(val) (((val) >> B_ADAPTORSHIFT) & B_ADAPTORMASK)
|
|
#define B_CONTROLLERSHIFT 20
|
|
#define B_CONTROLLERMASK 0xf
|
|
#define B_CONTROLLER(val) (((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK)
|
|
#define B_UNITSHIFT 16
|
|
#define B_UNITMASK 0xf
|
|
#define B_UNIT(val) (((val) >> B_UNITSHIFT) & B_UNITMASK)
|
|
#define B_PARTITIONSHIFT 8
|
|
#define B_PARTITIONMASK 0xff
|
|
#define B_PARTITION(val) (((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK)
|
|
#define B_TYPESHIFT 0
|
|
#define B_TYPEMASK 0xff
|
|
#define B_TYPE(val) (((val) >> B_TYPESHIFT) & B_TYPEMASK)
|
|
|
|
#define B_MAGICMASK 0xf0000000U
|
|
#define B_DEVMAGIC 0xa0000000U
|
|
|
|
#define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \
|
|
(((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \
|
|
((controller) << B_CONTROLLERSHIFT) | ((unit) << B_UNITSHIFT) | \
|
|
((partition) << B_PARTITIONSHIFT) | B_DEVMAGIC)
|
|
|
|
|
|
#ifdef KERNEL
|
|
#ifndef __ASSEMBLER__
|
|
extern int boothowto;
|
|
#endif /* __ASSEMBLER__ */
|
|
#endif
|
|
|
|
__BEGIN_DECLS
|
|
|
|
/* Reboot or halt the system. */
|
|
extern int reboot (int __howto) __THROW;
|
|
|
|
__END_DECLS
|
|
|
|
|
|
#endif /* _SYS_REBOOT_H_ */
|