Parent Directory
|
Revision Log
kfreebsd/local-sysdeps.diff: update to revision 4222 (from glibc-bsd).
| 1 | --- /dev/null |
| 2 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/Dist |
| 3 | @@ -0,0 +1,29 @@ |
| 4 | +bits/mcontext.h |
| 5 | +bits/stat16.h |
| 6 | +fpu.h |
| 7 | +machine/pal.h |
| 8 | +net/ethernet.h |
| 9 | +net/if_arp.h |
| 10 | +net/if_ether.h |
| 11 | +net/if_dl.h |
| 12 | +net/route.h |
| 13 | +nfs/nfs.h |
| 14 | +regdef.h |
| 15 | +sa_len.c |
| 16 | +stat16conv.c |
| 17 | +statfsconv.c |
| 18 | +sys/acl.h |
| 19 | +sys/extattr.h |
| 20 | +sys/io.h |
| 21 | +sys/jail.h |
| 22 | +sys/linker.h |
| 23 | +sys/mount.h |
| 24 | +sys/perm.h |
| 25 | +sys/rfork.h |
| 26 | +sys/rtprio.h |
| 27 | +sys/syslimits.h |
| 28 | +sys/timex.h |
| 29 | +sys/vm86.h |
| 30 | +sys_lseek.S |
| 31 | +sysarch.h |
| 32 | +ucontext_i.h |
| 33 | --- /dev/null |
| 34 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/Implies |
| 35 | @@ -0,0 +1,11 @@ |
| 36 | +# The kernel include files come from the 'kernel-include' add-on. |
| 37 | +# This is actually added by configure.in. |
| 38 | +#/usr/src/sys/ |
| 39 | + |
| 40 | +# One of two possible utmp file formats. |
| 41 | +# This is actually added by configure.in. |
| 42 | +#unix/bsd/bsd4.4/kfreebsd/utmp-xyz |
| 43 | + |
| 44 | +# The gnu subdirectory exists for things common to Linux-based, Hurd-based |
| 45 | +# and kFreeBSD-based GNU systems. |
| 46 | +gnu |
| 47 | --- /dev/null |
| 48 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/Makefile |
| 49 | @@ -0,0 +1,135 @@ |
| 50 | +# Use bash, not /bin/sh, for executing scripts, because the native |
| 51 | +# FreeBSD /bin/sh does not interpret the IFS="<tab>" read ... command |
| 52 | +# in localedata/tst-fmon.sh correctly. |
| 53 | +SHELL = bash |
| 54 | + |
| 55 | +# Additional header files to be installed in $prefix/include: |
| 56 | + |
| 57 | +ifeq ($(subdir),misc) |
| 58 | +sysdep_headers += \ |
| 59 | + kenv.h \ |
| 60 | + sys/mount.h \ |
| 61 | + sys/kd.h \ |
| 62 | + sys/rfork.h |
| 63 | +endif |
| 64 | + |
| 65 | +ifeq ($(subdir),stdlib) |
| 66 | +sysdep_headers += \ |
| 67 | + bits/mcontext.h |
| 68 | +endif |
| 69 | + |
| 70 | +# Additional functions, and particular system calls: |
| 71 | + |
| 72 | +ifeq ($(subdir),csu) |
| 73 | +# For <errno.h>. |
| 74 | +sysdep_routines += errno-loc |
| 75 | +endif |
| 76 | + |
| 77 | +ifeq ($(subdir),assert) |
| 78 | +CFLAGS-assert.c += -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>' |
| 79 | +CFLAGS-assert-perr.c += -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>' |
| 80 | +endif |
| 81 | + |
| 82 | +ifeq ($(subdir),io) |
| 83 | +# For <unistd.h>. |
| 84 | +sysdep_routines += sys_access sys_faccessat sys_fchownat sys_fexecve sys_getcwd sys_linkat sys_lseek sys_freebsd6_lseek sys_readlinkat sys_symlinkat sys_unlinkat |
| 85 | +# For <fcntl.h>. |
| 86 | +sysdep_routines += sys_open sys_openat open_2 |
| 87 | +# For <sys/stat.h>. |
| 88 | +sysdep_routines += sys_fchmodat sys_fstat sys_fstatat sys_lstat sys_mkdirat sys_mkfifoat sys_mknod sys_mknodat sys_nfstat sys_nlstat sys_nstat sys_stat lchflags |
| 89 | +# For <sys/statfs.h>. |
| 90 | +sysdep_routines += fstatfs64 statfs64 sys_fstatfs sys_statfs |
| 91 | +# For <stdio.h> |
| 92 | +sysdep_routines += sys_renameat |
| 93 | +# For <sys/times.h>. |
| 94 | +sysdep_routines += sys_futimesat |
| 95 | +# Other. |
| 96 | +sysdep_routines += lchmod |
| 97 | +endif |
| 98 | + |
| 99 | +ifeq ($(subdir),dirent) |
| 100 | +# For <dirent.h>. |
| 101 | +sysdep_routines += sys_getdents sys_getdirentries getdirentries getdirentries64 |
| 102 | +endif |
| 103 | + |
| 104 | +ifeq ($(subdir),misc) |
| 105 | +# For <kenv.h>. |
| 106 | +sysdep_routines += kenv |
| 107 | +# For <sched.h>. |
| 108 | +sysdep_routines += clone start_thread |
| 109 | +# For <unistd.h>. |
| 110 | +sysdep_routines += sys_ftruncate sys_freebsd6_ftruncate sys_truncate sys_freebsd6_truncate getosreldate |
| 111 | +# For <sys/acl.h>. |
| 112 | +sysdep_routines += acl_aclcheck_fd acl_aclcheck_file acl_delete_fd acl_delete_file acl_get_fd acl_get_file acl_set_fd acl_set_file |
| 113 | +# For <sys/extattr.h>. |
| 114 | +sysdep_routines += extattrctl extattr_delete_file extattr_get_file extattr_set_file |
| 115 | +# For <sys/jail.h>. |
| 116 | +sysdep_routines += jail jail_attach jail_remove jail_get jail_set |
| 117 | +# For <sys/ktrace.h>. |
| 118 | +sysdep_routines += ktrace utrace |
| 119 | +# For <sys/linker.h>. |
| 120 | +sysdep_routines += kldfind kldfirstmod kldload kldnext kldstat kldsym kldunload kldunloadf |
| 121 | +# For <sys/mman.h>. |
| 122 | +sysdep_routines += minherit sys_mmap sys_freebsd6_mmap sys_munmap |
| 123 | +# For <sys/mount.h>. |
| 124 | +sysdep_routines += fhopen sys_fhstat sys_fhstatfs fhstat fhstat64 fhstatfs fhstatfs64 getfh getfsstat getfsstat64 sys_getfsstat getmntinfo getmntinfo64 mount nmount unmount |
| 125 | +# For <sys/rfork.h>. |
| 126 | +sysdep_routines += rfork |
| 127 | +# For <sys/rtprio.h>. |
| 128 | +sysdep_routines += rtprio |
| 129 | +# For <sys/socket.h>. |
| 130 | +sysdep_routines += bsd_sendfile |
| 131 | +# For <sys/stat.h>. |
| 132 | +sysdep_routines += devname |
| 133 | +# For <sys/sysctl.h>. |
| 134 | +sysdep_routines += sysctl sysctlbyname sysctlnametomib |
| 135 | +# For <sys/uio.h>. |
| 136 | +sysdep_routines += sys_readv sys_writev |
| 137 | +# Other. |
| 138 | +sysdep_routines += swapon swapoff sys_aio_cancel sys_aio_error sys_aio_read sys_aio_return sys_aio_suspend sys_aio_waitcomplete sys_aio_write sys_lio_listio issetugid modfind modfnext modnext modstat obreak quotactl rfork sysarch undelete yield |
| 139 | +# for INLINE_SYSCALL |
| 140 | +sysdep_routines += sys_fork sys_execve sys_sigaction sys_close sys_fcntl |
| 141 | +sysdep_routines += sys_clock_getres sys_clock_gettime sys_clock_settime |
| 142 | +sysdep_routines += sys_ktimer_create sys_ktimer_gettime sys_ktimer_settime sys_ktimer_getoverrun sys_ktimer_delete |
| 143 | +sysdep_routines += sys_shm_open sys_shm_unlink sys_pselect sys_semctl |
| 144 | +endif |
| 145 | + |
| 146 | +ifeq ($(subdir),posix) |
| 147 | +# For <unistd.h>. |
| 148 | +sysdep_routines += sys_getlogin sys_pread sys_freebsd6_pread sys_pwrite sys_freebsd6_pwrite sys_setlogin sys_read sys_write |
| 149 | +# for <sched.h> |
| 150 | +sysdep_routines += sys_cpuset_getaffinity sys_cpuset_setaffinity |
| 151 | +endif |
| 152 | + |
| 153 | +ifeq ($(subdir),inet) |
| 154 | +sysdep_headers += net/ethernet.h net/if_ether.h |
| 155 | +endif |
| 156 | + |
| 157 | +ifeq ($(subdir),time) |
| 158 | +# For <sys/timex.h>. |
| 159 | +sysdep_routines += ntp_adjtime ntp_gettime |
| 160 | +endif |
| 161 | + |
| 162 | +ifeq ($(subdir),socket) |
| 163 | +sysdep_routines += sa_len sys_bind sys_connect sys_sendto |
| 164 | +endif |
| 165 | + |
| 166 | +# Linuxthreads dependencies. |
| 167 | + |
| 168 | +ifeq ($(subdir),posix) |
| 169 | +sysdep_headers += bits/initspin.h |
| 170 | +endif |
| 171 | + |
| 172 | +# Don't compile the ctype glue code, since we have a much better <ctype.h> |
| 173 | +# than the old non-GNU C library. |
| 174 | +inhibit-glue = yes |
| 175 | + |
| 176 | +# Special ELF hacks. |
| 177 | +ifeq ($(subdir),elf) |
| 178 | +sysdep-rtld-routines += dl-brk dl-sbrk |
| 179 | +sysdep_routines += sys_umtx |
| 180 | +endif |
| 181 | + |
| 182 | +ifeq ($(subdir),sunrpc) |
| 183 | +sysdep_headers += nfs/nfs.h |
| 184 | +endif |
| 185 | --- /dev/null |
| 186 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/Versions |
| 187 | @@ -0,0 +1,121 @@ |
| 188 | +libc { |
| 189 | + # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk. |
| 190 | + # When you get an error from errlist-compat.awk, you need to add a new |
| 191 | + # version here. Don't do this blindly, since this means changing the ABI |
| 192 | + # for all GNU/kFreeBSD configurations. |
| 193 | + |
| 194 | + GLIBC_2.2.6 { |
| 195 | + # c* |
| 196 | + clone; |
| 197 | + |
| 198 | + # e* |
| 199 | + extattrctl; extattr_delete_file; extattr_get_file; extattr_set_file; |
| 200 | + |
| 201 | + # f* |
| 202 | + fhopen; fhstat; fhstatfs; futimes; |
| 203 | + |
| 204 | + # g* |
| 205 | + getdents; getfh; getfsstat; getfsstat64; getmntinfo; getmntinfo64; |
| 206 | + getresgid; getresuid; |
| 207 | + |
| 208 | + # i* |
| 209 | + issetugid; |
| 210 | + |
| 211 | + # j* |
| 212 | + jail; |
| 213 | + |
| 214 | + # k* |
| 215 | + kldfind; kldfirstmod; kldload; kldnext; kldstat; kldsym; kldunload; kldunloadf; |
| 216 | + ktrace; |
| 217 | + |
| 218 | + # l* |
| 219 | + lchmod; lutimes; |
| 220 | + |
| 221 | + # m* |
| 222 | + minherit; modfind; modfnext; modnext; modstat; mount; |
| 223 | + |
| 224 | + # n* |
| 225 | + nmount; ntp_adjtime; ntp_gettime; |
| 226 | + |
| 227 | + # q* |
| 228 | + quotactl; |
| 229 | + |
| 230 | + # r* |
| 231 | + rfork; rtprio; |
| 232 | + |
| 233 | + # s* |
| 234 | + sendfile; setresgid; setresuid; swapoff; swapon; sysarch; sysctl; sysctlbyname; |
| 235 | + |
| 236 | + # u* |
| 237 | + undelete; unmount; utrace; |
| 238 | + |
| 239 | + # see <sys/acl.h>. |
| 240 | + __acl_aclcheck_fd; __acl_aclcheck_file; __acl_delete_fd; __acl_delete_file; |
| 241 | + __acl_get_fd; __acl_get_file; __acl_set_fd; __acl_set_file; |
| 242 | + |
| 243 | + # see <errno.h>. |
| 244 | + __errno_location; |
| 245 | + |
| 246 | + # see <sys/sysctl.h>. |
| 247 | + __sysctl; |
| 248 | + |
| 249 | + # Questionable system calls. These functions may be removed at any moment. |
| 250 | + __syscall_aio_cancel; __syscall_aio_error; __syscall_aio_read; |
| 251 | + __syscall_aio_return; __syscall_aio_suspend; __syscall_aio_waitcomplete; |
| 252 | + __syscall_aio_write; __syscall_lio_listio; |
| 253 | + __syscall_obreak; |
| 254 | + __syscall_yield; |
| 255 | + } |
| 256 | + GLIBC_2.3 { |
| 257 | + #errlist-compat 87 |
| 258 | + _sys_errlist; sys_errlist; _sys_nerr; sys_nerr; |
| 259 | + } |
| 260 | + GLIBC_2.3.4 { |
| 261 | + # f* |
| 262 | + fhstat64; fhstatfs64; |
| 263 | + kqueue; kevent; |
| 264 | + |
| 265 | + #errlist-compat 93 |
| 266 | + _sys_errlist; sys_errlist; _sys_nerr; sys_nerr; |
| 267 | + |
| 268 | + # functions used in inline functions or macros |
| 269 | + __libc_sa_len; |
| 270 | + } |
| 271 | + GLIBC_2.10 { |
| 272 | + devname; |
| 273 | + devname_r; |
| 274 | + kenv; |
| 275 | + sysctlnametomib; |
| 276 | + } |
| 277 | + GLIBC_2.11 { |
| 278 | + lchflags; |
| 279 | + #errlist-compat 94 |
| 280 | + _sys_errlist; sys_errlist; _sys_nerr; sys_nerr; |
| 281 | + } |
| 282 | + GLIBC_2.13 { |
| 283 | + jail_attach; |
| 284 | + jail_remove; |
| 285 | + jail_get; |
| 286 | + jail_set; |
| 287 | + } |
| 288 | + GLIBC_PRIVATE { |
| 289 | + # needed by libpthread. |
| 290 | + __clone; __libc_fork; __libc_sigaction; __kernel_getosreldate; |
| 291 | + # needed by libpthread as INLINE_SYSCALL: |
| 292 | + __syscall_fork; |
| 293 | + __syscall_open; __syscall_close; |
| 294 | + __syscall_read; __syscall_write; |
| 295 | + __syscall_wait4; __syscall_fcntl; |
| 296 | + # needed by librt as INLINE_SYSCALL: |
| 297 | + __syscall_clock_getres; __syscall_clock_gettime; __syscall_clock_settime; |
| 298 | + __syscall_ktimer_create; __syscall_ktimer_gettime; __syscall_ktimer_settime; __syscall_ktimer_getoverrun; __syscall_ktimer_delete; |
| 299 | + __syscall_shm_open; __syscall_shm_unlink; |
| 300 | + # misc fixes for FreeBSD: |
| 301 | + __syscall_freebsd6_lseek; __syscall_freebsd6_pread; __syscall_freebsd6_pwrite; |
| 302 | + __syscall_lseek; __syscall_pread; __syscall_pwrite; |
| 303 | + __syscall_connect; __syscall_sendto; |
| 304 | + __syscall_cpuset_getaffinity ; __syscall_cpuset_setaffinity; |
| 305 | + # global variable used in brk() |
| 306 | + _end; |
| 307 | + } |
| 308 | +} |
| 309 | --- /dev/null |
| 310 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/_G_config.h |
| 311 | @@ -0,0 +1,100 @@ |
| 312 | +/* This file is needed by libio to define various configuration parameters. |
| 313 | + These are always the same in the GNU C library. */ |
| 314 | + |
| 315 | +#ifndef _G_config_h |
| 316 | +#define _G_config_h 1 |
| 317 | + |
| 318 | +/* Define types for libio in terms of the standard internal type names. */ |
| 319 | + |
| 320 | +#include <bits/types.h> |
| 321 | +#define __need_size_t |
| 322 | +#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T |
| 323 | +# define __need_wchar_t |
| 324 | +#endif |
| 325 | +#define __need_NULL |
| 326 | +#include <stddef.h> |
| 327 | +#define __need_mbstate_t |
| 328 | +#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T |
| 329 | +# define __need_wint_t |
| 330 | +#endif |
| 331 | +#include <wchar.h> |
| 332 | +#define _G_size_t size_t |
| 333 | +typedef struct |
| 334 | +{ |
| 335 | + __off_t __pos; |
| 336 | + __mbstate_t __state; |
| 337 | +} _G_fpos_t; |
| 338 | +typedef struct |
| 339 | +{ |
| 340 | + __off64_t __pos; |
| 341 | + __mbstate_t __state; |
| 342 | +} _G_fpos64_t; |
| 343 | +#define _G_ssize_t __ssize_t |
| 344 | +#define _G_off_t __off_t |
| 345 | +#define _G_off64_t __off64_t |
| 346 | +#define _G_pid_t __pid_t |
| 347 | +#define _G_uid_t __uid_t |
| 348 | +#define _G_wchar_t wchar_t |
| 349 | +#define _G_wint_t wint_t |
| 350 | +#define _G_stat64 stat64 |
| 351 | +#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T |
| 352 | +# include <gconv.h> |
| 353 | +typedef union |
| 354 | +{ |
| 355 | + struct __gconv_info __cd; |
| 356 | + struct |
| 357 | + { |
| 358 | + struct __gconv_info __cd; |
| 359 | + struct __gconv_step_data __data; |
| 360 | + } __combined; |
| 361 | +} _G_iconv_t; |
| 362 | +#endif |
| 363 | + |
| 364 | +typedef int _G_int16_t __attribute__ ((__mode__ (__HI__))); |
| 365 | +typedef int _G_int32_t __attribute__ ((__mode__ (__SI__))); |
| 366 | +typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__))); |
| 367 | +typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__))); |
| 368 | + |
| 369 | +#define _G_HAVE_BOOL 1 |
| 370 | + |
| 371 | + |
| 372 | +/* These library features are always available in the GNU C library. */ |
| 373 | +#define _G_HAVE_ATEXIT 1 |
| 374 | +#define _G_HAVE_SYS_CDEFS 1 |
| 375 | +#define _G_HAVE_SYS_WAIT 1 |
| 376 | +#define _G_NEED_STDARG_H 1 |
| 377 | +#define _G_va_list __gnuc_va_list |
| 378 | + |
| 379 | +#define _G_HAVE_PRINTF_FP 1 |
| 380 | +#define _G_HAVE_MMAP 1 |
| 381 | +#define _G_HAVE_LONG_DOUBLE_IO 1 |
| 382 | +#define _G_HAVE_IO_FILE_OPEN 1 |
| 383 | +#define _G_HAVE_IO_GETLINE_INFO 1 |
| 384 | + |
| 385 | +#define _G_IO_IO_FILE_VERSION 0x20001 |
| 386 | + |
| 387 | +#define _G_OPEN64 __open64 |
| 388 | +#define _G_LSEEK64 __lseek64 |
| 389 | +#define _G_MMAP64 __mmap64 |
| 390 | +#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf) |
| 391 | + |
| 392 | +/* This is defined by <bits/stat.h> if `st_blksize' exists. */ |
| 393 | +#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE) |
| 394 | + |
| 395 | +#define _G_BUFSIZ 8192 |
| 396 | + |
| 397 | +/* These are the vtbl details for ELF. */ |
| 398 | +#define _G_NAMES_HAVE_UNDERSCORE 0 |
| 399 | +#define _G_VTABLE_LABEL_HAS_LENGTH 1 |
| 400 | +#define _G_USING_THUNKS 1 |
| 401 | +#define _G_VTABLE_LABEL_PREFIX "__vt_" |
| 402 | +#define _G_VTABLE_LABEL_PREFIX_ID __vt_ |
| 403 | + |
| 404 | + |
| 405 | +#if defined __cplusplus || defined __STDC__ |
| 406 | +# define _G_ARGS(ARGLIST) ARGLIST |
| 407 | +#else |
| 408 | +# define _G_ARGS(ARGLIST) () |
| 409 | +#endif |
| 410 | + |
| 411 | +#endif /* _G_config.h */ |
| 412 | --- /dev/null |
| 413 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/a.out.h |
| 414 | @@ -0,0 +1,140 @@ |
| 415 | +#ifndef __A_OUT_GNU_H__ |
| 416 | +#define __A_OUT_GNU_H__ |
| 417 | + |
| 418 | +#define __GNU_EXEC_MACROS__ |
| 419 | + |
| 420 | +struct exec |
| 421 | +{ |
| 422 | + unsigned long a_info; /* Use macros N_MAGIC, etc for access. */ |
| 423 | + unsigned int a_text; /* Length of text, in bytes. */ |
| 424 | + unsigned int a_data; /* Length of data, in bytes. */ |
| 425 | + unsigned int a_bss; /* Length of uninitialized data area for file, in bytes. */ |
| 426 | + unsigned int a_syms; /* Length of symbol table data in file, in bytes. */ |
| 427 | + unsigned int a_entry; /* Start address. */ |
| 428 | + unsigned int a_trsize;/* Length of relocation info for text, in bytes. */ |
| 429 | + unsigned int a_drsize;/* Length of relocation info for data, in bytes. */ |
| 430 | +}; |
| 431 | + |
| 432 | +enum machine_type |
| 433 | +{ |
| 434 | + M_OLDSUN2 = 0, |
| 435 | + M_68010 = 1, |
| 436 | + M_68020 = 2, |
| 437 | + M_SPARC = 3, |
| 438 | + M_386 = 100, |
| 439 | + M_MIPS1 = 151, |
| 440 | + M_MIPS2 = 152 |
| 441 | +}; |
| 442 | + |
| 443 | +#define N_MAGIC(exec) ((exec).a_info & 0xffff) |
| 444 | +#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff)) |
| 445 | +#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff) |
| 446 | +#define N_SET_INFO(exec, magic, type, flags) \ |
| 447 | + ((exec).a_info = ((magic) & 0xffff) \ |
| 448 | + | (((int)(type) & 0xff) << 16) \ |
| 449 | + | (((flags) & 0xff) << 24)) |
| 450 | +#define N_SET_MAGIC(exec, magic) \ |
| 451 | + ((exec).a_info = ((exec).a_info & 0xffff0000) | ((magic) & 0xffff)) |
| 452 | +#define N_SET_MACHTYPE(exec, machtype) \ |
| 453 | + ((exec).a_info = \ |
| 454 | + ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16)) |
| 455 | +#define N_SET_FLAGS(exec, flags) \ |
| 456 | + ((exec).a_info = \ |
| 457 | + ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24)) |
| 458 | + |
| 459 | +/* Code indicating object file or impure executable. */ |
| 460 | +#define OMAGIC 0407 |
| 461 | +/* Code indicating pure executable. */ |
| 462 | +#define NMAGIC 0410 |
| 463 | +/* Code indicating demand-paged executable. */ |
| 464 | +#define ZMAGIC 0413 |
| 465 | +/* This indicates a demand-paged executable with the header in the text. |
| 466 | + The first page is unmapped to help trap NULL pointer references. */ |
| 467 | +#define QMAGIC 0314 |
| 468 | +/* Code indicating core file. */ |
| 469 | +#define CMAGIC 0421 |
| 470 | + |
| 471 | +#define N_TRSIZE(a) ((a).a_trsize) |
| 472 | +#define N_DRSIZE(a) ((a).a_drsize) |
| 473 | +#define N_SYMSIZE(a) ((a).a_syms) |
| 474 | +#define N_BADMAG(x) \ |
| 475 | + (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \ |
| 476 | + && N_MAGIC(x) != ZMAGIC && N_MAGIC(x) != QMAGIC) |
| 477 | +#define _N_HDROFF(x) (1024 - sizeof (struct exec)) |
| 478 | +#define N_TXTOFF(x) \ |
| 479 | + (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \ |
| 480 | + (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec))) |
| 481 | +#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text) |
| 482 | +#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data) |
| 483 | +#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x)) |
| 484 | +#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x)) |
| 485 | +#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x)) |
| 486 | + |
| 487 | +/* Address of text segment in memory after it is loaded. */ |
| 488 | +#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? 4096 : 0) |
| 489 | + |
| 490 | +/* Address of data segment in memory after it is loaded. */ |
| 491 | +#define SEGMENT_SIZE 1024 |
| 492 | + |
| 493 | +#define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1)) |
| 494 | +#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text) |
| 495 | + |
| 496 | +#define N_DATADDR(x) \ |
| 497 | + (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \ |
| 498 | + : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x)))) |
| 499 | +#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data) |
| 500 | + |
| 501 | +#if !defined (N_NLIST_DECLARED) |
| 502 | +struct nlist |
| 503 | +{ |
| 504 | + union |
| 505 | + { |
| 506 | + char *n_name; |
| 507 | + union |
| 508 | + { |
| 509 | + char *n_name; |
| 510 | + struct nlist *n_next; |
| 511 | + long n_strx; |
| 512 | + } n_un; |
| 513 | + } __attribute__ ((__transparent_union__)); |
| 514 | + unsigned char n_type; |
| 515 | + char n_other; |
| 516 | + short n_desc; |
| 517 | + unsigned long n_value; |
| 518 | +}; |
| 519 | +#endif /* no N_NLIST_DECLARED. */ |
| 520 | + |
| 521 | +#define N_UNDF 0 |
| 522 | +#define N_ABS 2 |
| 523 | +#define N_TEXT 4 |
| 524 | +#define N_DATA 6 |
| 525 | +#define N_BSS 8 |
| 526 | +#define N_FN 15 |
| 527 | +#define N_EXT 1 |
| 528 | +#define N_TYPE 036 |
| 529 | +#define N_STAB 0340 |
| 530 | +#define N_INDR 0xa |
| 531 | +#define N_SETA 0x14 /* Absolute set element symbol. */ |
| 532 | +#define N_SETT 0x16 /* Text set element symbol. */ |
| 533 | +#define N_SETD 0x18 /* Data set element symbol. */ |
| 534 | +#define N_SETB 0x1A /* Bss set element symbol. */ |
| 535 | +#define N_SETV 0x1C /* Pointer to set vector in data area. */ |
| 536 | + |
| 537 | +#if !defined (N_RELOCATION_INFO_DECLARED) |
| 538 | +/* This structure describes a single relocation to be performed. |
| 539 | + The text-relocation section of the file is a vector of these structures, |
| 540 | + all of which apply to the text section. |
| 541 | + Likewise, the data-relocation section applies to the data section. */ |
| 542 | + |
| 543 | +struct relocation_info |
| 544 | +{ |
| 545 | + int r_address; |
| 546 | + unsigned int r_symbolnum:24; |
| 547 | + unsigned int r_pcrel:1; |
| 548 | + unsigned int r_length:2; |
| 549 | + unsigned int r_extern:1; |
| 550 | + unsigned int r_pad:4; |
| 551 | +}; |
| 552 | +#endif /* no N_RELOCATION_INFO_DECLARED. */ |
| 553 | + |
| 554 | +#endif /* __A_OUT_GNU_H__ */ |
| 555 | --- /dev/null |
| 556 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/access.c |
| 557 | @@ -0,0 +1,68 @@ |
| 558 | +/* Copyright (C) 2009 Free Software Foundation, Inc. |
| 559 | + This file is part of the GNU C Library. |
| 560 | + |
| 561 | + The GNU C Library is free software; you can redistribute it and/or |
| 562 | + modify it under the terms of the GNU Lesser General Public |
| 563 | + License as published by the Free Software Foundation; either |
| 564 | + version 2.1 of the License, or (at your option) any later version. |
| 565 | + |
| 566 | + The GNU C Library is distributed in the hope that it will be useful, |
| 567 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 568 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 569 | + Lesser General Public License for more details. |
| 570 | + |
| 571 | + You should have received a copy of the GNU Lesser General Public |
| 572 | + License along with the GNU C Library; if not, write to the Free |
| 573 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 574 | + 02111-1307 USA. */ |
| 575 | + |
| 576 | +#include <errno.h> |
| 577 | +#include <fcntl.h> |
| 578 | +#include <stddef.h> |
| 579 | +#include <stdio.h> |
| 580 | +#include <string.h> |
| 581 | +#include <unistd.h> |
| 582 | +#include <sys/types.h> |
| 583 | +#include <sys/sysctl.h> |
| 584 | +#include <sys/user.h> |
| 585 | +#include <sysdep.h> |
| 586 | + |
| 587 | +/* |
| 588 | + The FreeBSD kernel do not test file access correctly when the |
| 589 | + process' real user ID is superuser. In particular, they always return |
| 590 | + zero when testing execute permissions without regard to whether the |
| 591 | + file is executable. |
| 592 | + |
| 593 | + While this behaviour conforms to POSIX.1-2008, it is explicitely |
| 594 | + discouraged. This wrapper implements the recommended behaviour. |
| 595 | + */ |
| 596 | + |
| 597 | +extern int __syscall_access (const char *path, int mode); |
| 598 | +libc_hidden_proto (__syscall_access) |
| 599 | + |
| 600 | +int |
| 601 | +__access (const char *path, int mode) |
| 602 | +{ |
| 603 | + struct stat64 stats; |
| 604 | + |
| 605 | + if ((__getuid() != 0) || !(mode & X_OK)) |
| 606 | + return __syscall_access (path, mode); |
| 607 | + |
| 608 | + /* Althought the super-user can read and write any file, |
| 609 | + the file-system might be i.e. read-only. Do the check. */ |
| 610 | + |
| 611 | + if (__syscall_access (path, mode)) |
| 612 | + return -1; |
| 613 | + |
| 614 | + if (stat64 (path, &stats)) |
| 615 | + return -1; |
| 616 | + |
| 617 | + /* The super-user can execute any file that anyone can execute. */ |
| 618 | + if (stats.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) |
| 619 | + return 0; |
| 620 | + |
| 621 | + __set_errno (EACCES); |
| 622 | + return -1; |
| 623 | +} |
| 624 | + |
| 625 | +weak_alias (__access, access) |
| 626 | --- /dev/null |
| 627 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bind.c |
| 628 | @@ -0,0 +1,60 @@ |
| 629 | +/* Copyright (C) 2005 Free Software Foundation, Inc. |
| 630 | + This file is part of the GNU C Library. |
| 631 | + Contributed by Aurelien Jarno <aurelien@aurel32.net>, 2005. |
| 632 | + |
| 633 | + The GNU C Library is free software; you can redistribute it and/or |
| 634 | + modify it under the terms of the GNU Lesser General Public |
| 635 | + License as published by the Free Software Foundation; either |
| 636 | + version 2.1 of the License, or (at your option) any later version. |
| 637 | + |
| 638 | + The GNU C Library is distributed in the hope that it will be useful, |
| 639 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 640 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 641 | + Lesser General Public License for more details. |
| 642 | + |
| 643 | + You should have received a copy of the GNU Lesser General Public |
| 644 | + License along with the GNU C Library; if not, write to the Free |
| 645 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 646 | + 02111-1307 USA. */ |
| 647 | + |
| 648 | +#include <sys/socket.h> |
| 649 | +#include <sysdep.h> |
| 650 | + |
| 651 | +/* According to POSIX.1-2004 the len argument specifies the length of |
| 652 | + the sockaddr structure pointed to by the addrarg argument. However |
| 653 | + the FreeBSD kernel waits the actual length of the address stored |
| 654 | + there. The code below emulate this behaviour. */ |
| 655 | + |
| 656 | +extern int __libc_sa_len (sa_family_t __af); |
| 657 | +extern int __libc_sa_len_internal (sa_family_t __af); |
| 658 | + |
| 659 | +extern int __syscall_bind (int fd, __CONST_SOCKADDR_ARG addr, |
| 660 | + socklen_t addrlen) __THROW; |
| 661 | +libc_hidden_proto (__syscall_bind) |
| 662 | + |
| 663 | +/* Open a connection on socket FD to peer at ADDR (which LEN bytes long). |
| 664 | + For connectionless socket types, just set the default address to send to |
| 665 | + and the only address from which to accept transmissions. |
| 666 | + Return 0 on success, -1 for errors. */ |
| 667 | + |
| 668 | +int |
| 669 | +__bind (int fd, __CONST_SOCKADDR_ARG addr, socklen_t addrlen) |
| 670 | +{ |
| 671 | + socklen_t new_addrlen; |
| 672 | + |
| 673 | +#ifndef NOT_IN_libc |
| 674 | + new_addrlen = INTUSE(__libc_sa_len) ((addr.__sockaddr__)->sa_family); |
| 675 | +#else |
| 676 | + new_addrlen = __libc_sa_len ((addr.__sockaddr__)->sa_family); |
| 677 | +#endif |
| 678 | + |
| 679 | + /* Only allow a smaller size, otherwise it could lead to |
| 680 | + stack corruption */ |
| 681 | + if ((new_addrlen != 0) && (new_addrlen < addrlen)) |
| 682 | + addrlen = new_addrlen; |
| 683 | + |
| 684 | + /* We pass 3 arguments. */ |
| 685 | + return INLINE_SYSCALL (bind, 3, fd, addr.__sockaddr__, addrlen); |
| 686 | +} |
| 687 | + |
| 688 | +weak_alias (__bind, bind) |
| 689 | --- /dev/null |
| 690 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/dirent.h |
| 691 | @@ -0,0 +1,52 @@ |
| 692 | +/* Directory entry structure `struct dirent'. FreeBSD version. |
| 693 | + Copyright (C) 1996-1998,2001-2002 Free Software Foundation, Inc. |
| 694 | + This file is part of the GNU C Library. |
| 695 | + |
| 696 | + The GNU C Library is free software; you can redistribute it and/or |
| 697 | + modify it under the terms of the GNU Lesser General Public |
| 698 | + License as published by the Free Software Foundation; either |
| 699 | + version 2.1 of the License, or (at your option) any later version. |
| 700 | + |
| 701 | + The GNU C Library is distributed in the hope that it will be useful, |
| 702 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 703 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 704 | + Lesser General Public License for more details. |
| 705 | + |
| 706 | + You should have received a copy of the GNU Lesser General Public |
| 707 | + License along with the GNU C Library; if not, write to the Free |
| 708 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 709 | + 02111-1307 USA. */ |
| 710 | + |
| 711 | +#ifndef _DIRENT_H |
| 712 | +# error "Never use <bits/dirent.h> directly; include <dirent.h> instead." |
| 713 | +#endif |
| 714 | + |
| 715 | +struct dirent |
| 716 | + { |
| 717 | + unsigned int d_ino; /* File serial number. */ |
| 718 | + unsigned short int d_reclen; /* Length of the whole `struct dirent'. */ |
| 719 | + unsigned char d_type; /* File type, possibly unknown. */ |
| 720 | + unsigned char d_namlen; /* Length of the file name. */ |
| 721 | + |
| 722 | + /* Only this member is in the POSIX standard. */ |
| 723 | + char d_name[256]; /* File name (actually longer). */ |
| 724 | + }; |
| 725 | + |
| 726 | +#ifdef __USE_LARGEFILE64 |
| 727 | +struct dirent64 |
| 728 | + { |
| 729 | + unsigned int d_ino; /* File serial number. */ |
| 730 | + unsigned short int d_reclen; /* Length of the whole `struct dirent'. */ |
| 731 | + unsigned char d_type; /* File type, possibly unknown. */ |
| 732 | + unsigned char d_namlen; /* Length of the file name. */ |
| 733 | + |
| 734 | + /* Only this member is in the POSIX standard. */ |
| 735 | + char d_name[256]; /* File name (actually longer). */ |
| 736 | + }; |
| 737 | +#endif |
| 738 | + |
| 739 | +#define d_fileno d_ino /* Backwards compatibility. */ |
| 740 | + |
| 741 | +#define _DIRENT_HAVE_D_RECLEN 1 |
| 742 | +#define _DIRENT_HAVE_D_NAMLEN 1 |
| 743 | +#define _DIRENT_HAVE_D_TYPE 1 |
| 744 | --- /dev/null |
| 745 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/elf.h |
| 746 | @@ -0,0 +1,37 @@ |
| 747 | +/* This file defines standard ELF types, structures, and macros. |
| 748 | + Copyright (C) 1995-2003,2004,2005,2006,2007,2008,2009,2010 |
| 749 | + Free Software Foundation, Inc. |
| 750 | + This file is part of the GNU C Library. |
| 751 | + |
| 752 | + The GNU C Library is free software; you can redistribute it and/or |
| 753 | + modify it under the terms of the GNU Lesser General Public |
| 754 | + License as published by the Free Software Foundation; either |
| 755 | + version 2.1 of the License, or (at your option) any later version. |
| 756 | + |
| 757 | + The GNU C Library is distributed in the hope that it will be useful, |
| 758 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 759 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 760 | + Lesser General Public License for more details. |
| 761 | + |
| 762 | + You should have received a copy of the GNU Lesser General Public |
| 763 | + License along with the GNU C Library; if not, write to the Free |
| 764 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 765 | + 02111-1307 USA. */ |
| 766 | + |
| 767 | +#ifndef _BITS_ELF_H |
| 768 | +#define _BITS_ELF_H |
| 769 | + |
| 770 | +__BEGIN_DECLS |
| 771 | + |
| 772 | +#define AT_EXECPATH 15 /* Path to the executable. */ |
| 773 | +#define AT_CANARY 16 /* Canary for SSP. */ |
| 774 | +#define AT_CANARYLEN 17 /* Length of the canary. */ |
| 775 | +#define AT_OSRELDATE 18 /* OSRELDATE. */ |
| 776 | +#define AT_NCPUS 19 /* Number of CPUs. */ |
| 777 | +#define AT_PAGESIZES 20 /* Pagesizes. */ |
| 778 | +#define AT_PAGESIZESLEN 21 /* Number of pagesizes. */ |
| 779 | +#define AT_STACKPROT 23 /* Initial stack protection. */ |
| 780 | + |
| 781 | +__END_DECLS |
| 782 | + |
| 783 | +#endif /* elf.h */ |
| 784 | --- /dev/null |
| 785 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/errno.h |
| 786 | @@ -0,0 +1,192 @@ |
| 787 | +/*- |
| 788 | + * Copyright (c) 1982, 1986, 1989, 1993 |
| 789 | + * The Regents of the University of California. All rights reserved. |
| 790 | + * (c) UNIX System Laboratories, Inc. |
| 791 | + * All or some portions of this file are derived from material licensed |
| 792 | + * to the University of California by American Telephone and Telegraph |
| 793 | + * Co. or Unix System Laboratories, Inc. and are reproduced herein with |
| 794 | + * the permission of UNIX System Laboratories, Inc. |
| 795 | + * |
| 796 | + * Redistribution and use in source and binary forms, with or without |
| 797 | + * modification, are permitted provided that the following conditions |
| 798 | + * are met: |
| 799 | + * 1. Redistributions of source code must retain the above copyright |
| 800 | + * notice, this list of conditions and the following disclaimer. |
| 801 | + * 2. Redistributions in binary form must reproduce the above copyright |
| 802 | + * notice, this list of conditions and the following disclaimer in the |
| 803 | + * documentation and/or other materials provided with the distribution. |
| 804 | + * 4. Neither the name of the University nor the names of its contributors |
| 805 | + * may be used to endorse or promote products derived from this software |
| 806 | + * without specific prior written permission. |
| 807 | + * |
| 808 | + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 809 | + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 810 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 811 | + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 812 | + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 813 | + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 814 | + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 815 | + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 816 | + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 817 | + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 818 | + * SUCH DAMAGE. |
| 819 | + * |
| 820 | + * @(#)errno.h 8.5 (Berkeley) 1/21/94 |
| 821 | + * $FreeBSD$ |
| 822 | + */ |
| 823 | + |
| 824 | +#ifdef _ERRNO_H |
| 825 | + |
| 826 | +# undef EDOM |
| 827 | +# undef EILSEQ |
| 828 | +# undef ERANGE |
| 829 | + |
| 830 | +#define EPERM 1 /* Operation not permitted */ |
| 831 | +#define ENOENT 2 /* No such file or directory */ |
| 832 | +#define ESRCH 3 /* No such process */ |
| 833 | +#define EINTR 4 /* Interrupted system call */ |
| 834 | +#define EIO 5 /* Input/output error */ |
| 835 | +#define ENXIO 6 /* Device not configured */ |
| 836 | +#define E2BIG 7 /* Argument list too long */ |
| 837 | +#define ENOEXEC 8 /* Exec format error */ |
| 838 | +#define EBADF 9 /* Bad file descriptor */ |
| 839 | +#define ECHILD 10 /* No child processes */ |
| 840 | +#define EDEADLK 11 /* Resource deadlock avoided */ |
| 841 | + /* 11 was EAGAIN */ |
| 842 | +#define ENOMEM 12 /* Cannot allocate memory */ |
| 843 | +#define EACCES 13 /* Permission denied */ |
| 844 | +#define EFAULT 14 /* Bad address */ |
| 845 | +#define ENOTBLK 15 /* Block device required */ |
| 846 | +#define EBUSY 16 /* Device busy */ |
| 847 | +#define EEXIST 17 /* File exists */ |
| 848 | +#define EXDEV 18 /* Cross-device link */ |
| 849 | +#define ENODEV 19 /* Operation not supported by device */ |
| 850 | +#define ENOTDIR 20 /* Not a directory */ |
| 851 | +#define EISDIR 21 /* Is a directory */ |
| 852 | +#define EINVAL 22 /* Invalid argument */ |
| 853 | +#define ENFILE 23 /* Too many open files in system */ |
| 854 | +#define EMFILE 24 /* Too many open files */ |
| 855 | +#define ENOTTY 25 /* Inappropriate ioctl for device */ |
| 856 | +#define ETXTBSY 26 /* Text file busy */ |
| 857 | +#define EFBIG 27 /* File too large */ |
| 858 | +#define ENOSPC 28 /* No space left on device */ |
| 859 | +#define ESPIPE 29 /* Illegal seek */ |
| 860 | +#define EROFS 30 /* Read-only filesystem */ |
| 861 | +#define EMLINK 31 /* Too many links */ |
| 862 | +#define EPIPE 32 /* Broken pipe */ |
| 863 | + |
| 864 | +/* math software */ |
| 865 | +#define EDOM 33 /* Numerical argument out of domain */ |
| 866 | +#define ERANGE 34 /* Result too large */ |
| 867 | + |
| 868 | +/* non-blocking and interrupt i/o */ |
| 869 | +#define EAGAIN 35 /* Resource temporarily unavailable */ |
| 870 | +#define EWOULDBLOCK EAGAIN /* Operation would block */ |
| 871 | +#define EINPROGRESS 36 /* Operation now in progress */ |
| 872 | +#define EALREADY 37 /* Operation already in progress */ |
| 873 | + |
| 874 | +/* ipc/network software -- argument errors */ |
| 875 | +#define ENOTSOCK 38 /* Socket operation on non-socket */ |
| 876 | +#define EDESTADDRREQ 39 /* Destination address required */ |
| 877 | +#define EMSGSIZE 40 /* Message too long */ |
| 878 | +#define EPROTOTYPE 41 /* Protocol wrong type for socket */ |
| 879 | +#define ENOPROTOOPT 42 /* Protocol not available */ |
| 880 | +#define EPROTONOSUPPORT 43 /* Protocol not supported */ |
| 881 | +#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ |
| 882 | +#define EOPNOTSUPP 45 /* Operation not supported */ |
| 883 | +#define ENOTSUP EOPNOTSUPP /* Operation not supported */ |
| 884 | +#define EPFNOSUPPORT 46 /* Protocol family not supported */ |
| 885 | +#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ |
| 886 | +#define EADDRINUSE 48 /* Address already in use */ |
| 887 | +#define EADDRNOTAVAIL 49 /* Can't assign requested address */ |
| 888 | + |
| 889 | +/* ipc/network software -- operational errors */ |
| 890 | +#define ENETDOWN 50 /* Network is down */ |
| 891 | +#define ENETUNREACH 51 /* Network is unreachable */ |
| 892 | +#define ENETRESET 52 /* Network dropped connection on reset */ |
| 893 | +#define ECONNABORTED 53 /* Software caused connection abort */ |
| 894 | +#define ECONNRESET 54 /* Connection reset by peer */ |
| 895 | +#define ENOBUFS 55 /* No buffer space available */ |
| 896 | +#define EISCONN 56 /* Socket is already connected */ |
| 897 | +#define ENOTCONN 57 /* Socket is not connected */ |
| 898 | +#define ESHUTDOWN 58 /* Can't send after socket shutdown */ |
| 899 | +#define ETOOMANYREFS 59 /* Too many references: can't splice */ |
| 900 | +#define ETIMEDOUT 60 /* Operation timed out */ |
| 901 | +#define ECONNREFUSED 61 /* Connection refused */ |
| 902 | + |
| 903 | +#define ELOOP 62 /* Too many levels of symbolic links */ |
| 904 | +#define ENAMETOOLONG 63 /* File name too long */ |
| 905 | + |
| 906 | +/* should be rearranged */ |
| 907 | +#define EHOSTDOWN 64 /* Host is down */ |
| 908 | +#define EHOSTUNREACH 65 /* No route to host */ |
| 909 | +#define ENOTEMPTY 66 /* Directory not empty */ |
| 910 | + |
| 911 | +/* quotas & mush */ |
| 912 | +#define EPROCLIM 67 /* Too many processes */ |
| 913 | +#define EUSERS 68 /* Too many users */ |
| 914 | +#define EDQUOT 69 /* Disc quota exceeded */ |
| 915 | + |
| 916 | +/* Network File System */ |
| 917 | +#define ESTALE 70 /* Stale NFS file handle */ |
| 918 | +#define EREMOTE 71 /* Too many levels of remote in path */ |
| 919 | +#define EBADRPC 72 /* RPC struct is bad */ |
| 920 | +#define ERPCMISMATCH 73 /* RPC version wrong */ |
| 921 | +#define EPROGUNAVAIL 74 /* RPC prog. not avail */ |
| 922 | +#define EPROGMISMATCH 75 /* Program version wrong */ |
| 923 | +#define EPROCUNAVAIL 76 /* Bad procedure for program */ |
| 924 | + |
| 925 | +#define ENOLCK 77 /* No locks available */ |
| 926 | +#define ENOSYS 78 /* Function not implemented */ |
| 927 | + |
| 928 | +#define EFTYPE 79 /* Inappropriate file type or format */ |
| 929 | +#define EAUTH 80 /* Authentication error */ |
| 930 | +#define ENEEDAUTH 81 /* Need authenticator */ |
| 931 | +#define EIDRM 82 /* Identifier removed */ |
| 932 | +#define ENOMSG 83 /* No message of desired type */ |
| 933 | +#define EOVERFLOW 84 /* Value too large to be stored in data type */ |
| 934 | +#define ECANCELED 85 /* Operation canceled */ |
| 935 | +#define EILSEQ 86 /* Illegal byte sequence */ |
| 936 | +#define ENOATTR 87 /* Attribute not found */ |
| 937 | + |
| 938 | +#define EDOOFUS 88 /* Programming error */ |
| 939 | + |
| 940 | +#define EBADMSG 89 /* Bad message */ |
| 941 | +#define EMULTIHOP 90 /* Multihop attempted */ |
| 942 | +#define ENOLINK 91 /* Link has been severed */ |
| 943 | +#define EPROTO 92 /* Protocol error */ |
| 944 | + |
| 945 | +#define ENOTCAPABLE 93 /* Capabilities insufficient */ |
| 946 | + |
| 947 | +#define ELAST 93 /* Must be equal largest errno */ |
| 948 | + |
| 949 | +#ifdef _KERNEL |
| 950 | +/* pseudo-errors returned inside kernel to modify return to process */ |
| 951 | +#define ERESTART (-1) /* restart syscall */ |
| 952 | +#define EJUSTRETURN (-2) /* don't modify regs, just return */ |
| 953 | +#define ENOIOCTL (-3) /* ioctl not handled by this layer */ |
| 954 | +#define EDIRIOCTL (-4) /* do direct ioctl in GEOM */ |
| 955 | +#endif |
| 956 | + |
| 957 | +# ifndef __ASSEMBLER__ |
| 958 | +/* Function to get address of global `errno' variable. */ |
| 959 | +extern int *__errno_location (void) __THROW __attribute__ ((__const__)); |
| 960 | + |
| 961 | +# if !defined _LIBC || defined _LIBC_REENTRANT |
| 962 | +/* When using threads, errno is a per-thread value. */ |
| 963 | +# define errno (*__errno_location ()) |
| 964 | +# endif |
| 965 | +# endif /* !__ASSEMBLER__ */ |
| 966 | +#endif /* _ERRNO_H */ |
| 967 | + |
| 968 | +#if !defined _ERRNO_H && defined __need_Emath |
| 969 | +/* This is ugly but the kernel header is not clean enough. We must |
| 970 | + define only the values EDOM, EILSEQ and ERANGE in case __need_Emath is |
| 971 | + defined. */ |
| 972 | + |
| 973 | +#define EDOM 33 /* Numerical argument out of domain */ |
| 974 | +#define ERANGE 34 /* Result too large */ |
| 975 | +#define EILSEQ 86 /* Illegal byte sequence */ |
| 976 | + |
| 977 | +#endif /* !_ERRNO_H && __need_Emath */ |
| 978 | + |
| 979 | --- /dev/null |
| 980 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/fcntl.h |
| 981 | @@ -0,0 +1,186 @@ |
| 982 | +/* O_*, F_*, FD_* bit values for FreeBSD. |
| 983 | + Copyright (C) 1991-1992, 1997, 2002 Free Software Foundation, Inc. |
| 984 | + This file is part of the GNU C Library. |
| 985 | + |
| 986 | + The GNU C Library is free software; you can redistribute it and/or |
| 987 | + modify it under the terms of the GNU Lesser General Public |
| 988 | + License as published by the Free Software Foundation; either |
| 989 | + version 2.1 of the License, or (at your option) any later version. |
| 990 | + |
| 991 | + The GNU C Library is distributed in the hope that it will be useful, |
| 992 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 993 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 994 | + Lesser General Public License for more details. |
| 995 | + |
| 996 | + You should have received a copy of the GNU Lesser General Public |
| 997 | + License along with the GNU C Library; if not, write to the Free |
| 998 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 999 | + 02111-1307 USA. */ |
| 1000 | + |
| 1001 | +#ifndef _FCNTL_H |
| 1002 | +# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." |
| 1003 | +#endif |
| 1004 | + |
| 1005 | +#include <sys/types.h> |
| 1006 | +#include <bits/wordsize.h> |
| 1007 | +#ifdef __USE_GNU |
| 1008 | +# include <bits/uio.h> |
| 1009 | +#endif |
| 1010 | + |
| 1011 | + |
| 1012 | +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files |
| 1013 | + located on an ext2 file system */ |
| 1014 | +#define O_ACCMODE 0003 |
| 1015 | +#define O_RDONLY 00 |
| 1016 | +#define O_WRONLY 01 |
| 1017 | +#define O_RDWR 02 |
| 1018 | +#define O_CREAT 01000 /* not fcntl */ |
| 1019 | +#define O_EXCL 04000 /* not fcntl */ |
| 1020 | +#define O_NOCTTY 0100000 /* not fcntl */ |
| 1021 | +#define O_TRUNC 02000 /* not fcntl */ |
| 1022 | +#define O_APPEND 010 |
| 1023 | +#define O_NONBLOCK 04 |
| 1024 | +#define O_NDELAY O_NONBLOCK |
| 1025 | +#define O_SYNC 0200 |
| 1026 | +#define O_FSYNC O_SYNC |
| 1027 | +#define O_ASYNC 0100 |
| 1028 | + |
| 1029 | +#ifdef __USE_GNU |
| 1030 | +# define O_DIRECT 0200000 /* Direct disk access. */ |
| 1031 | +enum { O_DIRECTORY = 0 }; /* Must be a directory. */ |
| 1032 | +enum { O_NOATIME = 0}; /* Do not set atime. */ |
| 1033 | +# define O_NOFOLLOW 0400 /* Do not follow links. */ |
| 1034 | +#endif |
| 1035 | + |
| 1036 | +#ifdef __USE_BSD |
| 1037 | +#define O_SHLOCK 020 /* Open with shared file lock. */ |
| 1038 | +#define O_EXLOCK 040 /* Open with shared exclusive lock. */ |
| 1039 | +#endif |
| 1040 | + |
| 1041 | +/* For now FreeBSD has synchronisity options for data and read operations. |
| 1042 | + We define the symbols here but let them do the same as O_SYNC since |
| 1043 | + this is a superset. */ |
| 1044 | +#if defined __USE_POSIX199309 || defined __USE_UNIX98 |
| 1045 | +# define O_DSYNC O_SYNC /* Synchronize data. */ |
| 1046 | +# define O_RSYNC O_SYNC /* Synchronize read operations. */ |
| 1047 | +#endif |
| 1048 | + |
| 1049 | +#if _POSIX_C_SOURCE >= 200809L |
| 1050 | +#define O_TTY_INIT 0x00080000 /* Restore default termios attributes */ |
| 1051 | +/* Defining O_CLOEXEC would break kfreebsd 8.1, see #635192 */ |
| 1052 | +/* #define O_CLOEXEC 0x00100000 */ |
| 1053 | +#endif |
| 1054 | + |
| 1055 | +/* Since 'off_t' is 64-bit, O_LARGEFILE is a no-op. */ |
| 1056 | +#define O_LARGEFILE 0 |
| 1057 | + |
| 1058 | +#ifdef __USE_BSD |
| 1059 | +/* Bits in the file status flags returned by F_GETFL. |
| 1060 | + These are all the O_* flags, plus FREAD and FWRITE, which are |
| 1061 | + independent bits set by which of O_RDONLY, O_WRONLY, and O_RDWR, was |
| 1062 | + given to `open'. */ |
| 1063 | +#define FREAD 1 |
| 1064 | +#define FWRITE 2 |
| 1065 | +#endif |
| 1066 | + |
| 1067 | +#ifdef __USE_ATFILE |
| 1068 | +# define AT_FDCWD -100 /* Special value used to indicate |
| 1069 | + the *at functions should use the |
| 1070 | + current working directory. */ |
| 1071 | +# define AT_EACCESS 0x100 /* Test access permitted for |
| 1072 | + effective IDs, not real IDs. */ |
| 1073 | +# define AT_SYMLINK_NOFOLLOW 0x200 /* Do not follow symbolic links. */ |
| 1074 | +# define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ |
| 1075 | +# define AT_REMOVEDIR 0x800 /* Remove directory instead of |
| 1076 | + unlinking file. */ |
| 1077 | +#endif |
| 1078 | + |
| 1079 | +/* |
| 1080 | + * We are out of bits in f_flag (which is a short). However, |
| 1081 | + * the flag bits not set in FMASK are only meaningful in the |
| 1082 | + * initial open syscall. Those bits can thus be given a |
| 1083 | + * different meaning for fcntl(2). |
| 1084 | + */ |
| 1085 | +#ifdef __USE_BSD |
| 1086 | +/* |
| 1087 | + * Set by shm_open(3) to get automatic MAP_ASYNC behavior |
| 1088 | + * for POSIX shared memory objects (which are otherwise |
| 1089 | + * implemented as plain files). |
| 1090 | + */ |
| 1091 | +#define FPOSIXSHM O_NOFOLLOW |
| 1092 | +#endif |
| 1093 | + |
| 1094 | +/* Values for the second argument to `fcntl'. */ |
| 1095 | +#define F_DUPFD 0 /* Duplicate file descriptor. */ |
| 1096 | +#define F_GETFD 1 /* Get file descriptor flags. */ |
| 1097 | +#define F_SETFD 2 /* Set file descriptor flags. */ |
| 1098 | +#define F_GETFL 3 /* Get file status flags. */ |
| 1099 | +#define F_SETFL 4 /* Set file status flags. */ |
| 1100 | +#define F_GETLK 7 /* Get record locking info. */ |
| 1101 | +#define F_SETLK 8 /* Set record locking info (non-blocking). */ |
| 1102 | +#define F_SETLKW 9 /* Set record locking info (blocking). */ |
| 1103 | +/* Not necessary, we always have 64-bit offsets. */ |
| 1104 | +#define F_GETLK64 7 /* Get record locking info. */ |
| 1105 | +#define F_SETLK64 8 /* Set record locking info (non-blocking). */ |
| 1106 | +#define F_SETLKW64 9 /* Set record locking info (blocking). */ |
| 1107 | + |
| 1108 | +#if defined __USE_BSD || defined __USE_UNIX98 |
| 1109 | +# define F_SETOWN 5 /* Get owner of socket (receiver of SIGIO). */ |
| 1110 | +# define F_GETOWN 6 /* Set owner of socket (receiver of SIGIO). */ |
| 1111 | +#endif |
| 1112 | + |
| 1113 | +/* For F_[GET|SET]FD. */ |
| 1114 | +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ |
| 1115 | + |
| 1116 | +/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ |
| 1117 | +#define F_RDLCK 1 /* Read lock. */ |
| 1118 | +#define F_WRLCK 3 /* Write lock. */ |
| 1119 | +#define F_UNLCK 2 /* Remove lock. */ |
| 1120 | + |
| 1121 | +#ifdef __USE_BSD |
| 1122 | +/* Operations for bsd flock(), also used by the kernel implementation. */ |
| 1123 | +# define LOCK_SH 1 /* shared lock */ |
| 1124 | +# define LOCK_EX 2 /* exclusive lock */ |
| 1125 | +# define LOCK_NB 4 /* or'd with one of the above to prevent |
| 1126 | + blocking */ |
| 1127 | +# define LOCK_UN 8 /* remove lock */ |
| 1128 | +#endif |
| 1129 | + |
| 1130 | +struct flock |
| 1131 | + { |
| 1132 | + __off_t l_start; /* Offset where the lock begins. */ |
| 1133 | + __off_t l_len; /* Size of the locked area; zero means until EOF. */ |
| 1134 | + __pid_t l_pid; /* Process holding the lock. */ |
| 1135 | + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ |
| 1136 | + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ |
| 1137 | + int __l_sysid; /* remote system id or zero for local */ |
| 1138 | + }; |
| 1139 | + |
| 1140 | +#ifdef __USE_LARGEFILE64 |
| 1141 | +struct flock64 |
| 1142 | + { |
| 1143 | + __off64_t l_start; /* Offset where the lock begins. */ |
| 1144 | + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ |
| 1145 | + __pid_t l_pid; /* Process holding the lock. */ |
| 1146 | + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ |
| 1147 | + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ |
| 1148 | + int __l_sysid; /* remote system id or zero for local */ |
| 1149 | + }; |
| 1150 | +#endif |
| 1151 | + |
| 1152 | +/* Define some more compatibility macros to be backward compatible with |
| 1153 | + BSD systems which did not managed to hide these kernel macros. */ |
| 1154 | +#ifdef __USE_BSD |
| 1155 | +# define FAPPEND O_APPEND |
| 1156 | +# define FFSYNC O_FSYNC |
| 1157 | +# define FASYNC O_ASYNC |
| 1158 | +# define FNONBLOCK O_NONBLOCK |
| 1159 | +# define FNDELAY O_NDELAY |
| 1160 | + |
| 1161 | +#define FCREAT O_CREAT |
| 1162 | +#define FEXCL O_EXCL |
| 1163 | +#define FTRUNC O_TRUNC |
| 1164 | +#define FNOCTTY O_NOCTTY |
| 1165 | +#define FSYNC O_SYNC |
| 1166 | +#endif /* Use BSD. */ |
| 1167 | + |
| 1168 | --- /dev/null |
| 1169 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/in.h |
| 1170 | @@ -0,0 +1,308 @@ |
| 1171 | +/* Copyright (C) 1997, 2000, 2002 Free Software Foundation, Inc. |
| 1172 | + This file is part of the GNU C Library. |
| 1173 | + |
| 1174 | + The GNU C Library is free software; you can redistribute it and/or |
| 1175 | + modify it under the terms of the GNU Lesser General Public |
| 1176 | + License as published by the Free Software Foundation; either |
| 1177 | + version 2.1 of the License, or (at your option) any later version. |
| 1178 | + |
| 1179 | + The GNU C Library is distributed in the hope that it will be useful, |
| 1180 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1181 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 1182 | + Lesser General Public License for more details. |
| 1183 | + |
| 1184 | + You should have received a copy of the GNU Lesser General Public |
| 1185 | + License along with the GNU C Library; if not, write to the Free |
| 1186 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 1187 | + 02111-1307 USA. */ |
| 1188 | + |
| 1189 | +/* FreeBSD version. */ |
| 1190 | + |
| 1191 | +#ifndef _NETINET_IN_H |
| 1192 | +# error "Never use <bits/in.h> directly; include <netinet/in.h> instead." |
| 1193 | +#endif |
| 1194 | + |
| 1195 | + |
| 1196 | +/* Link numbers. */ |
| 1197 | +#define IMPLINK_IP 155 |
| 1198 | +#define IMPLINK_LOWEXPER 156 |
| 1199 | +#define IMPLINK_HIGHEXPER 158 |
| 1200 | + |
| 1201 | +#define IPPROTO_DIVERT 258 /* divert pseudo-protocol */ |
| 1202 | + |
| 1203 | +/* To select the IP level. */ |
| 1204 | +#define SOL_IP 0 |
| 1205 | + |
| 1206 | +/* |
| 1207 | + * Options for use with [gs]etsockopt at the IP level. |
| 1208 | + * First word of comment is data type; bool is stored in int. |
| 1209 | + */ |
| 1210 | +#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */ |
| 1211 | +#define IP_HDRINCL 2 /* int; header is included with data */ |
| 1212 | +#define IP_TOS 3 /* int; IP type of service and preced. */ |
| 1213 | +#define IP_TTL 4 /* int; IP time to live */ |
| 1214 | +#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */ |
| 1215 | +#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */ |
| 1216 | +#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */ |
| 1217 | +#define IP_SENDSRCADDR IP_RECVDSTADDR /* cmsg_type to set src addr */ |
| 1218 | +#define IP_RETOPTS 8 /* ip_opts; set/get IP options */ |
| 1219 | +#define IP_MULTICAST_IF 9 /* struct in_addr *or* struct ip_mreqn; |
| 1220 | + * set/get IP multicast i/f */ |
| 1221 | +#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */ |
| 1222 | +#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */ |
| 1223 | +#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */ |
| 1224 | +#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */ |
| 1225 | +#define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */ |
| 1226 | +#define IP_RSVP_ON 15 /* enable RSVP in kernel */ |
| 1227 | +#define IP_RSVP_OFF 16 /* disable RSVP in kernel */ |
| 1228 | +#define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */ |
| 1229 | +#define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */ |
| 1230 | +#define IP_PORTRANGE 19 /* int; range to choose for unspec port */ |
| 1231 | +#define IP_RECVIF 20 /* bool; receive reception if w/dgram */ |
| 1232 | +/* for IPSEC */ |
| 1233 | +#define IP_IPSEC_POLICY 21 /* int; set/get security policy */ |
| 1234 | +#define IP_FAITH 22 /* bool; accept FAITH'ed connections */ |
| 1235 | + |
| 1236 | +#define IP_ONESBCAST 23 /* bool: send all-ones broadcast */ |
| 1237 | +#define IP_NONLOCALOK 24 /* bool: allow bind to spoof non-local addresses; |
| 1238 | + requires kernel compile option IP_NONLOCALBIND */ |
| 1239 | + |
| 1240 | +#define IP_FW_TABLE_ADD 40 /* add entry */ |
| 1241 | +#define IP_FW_TABLE_DEL 41 /* delete entry */ |
| 1242 | +#define IP_FW_TABLE_FLUSH 42 /* flush table */ |
| 1243 | +#define IP_FW_TABLE_GETSIZE 43 /* get table size */ |
| 1244 | +#define IP_FW_TABLE_LIST 44 /* list table contents */ |
| 1245 | + |
| 1246 | +#define IP_FW_ADD 50 /* add a firewall rule to chain */ |
| 1247 | +#define IP_FW_DEL 51 /* delete a firewall rule from chain */ |
| 1248 | +#define IP_FW_FLUSH 52 /* flush firewall rule chain */ |
| 1249 | +#define IP_FW_ZERO 53 /* clear single/all firewall counter(s) */ |
| 1250 | +#define IP_FW_GET 54 /* get entire firewall rule chain */ |
| 1251 | +#define IP_FW_RESETLOG 55 /* reset logging counters */ |
| 1252 | + |
| 1253 | +#define IP_FW_NAT_CFG 56 /* add/config a nat rule */ |
| 1254 | +#define IP_FW_NAT_DEL 57 /* delete a nat rule */ |
| 1255 | +#define IP_FW_NAT_GET_CONFIG 58 /* get configuration of a nat rule */ |
| 1256 | +#define IP_FW_NAT_GET_LOG 59 /* get log of a nat rule */ |
| 1257 | + |
| 1258 | +#define IP_DUMMYNET_CONFIGURE 60 /* add/configure a dummynet pipe */ |
| 1259 | +#define IP_DUMMYNET_DEL 61 /* delete a dummynet pipe from chain */ |
| 1260 | +#define IP_DUMMYNET_FLUSH 62 /* flush dummynet */ |
| 1261 | +#define IP_DUMMYNET_GET 64 /* get entire dummynet pipes */ |
| 1262 | + |
| 1263 | +#define IP_RECVTTL 65 /* bool; receive IP TTL w/dgram */ |
| 1264 | +#define IP_MINTTL 66 /* minimum TTL for packet or drop */ |
| 1265 | +#define IP_DONTFRAG 67 /* don't fragment packet */ |
| 1266 | + |
| 1267 | +/* IPv4 Source Filter Multicast API [RFC3678] */ |
| 1268 | +#define IP_ADD_SOURCE_MEMBERSHIP 70 /* join a source-specific group */ |
| 1269 | +#define IP_DROP_SOURCE_MEMBERSHIP 71 /* drop a single source */ |
| 1270 | +#define IP_BLOCK_SOURCE 72 /* block a source */ |
| 1271 | +#define IP_UNBLOCK_SOURCE 73 /* unblock a source */ |
| 1272 | + |
| 1273 | +/* The following option is private; do not use it from user applications. */ |
| 1274 | +#define IP_MSFILTER 74 /* set/get filter list */ |
| 1275 | + |
| 1276 | +/* Protocol Independent Multicast API [RFC3678] */ |
| 1277 | +#define MCAST_JOIN_GROUP 80 /* join an any-source group */ |
| 1278 | +#define MCAST_LEAVE_GROUP 81 /* leave all sources for group */ |
| 1279 | +#define MCAST_JOIN_SOURCE_GROUP 82 /* join a source-specific group */ |
| 1280 | +#define MCAST_LEAVE_SOURCE_GROUP 83 /* leave a single source */ |
| 1281 | +#define MCAST_BLOCK_SOURCE 84 /* block a source */ |
| 1282 | +#define MCAST_UNBLOCK_SOURCE 85 /* unblock a source */ |
| 1283 | + |
| 1284 | +/* |
| 1285 | + * Defaults and limits for options |
| 1286 | + */ |
| 1287 | +#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ |
| 1288 | +#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ |
| 1289 | + |
| 1290 | +/* |
| 1291 | + * The imo_membership vector for each socket is now dynamically allocated at |
| 1292 | + * run-time, bounded by USHRT_MAX, and is reallocated when needed, sized |
| 1293 | + * according to a power-of-two increment. |
| 1294 | + */ |
| 1295 | +#define IP_MIN_MEMBERSHIPS 31 |
| 1296 | +#define IP_MAX_MEMBERSHIPS 4095 |
| 1297 | +#define IP_MAX_SOURCE_FILTER 1024 /* # of filters per socket, per group */ |
| 1298 | + |
| 1299 | +/* |
| 1300 | + * Filter modes; also used to represent per-socket filter mode internally. |
| 1301 | + */ |
| 1302 | + |
| 1303 | +#define MCAST_UNDEFINED 0 /* fmode: not yet defined */ |
| 1304 | +#define MCAST_INCLUDE 1 /* fmode: include these source(s) */ |
| 1305 | +#define MCAST_EXCLUDE 2 /* fmode: exclude these source(s) */ |
| 1306 | + |
| 1307 | +/* |
| 1308 | + * Argument for IP_PORTRANGE: |
| 1309 | + * - which range to search when port is unspecified at bind() or connect() |
| 1310 | + */ |
| 1311 | +#define IP_PORTRANGE_DEFAULT 0 /* default range */ |
| 1312 | +#define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */ |
| 1313 | +#define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */ |
| 1314 | + |
| 1315 | +/* |
| 1316 | + * Names for IP sysctl objects |
| 1317 | + */ |
| 1318 | +#define IPCTL_FORWARDING 1 /* act as router */ |
| 1319 | +#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */ |
| 1320 | +#define IPCTL_DEFTTL 3 /* default TTL */ |
| 1321 | +#ifdef notyet |
| 1322 | +#define IPCTL_DEFMTU 4 /* default MTU */ |
| 1323 | +#endif |
| 1324 | +#define IPCTL_RTEXPIRE 5 /* cloned route expiration time */ |
| 1325 | +#define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */ |
| 1326 | +#define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */ |
| 1327 | +#define IPCTL_SOURCEROUTE 8 /* may perform source routes */ |
| 1328 | +#define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */ |
| 1329 | +#define IPCTL_INTRQMAXLEN 10 /* max length of netisr queue */ |
| 1330 | +#define IPCTL_INTRQDROPS 11 /* number of netisr q drops */ |
| 1331 | +#define IPCTL_STATS 12 /* ipstat structure */ |
| 1332 | +#define IPCTL_ACCEPTSOURCEROUTE 13 /* may accept source routed packets */ |
| 1333 | +#define IPCTL_FASTFORWARDING 14 /* use fast IP forwarding code */ |
| 1334 | +#define IPCTL_KEEPFAITH 15 /* FAITH IPv4->IPv6 translater ctl */ |
| 1335 | +#define IPCTL_GIF_TTL 16 /* default TTL for gif encap packet */ |
| 1336 | +#define IPCTL_MAXID 17 |
| 1337 | + |
| 1338 | +/* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS. |
| 1339 | + The `ip_dst' field is used for the first-hop gateway when using a |
| 1340 | + source route (this gets put into the header proper). */ |
| 1341 | +struct ip_opts |
| 1342 | + { |
| 1343 | + struct in_addr ip_dst; /* First hop; zero without source route. */ |
| 1344 | + char ip_opts[40]; /* Actually variable in size. */ |
| 1345 | + }; |
| 1346 | + |
| 1347 | +/* Options for use with `getsockopt' and `setsockopt' at the IPv6 level. |
| 1348 | + The first word in the comment at the right is the data type used; |
| 1349 | + "bool" means a boolean value stored in an `int'. */ |
| 1350 | +#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */ |
| 1351 | +#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */ |
| 1352 | +#define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */ |
| 1353 | +#define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */ |
| 1354 | +#define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 multicast loopback */ |
| 1355 | +#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */ |
| 1356 | +#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */ |
| 1357 | +#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */ |
| 1358 | +#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */ |
| 1359 | + |
| 1360 | +#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */ |
| 1361 | +#define IPV6_V6ONLY 27 /* bool; make AF_INET6 sockets v6 only */ |
| 1362 | + |
| 1363 | +#define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */ |
| 1364 | +#define IPV6_FAITH 29 /* bool; accept FAITH'ed connections */ |
| 1365 | + |
| 1366 | +#define IPV6_FW_ADD 30 /* add a firewall rule to chain */ |
| 1367 | +#define IPV6_FW_DEL 31 /* delete a firewall rule from chain */ |
| 1368 | +#define IPV6_FW_FLUSH 32 /* flush firewall rule chain */ |
| 1369 | +#define IPV6_FW_ZERO 33 /* clear single/all firewall counter(s) */ |
| 1370 | +#define IPV6_FW_GET 34 /* get entire firewall rule chain */ |
| 1371 | +#define IPV6_RTHDRDSTOPTS 35 /* ip6_dest; send dst option before rthdr */ |
| 1372 | + |
| 1373 | +#define IPV6_RECVPKTINFO 36 /* bool; recv if, dst addr */ |
| 1374 | +#define IPV6_RECVHOPLIMIT 37 /* bool; recv hop limit */ |
| 1375 | +#define IPV6_RECVRTHDR 38 /* bool; recv routing header */ |
| 1376 | +#define IPV6_RECVHOPOPTS 39 /* bool; recv hop-by-hop option */ |
| 1377 | +#define IPV6_RECVDSTOPTS 40 /* bool; recv dst option after rthdr */ |
| 1378 | + |
| 1379 | +#define IPV6_USE_MIN_MTU 42 /* bool; send packets at the minimum MTU */ |
| 1380 | +#define IPV6_RECVPATHMTU 43 /* bool; notify an according MTU */ |
| 1381 | +#define IPV6_PATHMTU 44 /* mtuinfo; get the current path MTU (sopt), |
| 1382 | + 4 bytes int; MTU notification (cmsg) */ |
| 1383 | + |
| 1384 | +#define IPV6_PKTINFO 46 /* in6_pktinfo; send if, src addr */ |
| 1385 | +#define IPV6_HOPLIMIT 47 /* int; send hop limit */ |
| 1386 | +#define IPV6_NEXTHOP 48 /* sockaddr; next hop addr */ |
| 1387 | +#define IPV6_HOPOPTS 49 /* ip6_hbh; send hop-by-hop option */ |
| 1388 | +#define IPV6_DSTOPTS 50 /* ip6_dest; send dst option befor rthdr */ |
| 1389 | +#define IPV6_RTHDR 51 /* ip6_rthdr; send routing header */ |
| 1390 | + |
| 1391 | +#define IPV6_RECVTCLASS 57 /* bool; recv traffic class values */ |
| 1392 | + |
| 1393 | +#define IPV6_AUTOFLOWLABEL 59 /* bool; attach flowlabel automagically */ |
| 1394 | + |
| 1395 | +#define IPV6_TCLASS 61 /* int; send traffic class value */ |
| 1396 | +#define IPV6_DONTFRAG 62 /* bool; disable IPv6 fragmentation */ |
| 1397 | + |
| 1398 | +#define IPV6_PREFER_TEMPADDR 63 /* int; prefer temporary addresses as |
| 1399 | + * the source address. |
| 1400 | + */ |
| 1401 | + |
| 1402 | +/* Obsolete synonyms for the above. */ |
| 1403 | +#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP |
| 1404 | +#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP |
| 1405 | +#define IPV6_RXHOPOPTS IPV6_HOPOPTS |
| 1406 | +#define IPV6_RXDSTOPTS IPV6_DSTOPTS |
| 1407 | + |
| 1408 | +/* Socket level values for IPv6. */ |
| 1409 | +#define SOL_IPV6 41 |
| 1410 | +#define SOL_ICMPV6 58 |
| 1411 | + |
| 1412 | +/* |
| 1413 | + * Defaults and limits for options |
| 1414 | + */ |
| 1415 | +#define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit m'casts to 1 hop */ |
| 1416 | +#define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ |
| 1417 | + |
| 1418 | +/* |
| 1419 | + * Argument for IPV6_PORTRANGE: |
| 1420 | + * - which range to search when port is unspecified at bind() or connect() |
| 1421 | + */ |
| 1422 | +#define IPV6_PORTRANGE_DEFAULT 0 /* default range */ |
| 1423 | +#define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */ |
| 1424 | +#define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */ |
| 1425 | + |
| 1426 | +/* Routing header options for IPv6. */ |
| 1427 | +#define IPV6_RTHDR_LOOSE 0 /* Hop doesn't need to be neighbour. */ |
| 1428 | +#define IPV6_RTHDR_STRICT 1 /* Hop must be a neighbour. */ |
| 1429 | + |
| 1430 | +#define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0. */ |
| 1431 | + |
| 1432 | +/* |
| 1433 | + * Names for IP sysctl objects |
| 1434 | + */ |
| 1435 | +#define IPV6CTL_FORWARDING 1 /* act as router */ |
| 1436 | +#define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding*/ |
| 1437 | +#define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */ |
| 1438 | +#define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */ |
| 1439 | +#define IPV6CTL_STATS 6 /* stats */ |
| 1440 | +#define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */ |
| 1441 | +#define IPV6CTL_MRTPROTO 8 /* multicast routing protocol */ |
| 1442 | +#define IPV6CTL_MAXFRAGPACKETS 9 /* max packets reassembly queue */ |
| 1443 | +#define IPV6CTL_SOURCECHECK 10 /* verify source route and intf */ |
| 1444 | +#define IPV6CTL_SOURCECHECK_LOGINT 11 /* minimume logging interval */ |
| 1445 | +#define IPV6CTL_ACCEPT_RTADV 12 |
| 1446 | +#define IPV6CTL_KEEPFAITH 13 |
| 1447 | +#define IPV6CTL_LOG_INTERVAL 14 |
| 1448 | +#define IPV6CTL_HDRNESTLIMIT 15 |
| 1449 | +#define IPV6CTL_DAD_COUNT 16 |
| 1450 | +#define IPV6CTL_AUTO_FLOWLABEL 17 |
| 1451 | +#define IPV6CTL_DEFMCASTHLIM 18 |
| 1452 | +#define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */ |
| 1453 | +#define IPV6CTL_KAME_VERSION 20 |
| 1454 | +#define IPV6CTL_USE_DEPRECATED 21 /* use deprecated addr (RFC2462 5.5.4) */ |
| 1455 | +#define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */ |
| 1456 | +#define IPV6CTL_V6ONLY 24 |
| 1457 | +#define IPV6CTL_RTEXPIRE 25 /* cloned route expiration time */ |
| 1458 | +#define IPV6CTL_RTMINEXPIRE 26 /* min value for expiration time */ |
| 1459 | +#define IPV6CTL_RTMAXCACHE 27 /* trigger level for dynamic expire */ |
| 1460 | + |
| 1461 | +#define IPV6CTL_USETEMPADDR 32 /* use temporary addresses (RFC3041) */ |
| 1462 | +#define IPV6CTL_TEMPPLTIME 33 /* preferred lifetime for tmpaddrs */ |
| 1463 | +#define IPV6CTL_TEMPVLTIME 34 /* valid lifetime for tmpaddrs */ |
| 1464 | +#define IPV6CTL_AUTO_LINKLOCAL 35 /* automatic link-local addr assign */ |
| 1465 | +#define IPV6CTL_RIP6STATS 36 /* raw_ip6 stats */ |
| 1466 | +#define IPV6CTL_PREFER_TEMPADDR 37 /* prefer temporary addr as src */ |
| 1467 | +#define IPV6CTL_ADDRCTLPOLICY 38 /* get/set address selection policy */ |
| 1468 | +#define IPV6CTL_USE_DEFAULTZONE 39 /* use default scope zone */ |
| 1469 | + |
| 1470 | +#define IPV6CTL_MAXFRAGS 41 /* max fragments */ |
| 1471 | +#define IPV6CTL_MCAST_PMTU 44 /* enable pMTU discovery for multicast? */ |
| 1472 | + |
| 1473 | +/* New entries should be added here from current IPV6CTL_MAXID value. */ |
| 1474 | +/* to define items, should talk with KAME guys first, for *BSD compatibility */ |
| 1475 | +/* 42-44 is already used in KAME */ |
| 1476 | +#define IPV6CTL_STEALTH 45 |
| 1477 | +#define ICMPV6CTL_ND6_ONLINKNSRFC4861 47 |
| 1478 | +#define IPV6CTL_MAXID 48 |
| 1479 | --- /dev/null |
| 1480 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/ioctl-types.h |
| 1481 | @@ -0,0 +1,37 @@ |
| 1482 | +/* Structure types for pre-termios terminal ioctls. FreeBSD version. |
| 1483 | + Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc. |
| 1484 | + This file is part of the GNU C Library. |
| 1485 | + |
| 1486 | + The GNU C Library is free software; you can redistribute it and/or |
| 1487 | + modify it under the terms of the GNU Lesser General Public |
| 1488 | + License as published by the Free Software Foundation; either |
| 1489 | + version 2.1 of the License, or (at your option) any later version. |
| 1490 | + |
| 1491 | + The GNU C Library is distributed in the hope that it will be useful, |
| 1492 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1493 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 1494 | + Lesser General Public License for more details. |
| 1495 | + |
| 1496 | + You should have received a copy of the GNU Lesser General Public |
| 1497 | + License along with the GNU C Library; if not, write to the Free |
| 1498 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 1499 | + 02111-1307 USA. */ |
| 1500 | + |
| 1501 | +#ifndef _SYS_IOCTL_H |
| 1502 | +# error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead." |
| 1503 | +#endif |
| 1504 | + |
| 1505 | +/* Many systems that have TIOCGWINSZ define TIOCGSIZE for source |
| 1506 | + compatibility with Sun; they define `struct ttysize' to have identical |
| 1507 | + layout as `struct winsize' and #define TIOCGSIZE to be TIOCGWINSZ |
| 1508 | + (likewise TIOCSSIZE and TIOCSWINSZ). */ |
| 1509 | +/* struct ttysize is in FreeBSD originally defined in <sys/ioctl.h>, |
| 1510 | + which is replaced by GLIBC version -> define here */ |
| 1511 | +struct ttysize |
| 1512 | +{ |
| 1513 | + unsigned short int ts_lines; |
| 1514 | + unsigned short int ts_cols; |
| 1515 | + unsigned short int ts_xxx; |
| 1516 | + unsigned short int ts_yyy; |
| 1517 | +}; |
| 1518 | +#define _IOT_ttysize _IOT_winsize |
| 1519 | --- /dev/null |
| 1520 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/ioctls.h |
| 1521 | @@ -0,0 +1,50 @@ |
| 1522 | +/*- |
| 1523 | + * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. |
| 1524 | + * All rights reserved. |
| 1525 | + * |
| 1526 | + * Redistribution and use in source and binary forms, with or without |
| 1527 | + * modification, are permitted provided that the following conditions |
| 1528 | + * are met: |
| 1529 | + * 1. Redistributions of source code must retain the above copyright |
| 1530 | + * notice, this list of conditions and the following disclaimer. |
| 1531 | + * 2. Redistributions in binary form must reproduce the above copyright |
| 1532 | + * notice, this list of conditions and the following disclaimer in the |
| 1533 | + * documentation and/or other materials provided with the distribution. |
| 1534 | + * 4. Neither the name of the University nor the names of its contributors |
| 1535 | + * may be used to endorse or promote products derived from this software |
| 1536 | + * without specific prior written permission. |
| 1537 | + * |
| 1538 | + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 1539 | + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 1540 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 1541 | + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 1542 | + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 1543 | + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 1544 | + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 1545 | + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 1546 | + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 1547 | + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 1548 | + * SUCH DAMAGE. |
| 1549 | + * |
| 1550 | + * @(#)ioctl.h 8.6 (Berkeley) 3/28/94 |
| 1551 | + */ |
| 1552 | + |
| 1553 | +#ifndef _IOCTLS_H_ |
| 1554 | +#define _IOCTLS_H_ |
| 1555 | + |
| 1556 | +#include <sys/ioccom.h> |
| 1557 | + |
| 1558 | +#include <sys/ttycom.h> |
| 1559 | + |
| 1560 | +/* |
| 1561 | + * @(#)ioctl.h 8.6 (Berkeley) 3/28/94 |
| 1562 | + */ |
| 1563 | + |
| 1564 | +#define TIOCGSIZE TIOCGWINSZ |
| 1565 | +#define TIOCSSIZE TIOCSWINSZ |
| 1566 | + |
| 1567 | +#include <sys/filio.h> |
| 1568 | + |
| 1569 | +#include <sys/sockio.h> |
| 1570 | + |
| 1571 | +#endif /* !_IOCTLS_H_ */ |
| 1572 | --- /dev/null |
| 1573 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/ipc.h |
| 1574 | @@ -0,0 +1,56 @@ |
| 1575 | +/* Copyright (C) 1995-1997, 1999, 2002 Free Software Foundation, Inc. |
| 1576 | + This file is part of the GNU C Library. |
| 1577 | + |
| 1578 | + The GNU C Library is free software; you can redistribute it and/or |
| 1579 | + modify it under the terms of the GNU Lesser General Public |
| 1580 | + License as published by the Free Software Foundation; either |
| 1581 | + version 2.1 of the License, or (at your option) any later version. |
| 1582 | + |
| 1583 | + The GNU C Library is distributed in the hope that it will be useful, |
| 1584 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1585 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 1586 | + Lesser General Public License for more details. |
| 1587 | + |
| 1588 | + You should have received a copy of the GNU Lesser General Public |
| 1589 | + License along with the GNU C Library; if not, write to the Free |
| 1590 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 1591 | + 02111-1307 USA. */ |
| 1592 | + |
| 1593 | +#ifndef _SYS_IPC_H |
| 1594 | +# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead." |
| 1595 | +#endif |
| 1596 | + |
| 1597 | +#include <bits/types.h> |
| 1598 | + |
| 1599 | +/* Mode bits for `msgget', `semget', and `shmget'. */ |
| 1600 | +#define IPC_CREAT 01000 /* create key if key does not exist */ |
| 1601 | +#define IPC_EXCL 02000 /* fail if key exists */ |
| 1602 | +#define IPC_NOWAIT 04000 /* return error on wait */ |
| 1603 | + |
| 1604 | +/* Control commands for `msgctl', `semctl', and `shmctl'. */ |
| 1605 | +#define IPC_RMID 0 /* remove identifier */ |
| 1606 | +#define IPC_SET 1 /* set `ipc_perm' options */ |
| 1607 | +#define IPC_STAT 2 /* get `ipc_perm' options */ |
| 1608 | + |
| 1609 | +/* Special key values. */ |
| 1610 | +#define IPC_PRIVATE ((key_t) 0) /* private key */ |
| 1611 | + |
| 1612 | +#ifdef __USE_BSD |
| 1613 | +/* Common mode bits. */ |
| 1614 | +# define IPC_R 0400 /* read permission, same as S_IRUSR */ |
| 1615 | +# define IPC_W 0200 /* write permission, same as S_IWUSR */ |
| 1616 | +# define IPC_M 0x1000 /* control permission */ |
| 1617 | +#endif |
| 1618 | + |
| 1619 | + |
| 1620 | +/* Data structure used to pass permission information to IPC operations. */ |
| 1621 | +struct ipc_perm |
| 1622 | + { |
| 1623 | + __uint16_t /* yuck! */ cuid; /* creator's user ID */ |
| 1624 | + __uint16_t /* yuck! */ cgid; /* creator's group ID */ |
| 1625 | + __uint16_t /* yuck! */ uid; /* owner's user ID */ |
| 1626 | + __uint16_t /* yuck! */ gid; /* owner's group ID */ |
| 1627 | + __mode_t mode; /* read/write permission */ |
| 1628 | + __uint16_t __seq; |
| 1629 | + __key_t __key; |
| 1630 | + }; |
| 1631 | --- /dev/null |
| 1632 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/local_lim.h |
| 1633 | @@ -0,0 +1,25 @@ |
| 1634 | +/* Minimum guaranteed maximum values for system limits. kFreeBSD version. |
| 1635 | + Copyright (C) 2011 Free Software Foundation, Inc. |
| 1636 | + This file is part of the GNU C Library. |
| 1637 | + |
| 1638 | + The GNU C Library is free software; you can redistribute it and/or |
| 1639 | + modify it under the terms of the GNU Lesser General Public |
| 1640 | + License as published by the Free Software Foundation; either |
| 1641 | + version 2.1 of the License, or (at your option) any later version. |
| 1642 | + |
| 1643 | + The GNU C Library is distributed in the hope that it will be useful, |
| 1644 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1645 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 1646 | + Lesser General Public License for more details. |
| 1647 | + |
| 1648 | + You should have received a copy of the GNU Lesser General Public |
| 1649 | + License along with the GNU C Library; if not, write to the Free |
| 1650 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 1651 | + 02111-1307 USA. */ |
| 1652 | + |
| 1653 | +#include <sys/param.h> |
| 1654 | + |
| 1655 | +/* BSD userland provides MAXHOSTNAMELEN via <sys/param.h>. GNU |
| 1656 | + userland provides HOST_NAME_MAX via <limits.h>. This makes |
| 1657 | + both worlds happy. */ |
| 1658 | +#define HOST_NAME_MAX MAXHOSTNAMELEN |
| 1659 | --- /dev/null |
| 1660 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/mman.h |
| 1661 | @@ -0,0 +1,130 @@ |
| 1662 | +/* Definitions for POSIX memory map interface. FreeBSD version. |
| 1663 | + Copyright (C) 1994-1998, 2000-2002 Free Software Foundation, Inc. |
| 1664 | + This file is part of the GNU C Library. |
| 1665 | + |
| 1666 | + The GNU C Library is free software; you can redistribute it and/or |
| 1667 | + modify it under the terms of the GNU Lesser General Public |
| 1668 | + License as published by the Free Software Foundation; either |
| 1669 | + version 2.1 of the License, or (at your option) any later version. |
| 1670 | + |
| 1671 | + The GNU C Library is distributed in the hope that it will be useful, |
| 1672 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1673 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 1674 | + Lesser General Public License for more details. |
| 1675 | + |
| 1676 | + You should have received a copy of the GNU Lesser General Public |
| 1677 | + License along with the GNU C Library; if not, write to the Free |
| 1678 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 1679 | + 02111-1307 USA. */ |
| 1680 | + |
| 1681 | +#ifndef _SYS_MMAN_H |
| 1682 | +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." |
| 1683 | +#endif |
| 1684 | + |
| 1685 | +#include <features.h> |
| 1686 | +#include <stddef.h> |
| 1687 | + |
| 1688 | +/* Protections are chosen from these bits, OR'd together. The |
| 1689 | + implementation does not necessarily support PROT_EXEC or PROT_WRITE |
| 1690 | + without PROT_READ. The only guarantees are that no writing will be |
| 1691 | + allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ |
| 1692 | + |
| 1693 | +#define PROT_NONE 0x00 /* No access. */ |
| 1694 | +#define PROT_READ 0x01 /* Pages can be read. */ |
| 1695 | +#define PROT_WRITE 0x02 /* Pages can be written. */ |
| 1696 | +#define PROT_EXEC 0x04 /* Pages can be executed. */ |
| 1697 | + |
| 1698 | +/* Flags contain mapping type, sharing type and options. */ |
| 1699 | + |
| 1700 | +/* Mapping type (must choose one and only one of these). */ |
| 1701 | +#ifdef __USE_BSD |
| 1702 | +# define MAP_FILE 0x0000 /* Mapped from a file or device. */ |
| 1703 | +# define MAP_ANON 0x1000 /* Allocated from anonymous virtual memory. */ |
| 1704 | +# define MAP_TYPE 0x1000 /* Mask for type field. */ |
| 1705 | +# ifdef __USE_MISC |
| 1706 | +# define MAP_ANONYMOUS MAP_ANON /* Linux name. */ |
| 1707 | +# endif |
| 1708 | +#endif |
| 1709 | + |
| 1710 | +/* Sharing types (must choose one and only one of these). */ |
| 1711 | +#define MAP_SHARED 0x0001 /* Share changes. */ |
| 1712 | +#define MAP_PRIVATE 0x0002 /* Changes private; copy pages on write. */ |
| 1713 | +#ifdef __USE_BSD |
| 1714 | +# define MAP_COPY MAP_PRIVATE /* Virtual copy of region at mapping time. */ |
| 1715 | +#endif |
| 1716 | + |
| 1717 | +/* Other flags. */ |
| 1718 | +#define MAP_FIXED 0x0010 /* Map address must be exactly as requested. */ |
| 1719 | +#ifdef __USE_BSD |
| 1720 | +#define MAP_RENAME 0x0020 /* Sun: rename private pages to file */ |
| 1721 | +#define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */ |
| 1722 | +#define MAP_RESERVED0080 0x0080 /* previously misimplemented MAP_INHERIT */ |
| 1723 | +#define MAP_RESERVED0100 0x0100 /* previously unimplemented MAP_NOEXTEND */ |
| 1724 | +# define MAP_HASSEMPHORE 0x0200 /* Region may contain semaphores. */ |
| 1725 | +# define MAP_STACK 0x0400 /* Region grows down, like a stack. */ |
| 1726 | +# define MAP_NOSYNC 0x0800 /* Try to avoid flushing to the disk. */ |
| 1727 | +# define MAP_NOCORE 0x20000 /* Don't include these pages in a core dump. */ |
| 1728 | +#endif |
| 1729 | + |
| 1730 | +/* Advice to `madvise'. */ |
| 1731 | +#ifdef __USE_BSD |
| 1732 | +# define MADV_NORMAL 0 /* No further special treatment. */ |
| 1733 | +# define MADV_RANDOM 1 /* Expect random page references. */ |
| 1734 | +# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ |
| 1735 | +# define MADV_WILLNEED 3 /* Will need these pages. */ |
| 1736 | +# define MADV_DONTNEED 4 /* Don't need these pages. */ |
| 1737 | +# define MADV_FREE 5 /* Don't need these pages, they contain junk. */ |
| 1738 | +# define MADV_NOSYNC 6 /* Try to avoid flushing to the disk. */ |
| 1739 | +# define MADV_AUTOSYNC 7 /* Use the default flushing strategy. */ |
| 1740 | +# define MADV_NOCORE 8 /* Don't include these pages in a core dump. */ |
| 1741 | +# define MADV_CORE 9 /* Include pages in a core dump (default). */ |
| 1742 | +# define MADV_PROTECT 10 /* protect process from pageout kill */ |
| 1743 | +#endif |
| 1744 | + |
| 1745 | +/* The POSIX people had to invent similar names for the same things. */ |
| 1746 | +#ifdef __USE_XOPEN2K |
| 1747 | +# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ |
| 1748 | +# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ |
| 1749 | +# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ |
| 1750 | +# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ |
| 1751 | +# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ |
| 1752 | +#endif |
| 1753 | + |
| 1754 | +/* Flags to `msync'. */ |
| 1755 | +#define MS_ASYNC 1 /* Sync memory asynchronously. */ |
| 1756 | +#define MS_SYNC 0 /* Synchronous memory sync. */ |
| 1757 | +#define MS_INVALIDATE 2 /* Invalidate the caches. */ |
| 1758 | + |
| 1759 | +/* Flags for `mlockall' (can be OR'd together). */ |
| 1760 | +#define MCL_CURRENT 1 /* Lock all currently mapped pages. */ |
| 1761 | +#define MCL_FUTURE 2 /* Lock all additions to address |
| 1762 | + space. */ |
| 1763 | + |
| 1764 | +/* Flags for 'minherit'. */ |
| 1765 | +#ifdef __USE_BSD |
| 1766 | +# define INHERIT_SHARE 0 |
| 1767 | +# define INHERIT_COPY 1 |
| 1768 | +# define INHERIT_NONE 2 |
| 1769 | +#endif |
| 1770 | + |
| 1771 | + |
| 1772 | +/* |
| 1773 | + * Return bits from mincore |
| 1774 | + */ |
| 1775 | +#ifdef __USE_MISC |
| 1776 | +#define MINCORE_INCORE 0x1 /* Page is incore */ |
| 1777 | +#define MINCORE_REFERENCED 0x2 /* Page has been referenced by us */ |
| 1778 | +#define MINCORE_MODIFIED 0x4 /* Page has been modified by us */ |
| 1779 | +#define MINCORE_REFERENCED_OTHER 0x8 /* Page has been referenced */ |
| 1780 | +#define MINCORE_MODIFIED_OTHER 0x10 /* Page has been modified */ |
| 1781 | +#endif /* Use MISC */ |
| 1782 | + |
| 1783 | +#ifdef __USE_BSD |
| 1784 | + |
| 1785 | +__BEGIN_DECLS |
| 1786 | + |
| 1787 | +extern int minherit (void *__addr, size_t __len, int __inherit); |
| 1788 | + |
| 1789 | +__END_DECLS |
| 1790 | + |
| 1791 | +#endif /* Use BSD */ |
| 1792 | --- /dev/null |
| 1793 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/msq.h |
| 1794 | @@ -0,0 +1,69 @@ |
| 1795 | +/* Copyright (C) 1995, 1997, 2000, 2002 Free Software Foundation, Inc. |
| 1796 | + This file is part of the GNU C Library. |
| 1797 | + |
| 1798 | + The GNU C Library is free software; you can redistribute it and/or |
| 1799 | + modify it under the terms of the GNU Lesser General Public |
| 1800 | + License as published by the Free Software Foundation; either |
| 1801 | + version 2.1 of the License, or (at your option) any later version. |
| 1802 | + |
| 1803 | + The GNU C Library is distributed in the hope that it will be useful, |
| 1804 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1805 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 1806 | + Lesser General Public License for more details. |
| 1807 | + |
| 1808 | + You should have received a copy of the GNU Lesser General Public |
| 1809 | + License along with the GNU C Library; if not, write to the Free |
| 1810 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 1811 | + 02111-1307 USA. */ |
| 1812 | + |
| 1813 | +#ifndef _SYS_MSG_H |
| 1814 | +#error "Never use <bits/msq.h> directly; include <sys/msg.h> instead." |
| 1815 | +#endif |
| 1816 | + |
| 1817 | +#include <bits/types.h> |
| 1818 | + |
| 1819 | +/* Define options for message queue functions. */ |
| 1820 | +#define MSG_NOERROR 010000 /* no error if message is too big */ |
| 1821 | + |
| 1822 | +/* Types used in the structure definition. */ |
| 1823 | +typedef unsigned long int msgqnum_t; |
| 1824 | +typedef unsigned long int msglen_t; |
| 1825 | + |
| 1826 | + |
| 1827 | +/* Structure of record for one message inside the kernel. |
| 1828 | + The type `struct __msg' is opaque. */ |
| 1829 | +struct msqid_ds |
| 1830 | +{ |
| 1831 | + struct ipc_perm msg_perm; /* structure describing operation permission */ |
| 1832 | + void *__msg_first; |
| 1833 | + void *__msg_last; |
| 1834 | + msglen_t __msg_cbytes; /* current number of bytes on queue */ |
| 1835 | + msgqnum_t msg_qnum; /* number of messages currently on queue */ |
| 1836 | + msglen_t msg_qbytes; /* max number of bytes allowed on queue */ |
| 1837 | + __pid_t msg_lspid; /* pid of last msgsnd() */ |
| 1838 | + __pid_t msg_lrpid; /* pid of last msgrcv() */ |
| 1839 | + __time_t msg_stime; /* time of last msgsnd command */ |
| 1840 | + long __unused1; |
| 1841 | + __time_t msg_rtime; /* time of last msgrcv command */ |
| 1842 | + long __unused2; |
| 1843 | + __time_t msg_ctime; /* time of last change */ |
| 1844 | + long __unused3; |
| 1845 | + long __unused4[4]; |
| 1846 | +}; |
| 1847 | + |
| 1848 | +#ifdef __USE_MISC |
| 1849 | + |
| 1850 | +# define msg_cbytes __msg_cbytes |
| 1851 | + |
| 1852 | +/* buffer for msgctl calls IPC_INFO, MSG_INFO */ |
| 1853 | +struct msginfo |
| 1854 | + { |
| 1855 | + int msgmax; |
| 1856 | + int msgmni; |
| 1857 | + int msgmnb; |
| 1858 | + int msgtql; |
| 1859 | + int msgssz; |
| 1860 | + int msgseg; |
| 1861 | + }; |
| 1862 | + |
| 1863 | +#endif /* __USE_MISC */ |
| 1864 | --- /dev/null |
| 1865 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/poll.h |
| 1866 | @@ -0,0 +1,62 @@ |
| 1867 | +/* Copyright (C) 1997, 2001-2002 Free Software Foundation, Inc. |
| 1868 | + This file is part of the GNU C Library. |
| 1869 | + |
| 1870 | + The GNU C Library is free software; you can redistribute it and/or |
| 1871 | + modify it under the terms of the GNU Lesser General Public |
| 1872 | + License as published by the Free Software Foundation; either |
| 1873 | + version 2.1 of the License, or (at your option) any later version. |
| 1874 | + |
| 1875 | + The GNU C Library is distributed in the hope that it will be useful, |
| 1876 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1877 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 1878 | + Lesser General Public License for more details. |
| 1879 | + |
| 1880 | + You should have received a copy of the GNU Lesser General Public |
| 1881 | + License along with the GNU C Library; if not, write to the Free |
| 1882 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 1883 | + 02111-1307 USA. */ |
| 1884 | + |
| 1885 | +#ifndef _SYS_POLL_H |
| 1886 | +# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead." |
| 1887 | +#endif |
| 1888 | + |
| 1889 | +/* Event types that can be polled for. These bits may be set in `events' |
| 1890 | + to indicate the interesting event types; they will appear in `revents' |
| 1891 | + to indicate the status of the file descriptor. */ |
| 1892 | +#define POLLIN 0x0001 /* There is data to read. */ |
| 1893 | +#define POLLPRI 0x0002 /* There is urgent data to read. */ |
| 1894 | +#define POLLOUT 0x0004 /* Writing now will not block. */ |
| 1895 | + |
| 1896 | +#ifdef __USE_XOPEN |
| 1897 | +/* These values are defined in XPG4.2. */ |
| 1898 | +# define POLLRDNORM 0x0040 /* Normal data may be read. */ |
| 1899 | +# define POLLRDBAND 0x0080 /* Priority data may be read. */ |
| 1900 | +# define POLLWRNORM POLLOUT /* Writing now will not block. */ |
| 1901 | +# define POLLWRBAND 0x0100 /* Priority data may be written. */ |
| 1902 | +#endif |
| 1903 | + |
| 1904 | +#ifdef __USE_BSD |
| 1905 | +/* General FreeBSD extension (currently only supported for sockets): */ |
| 1906 | +# define POLLINIGNEOF 0x2000 /* like POLLIN, except ignore EOF */ |
| 1907 | +#endif |
| 1908 | + |
| 1909 | +/* Event types always implicitly polled for. These bits need not be set in |
| 1910 | + `events', but they will appear in `revents' to indicate the status of |
| 1911 | + the file descriptor. */ |
| 1912 | +#define POLLERR 0x0008 /* Error condition. */ |
| 1913 | +#define POLLHUP 0x0010 /* Hung up. */ |
| 1914 | +#define POLLNVAL 0x0020 /* Invalid polling request. */ |
| 1915 | + |
| 1916 | +#ifdef __USE_BSD |
| 1917 | + |
| 1918 | +# define POLLSTANDARD (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|\ |
| 1919 | + POLLWRBAND|POLLERR|POLLHUP|POLLNVAL) |
| 1920 | + |
| 1921 | +/* |
| 1922 | + * Request that poll() wait forever. |
| 1923 | + * XXX in SYSV, this is defined in stropts.h, which is not included |
| 1924 | + * by poll.h. |
| 1925 | + */ |
| 1926 | +#define INFTIM (-1) |
| 1927 | + |
| 1928 | +#endif |
| 1929 | --- /dev/null |
| 1930 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/posix_opt.h |
| 1931 | @@ -0,0 +1,90 @@ |
| 1932 | +/* Define POSIX options for FreeBSD. |
| 1933 | + Copyright (C) 1996-1997, 1999, 2000, 2002 Free Software Foundation, Inc. |
| 1934 | + This file is part of the GNU C Library. |
| 1935 | + |
| 1936 | + The GNU C Library is free software; you can redistribute it and/or |
| 1937 | + modify it under the terms of the GNU Lesser General Public |
| 1938 | + License as published by the Free Software Foundation; either |
| 1939 | + version 2.1 of the License, or (at your option) any later version. |
| 1940 | + |
| 1941 | + The GNU C Library is distributed in the hope that it will be useful, |
| 1942 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 1943 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 1944 | + Lesser General Public License for more details. |
| 1945 | + |
| 1946 | + You should have received a copy of the GNU Lesser General Public |
| 1947 | + License along with the GNU C Library; if not, write to the Free |
| 1948 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 1949 | + 02111-1307 USA. */ |
| 1950 | + |
| 1951 | +/* |
| 1952 | + * Never include this file directly; use <unistd.h> instead. |
| 1953 | + */ |
| 1954 | + |
| 1955 | +#ifndef _BITS_POSIX_OPT_H |
| 1956 | +#define _BITS_POSIX_OPT_H 1 |
| 1957 | + |
| 1958 | +/* Job control is supported. */ |
| 1959 | +#define _POSIX_JOB_CONTROL 1 |
| 1960 | + |
| 1961 | +/* Processes have a saved set-user-ID and a saved set-group-ID. */ |
| 1962 | +#define _POSIX_SAVED_IDS 1 |
| 1963 | + |
| 1964 | +/* Priority scheduling is supported. */ |
| 1965 | +#define _POSIX_PRIORITY_SCHEDULING 1 |
| 1966 | + |
| 1967 | +/* Synchronizing file data is supported. */ |
| 1968 | +#define _POSIX_SYNCHRONIZED_IO 1 |
| 1969 | + |
| 1970 | +/* The fsync function is present. */ |
| 1971 | +#define _POSIX_FSYNC 1 |
| 1972 | + |
| 1973 | +/* Mapping of files to memory is supported. */ |
| 1974 | +#define _POSIX_MAPPED_FILES 1 |
| 1975 | + |
| 1976 | +/* Locking of all memory is supported. */ |
| 1977 | +#define _POSIX_MEMLOCK 1 |
| 1978 | + |
| 1979 | +/* Locking of ranges of memory is supported. */ |
| 1980 | +#define _POSIX_MEMLOCK_RANGE 1 |
| 1981 | + |
| 1982 | +/* Setting of memory protections is supported. */ |
| 1983 | +#define _POSIX_MEMORY_PROTECTION 1 |
| 1984 | + |
| 1985 | +/* Implementation supports `poll' function. */ |
| 1986 | +#define _POSIX_POLL 1 |
| 1987 | + |
| 1988 | +/* Implementation supports `select' and `pselect' functions. */ |
| 1989 | +#define _POSIX_SELECT 1 |
| 1990 | + |
| 1991 | +/* XPG4.2 shared memory is supported. */ |
| 1992 | +#define _XOPEN_SHM 1 |
| 1993 | + |
| 1994 | +/* X/Open realtime support is available. */ |
| 1995 | +#define _XOPEN_REALTIME 1 |
| 1996 | + |
| 1997 | +/* Only root can change owner of file. */ |
| 1998 | +#define _POSIX_CHOWN_RESTRICTED 1 |
| 1999 | + |
| 2000 | +/* `c_cc' member of 'struct termios' structure can be disabled by |
| 2001 | + using the value _POSIX_VDISABLE. */ |
| 2002 | +#define _POSIX_VDISABLE ((unsigned char)'\377') |
| 2003 | + |
| 2004 | +/* The LFS interface is available, except for the asynchronous I/O. */ |
| 2005 | +#define _LFS_LARGEFILE 1 |
| 2006 | +#define _LFS64_LARGEFILE 1 |
| 2007 | +#define _LFS64_STDIO 1 |
| 2008 | + |
| 2009 | +/* POSIX timers are available. */ |
| 2010 | +#define _POSIX_TIMERS 1 |
| 2011 | + |
| 2012 | +/* GNU libc provides regular expression handling. */ |
| 2013 | +#define _POSIX_REGEXP 1 |
| 2014 | + |
| 2015 | +/* We have a POSIX shell. */ |
| 2016 | +#define _POSIX_SHELL 1 |
| 2017 | + |
| 2018 | +/* The `spawn' function family is supported. */ |
| 2019 | +#define _POSIX_SPAWN 200912L |
| 2020 | + |
| 2021 | +#endif /* bits/posix_opt.h */ |
| 2022 | --- /dev/null |
| 2023 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/resource.h |
| 2024 | @@ -0,0 +1,211 @@ |
| 2025 | +/* Bit values & structures for resource limits. FreeBSD version. |
| 2026 | + Copyright (C) 1994, 1996-1998, 2002 Free Software Foundation, Inc. |
| 2027 | + This file is part of the GNU C Library. |
| 2028 | + |
| 2029 | + The GNU C Library is free software; you can redistribute it and/or |
| 2030 | + modify it under the terms of the GNU Lesser General Public |
| 2031 | + License as published by the Free Software Foundation; either |
| 2032 | + version 2.1 of the License, or (at your option) any later version. |
| 2033 | + |
| 2034 | + The GNU C Library is distributed in the hope that it will be useful, |
| 2035 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 2036 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 2037 | + Lesser General Public License for more details. |
| 2038 | + |
| 2039 | + You should have received a copy of the GNU Lesser General Public |
| 2040 | + License along with the GNU C Library; if not, write to the Free |
| 2041 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 2042 | + 02111-1307 USA. */ |
| 2043 | + |
| 2044 | +#ifndef _SYS_RESOURCE_H |
| 2045 | +# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead." |
| 2046 | +#endif |
| 2047 | + |
| 2048 | +#include <bits/types.h> |
| 2049 | +#include <sys/_types.h> |
| 2050 | + |
| 2051 | +/* Transmute defines to enumerations. The macro re-definitions are |
| 2052 | + necessary because some programs want to test for operating system |
| 2053 | + features with #ifdef RUSAGE_SELF. In ISO C the reflexive |
| 2054 | + definition is a no-op. |
| 2055 | + |
| 2056 | + These are the values for FreeBSD. Earlier BSD systems have a subset of |
| 2057 | + these kinds of resource limit. */ |
| 2058 | + |
| 2059 | +/* Kinds of resource limit. */ |
| 2060 | +enum __rlimit_resource |
| 2061 | +{ |
| 2062 | + /* Per-process CPU limit, in seconds. */ |
| 2063 | + RLIMIT_CPU = 0, |
| 2064 | +#define RLIMIT_CPU RLIMIT_CPU |
| 2065 | + |
| 2066 | + /* Largest file that can be created, in bytes. */ |
| 2067 | + RLIMIT_FSIZE = 1, |
| 2068 | +#define RLIMIT_FSIZE RLIMIT_FSIZE |
| 2069 | + |
| 2070 | + /* Maximum size of data segment, in bytes. */ |
| 2071 | + RLIMIT_DATA = 2, |
| 2072 | +#define RLIMIT_DATA RLIMIT_DATA |
| 2073 | + |
| 2074 | + /* Maximum size of stack segment, in bytes. */ |
| 2075 | + RLIMIT_STACK = 3, |
| 2076 | +#define RLIMIT_STACK RLIMIT_STACK |
| 2077 | + |
| 2078 | + /* Largest core file that can be created, in bytes. */ |
| 2079 | + RLIMIT_CORE = 4, |
| 2080 | +#define RLIMIT_CORE RLIMIT_CORE |
| 2081 | + |
| 2082 | + /* Largest resident set size, in bytes. |
| 2083 | + This affects swapping; processes that are exceeding their |
| 2084 | + resident set size will be more likely to have physical memory |
| 2085 | + taken from them. */ |
| 2086 | + __RLIMIT_RSS = 5, |
| 2087 | +#define RLIMIT_RSS __RLIMIT_RSS |
| 2088 | + |
| 2089 | + /* Locked-in-memory address space. */ |
| 2090 | + __RLIMIT_MEMLOCK = 6, |
| 2091 | +#define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK |
| 2092 | + |
| 2093 | + /* Number of processes. */ |
| 2094 | + __RLIMIT_NPROC = 7, |
| 2095 | +#define RLIMIT_NPROC __RLIMIT_NPROC |
| 2096 | + |
| 2097 | + /* Number of open files. */ |
| 2098 | + RLIMIT_NOFILE = 8, |
| 2099 | +#define RLIMIT_NOFILE RLIMIT_NOFILE |
| 2100 | + |
| 2101 | + /* Maximum size of all socket buffers. */ |
| 2102 | + __RLIMIT_SBSIZE = 9, |
| 2103 | +#define RLIMIT_SBSIZE __RLIMIT_SBSIZE |
| 2104 | + |
| 2105 | + /* Address space limit. */ |
| 2106 | + RLIMIT_AS = 10, |
| 2107 | +#define RLIMIT_AS RLIMIT_AS |
| 2108 | + |
| 2109 | + __RLIMIT_NLIMITS = 11, |
| 2110 | + __RLIM_NLIMITS = __RLIMIT_NLIMITS |
| 2111 | +#define RLIMIT_NLIMITS __RLIMIT_NLIMITS |
| 2112 | +#define RLIM_NLIMITS __RLIM_NLIMITS |
| 2113 | +}; |
| 2114 | + |
| 2115 | +/* Value to indicate that there is no limit. */ |
| 2116 | +#define RLIM_INFINITY 0x7fffffffffffffffLL |
| 2117 | +#ifdef __USE_LARGEFILE64 |
| 2118 | +# define RLIM64_INFINITY 0x7fffffffffffffffLL |
| 2119 | +#endif |
| 2120 | + |
| 2121 | + |
| 2122 | +/* Type for resource quantity measurement. */ |
| 2123 | +typedef __rlim_t rlim_t; |
| 2124 | +#ifdef __USE_LARGEFILE64 |
| 2125 | +typedef __rlim64_t rlim64_t; |
| 2126 | +#endif |
| 2127 | + |
| 2128 | +struct rlimit |
| 2129 | + { |
| 2130 | + /* The current (soft) limit. */ |
| 2131 | + rlim_t rlim_cur; |
| 2132 | + /* The hard limit. */ |
| 2133 | + rlim_t rlim_max; |
| 2134 | + }; |
| 2135 | + |
| 2136 | +#ifdef __USE_LARGEFILE64 |
| 2137 | +struct rlimit64 |
| 2138 | + { |
| 2139 | + /* The current (soft) limit. */ |
| 2140 | + rlim64_t rlim_cur; |
| 2141 | + /* The hard limit. */ |
| 2142 | + rlim64_t rlim_max; |
| 2143 | + }; |
| 2144 | +#endif |
| 2145 | + |
| 2146 | +struct orlimit { |
| 2147 | + __int32_t rlim_cur; /* current (soft) limit */ |
| 2148 | + __int32_t rlim_max; /* maximum value for rlim_cur */ |
| 2149 | +}; |
| 2150 | + |
| 2151 | +struct loadavg { |
| 2152 | + __fixpt_t ldavg[3]; |
| 2153 | + long fscale; |
| 2154 | +}; |
| 2155 | + |
| 2156 | +#define CP_USER 0 |
| 2157 | +#define CP_NICE 1 |
| 2158 | +#define CP_SYS 2 |
| 2159 | +#define CP_INTR 3 |
| 2160 | +#define CP_IDLE 4 |
| 2161 | +#define CPUSTATES 5 |
| 2162 | + |
| 2163 | +/* Whose usage statistics do you want? */ |
| 2164 | +enum __rusage_who |
| 2165 | +{ |
| 2166 | + /* The calling process. */ |
| 2167 | + RUSAGE_SELF = 0, |
| 2168 | +#define RUSAGE_SELF RUSAGE_SELF |
| 2169 | + |
| 2170 | + /* All of its terminated child processes. */ |
| 2171 | + RUSAGE_CHILDREN = -1 |
| 2172 | +#define RUSAGE_CHILDREN RUSAGE_CHILDREN |
| 2173 | +}; |
| 2174 | + |
| 2175 | +#define __need_timeval |
| 2176 | +#include <bits/time.h> /* For `struct timeval'. */ |
| 2177 | + |
| 2178 | +/* Structure which says how much of each resource has been used. */ |
| 2179 | +struct rusage |
| 2180 | + { |
| 2181 | + /* Total amount of user time used. */ |
| 2182 | + struct timeval ru_utime; |
| 2183 | + /* Total amount of system time used. */ |
| 2184 | + struct timeval ru_stime; |
| 2185 | + /* Maximum resident set size (in kilobytes). */ |
| 2186 | + long int ru_maxrss; |
| 2187 | + /* Amount of sharing of text segment memory |
| 2188 | + with other processes (kilobyte-seconds). */ |
| 2189 | + long int ru_ixrss; |
| 2190 | + /* Amount of data segment memory used (kilobyte-seconds). */ |
| 2191 | + long int ru_idrss; |
| 2192 | + /* Amount of stack memory used (kilobyte-seconds). */ |
| 2193 | + long int ru_isrss; |
| 2194 | + /* Number of soft page faults (i.e. those serviced by reclaiming |
| 2195 | + a page from the list of pages awaiting reallocation. */ |
| 2196 | + long int ru_minflt; |
| 2197 | + /* Number of hard page faults (i.e. those that required I/O). */ |
| 2198 | + long int ru_majflt; |
| 2199 | + /* Number of times a process was swapped out of physical memory. */ |
| 2200 | + long int ru_nswap; |
| 2201 | + /* Number of input operations via the file system. Note: This |
| 2202 | + and `ru_oublock' do not include operations with the cache. */ |
| 2203 | + long int ru_inblock; |
| 2204 | + /* Number of output operations via the file system. */ |
| 2205 | + long int ru_oublock; |
| 2206 | + /* Number of IPC messages sent. */ |
| 2207 | + long int ru_msgsnd; |
| 2208 | + /* Number of IPC messages received. */ |
| 2209 | + long int ru_msgrcv; |
| 2210 | + /* Number of signals delivered. */ |
| 2211 | + long int ru_nsignals; |
| 2212 | + /* Number of voluntary context switches, i.e. because the process |
| 2213 | + gave up the process before it had to (usually to wait for some |
| 2214 | + resource to be available). */ |
| 2215 | + long int ru_nvcsw; |
| 2216 | + /* Number of involuntary context switches, i.e. a higher priority process |
| 2217 | + became runnable or the current process used up its time slice. */ |
| 2218 | + long int ru_nivcsw; |
| 2219 | + }; |
| 2220 | + |
| 2221 | +/* Priority limits. */ |
| 2222 | +#define PRIO_MIN -20 /* Minimum priority a process can have. */ |
| 2223 | +#define PRIO_MAX 20 /* Maximum priority a process can have. */ |
| 2224 | + |
| 2225 | +/* The type of the WHICH argument to `getpriority' and `setpriority', |
| 2226 | + indicating what flavor of entity the WHO argument specifies. */ |
| 2227 | +enum __priority_which |
| 2228 | +{ |
| 2229 | + PRIO_PROCESS = 0, /* WHO is a process ID. */ |
| 2230 | +#define PRIO_PROCESS PRIO_PROCESS |
| 2231 | + PRIO_PGRP = 1, /* WHO is a process group ID. */ |
| 2232 | +#define PRIO_PGRP PRIO_PGRP |
| 2233 | + PRIO_USER = 2 /* WHO is a user ID. */ |
| 2234 | +#define PRIO_USER PRIO_USER |
| 2235 | +}; |
| 2236 | --- /dev/null |
| 2237 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/sched.h |
| 2238 | @@ -0,0 +1,183 @@ |
| 2239 | +/* Definitions of constants and data structure for POSIX 1003.1b-1993 |
| 2240 | + scheduling interface. |
| 2241 | + Copyright (C) 1996-1999,2001-2003,2005,2006,2007,2008 |
| 2242 | + Free Software Foundation, Inc. |
| 2243 | + This file is part of the GNU C Library. |
| 2244 | + |
| 2245 | + The GNU C Library is free software; you can redistribute it and/or |
| 2246 | + modify it under the terms of the GNU Lesser General Public |
| 2247 | + License as published by the Free Software Foundation; either |
| 2248 | + version 2.1 of the License, or (at your option) any later version. |
| 2249 | + |
| 2250 | + The GNU C Library is distributed in the hope that it will be useful, |
| 2251 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 2252 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 2253 | + Lesser General Public License for more details. |
| 2254 | + |
| 2255 | + You should have received a copy of the GNU Lesser General Public |
| 2256 | + License along with the GNU C Library; if not, write to the Free |
| 2257 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 2258 | + 02111-1307 USA. */ |
| 2259 | + |
| 2260 | +#ifndef __need_schedparam |
| 2261 | + |
| 2262 | +#ifndef _SCHED_H |
| 2263 | +# error "Never include <bits/sched.h> directly; use <sched.h> instead." |
| 2264 | +#endif |
| 2265 | + |
| 2266 | + |
| 2267 | +/* Scheduling algorithms. */ |
| 2268 | +#define SCHED_OTHER 2 |
| 2269 | +#define SCHED_FIFO 1 |
| 2270 | +#define SCHED_RR 3 |
| 2271 | + |
| 2272 | + |
| 2273 | +#ifdef __USE_MISC |
| 2274 | +/* Cloning flags. */ |
| 2275 | +# define CSIGNAL 0x000000ff /* Signal mask to be sent at exit. */ |
| 2276 | +# define CLONE_VM 0x00000100 /* Set if VM shared between processes. */ |
| 2277 | +# define CLONE_FS 0x00000200 /* Set if fs info shared between processes. */ |
| 2278 | +# define CLONE_FILES 0x00000400 /* Set if open files shared between processes. */ |
| 2279 | +# define CLONE_SIGHAND 0x00000800 /* Set if signal handlers shared. */ |
| 2280 | +# define CLONE_PTRACE 0x00002000 /* Set if tracing continues on the child. */ |
| 2281 | +# define CLONE_VFORK 0x00004000 /* Set if the parent wants the child to |
| 2282 | + wake it up on mm_release. */ |
| 2283 | +# define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */ |
| 2284 | +#endif |
| 2285 | + |
| 2286 | +/* The official definition. */ |
| 2287 | +struct sched_param |
| 2288 | + { |
| 2289 | + int __sched_priority; |
| 2290 | + }; |
| 2291 | + |
| 2292 | +__BEGIN_DECLS |
| 2293 | + |
| 2294 | +#ifdef __USE_MISC |
| 2295 | +/* Clone current process. */ |
| 2296 | +extern int clone (int (*__fn) (void *__arg), void *__child_stack, |
| 2297 | + int __flags, void *__arg) __THROW; |
| 2298 | + |
| 2299 | +/* Unshare the specified resources. */ |
| 2300 | +extern int unshare (int __flags) __THROW; |
| 2301 | + |
| 2302 | +/* Get index of currently used CPU. */ |
| 2303 | +extern int sched_getcpu (void) __THROW; |
| 2304 | +#endif |
| 2305 | + |
| 2306 | +__END_DECLS |
| 2307 | + |
| 2308 | +#endif /* need schedparam */ |
| 2309 | + |
| 2310 | +#if !defined __defined_schedparam \ |
| 2311 | + && (defined __need_schedparam || defined _SCHED_H) |
| 2312 | +# define __defined_schedparam 1 |
| 2313 | +/* Data structure to describe a process' schedulability. */ |
| 2314 | +struct __sched_param |
| 2315 | + { |
| 2316 | + int __sched_priority; |
| 2317 | + }; |
| 2318 | +# undef __need_schedparam |
| 2319 | +#endif |
| 2320 | + |
| 2321 | + |
| 2322 | +#if defined _SCHED_H && !defined __cpu_set_t_defined |
| 2323 | +# define __cpu_set_t_defined |
| 2324 | +/* Size definition for CPU sets. */ |
| 2325 | +# define __CPU_SETSIZE 128 |
| 2326 | +# define __NCPUBITS (8 * sizeof (__cpu_mask)) |
| 2327 | + |
| 2328 | +/* Type for array elements in 'cpu_set_t'. */ |
| 2329 | +typedef unsigned long int __cpu_mask; |
| 2330 | + |
| 2331 | +/* Basic access functions. */ |
| 2332 | +# define __CPUELT(cpu) ((cpu) / __NCPUBITS) |
| 2333 | +# define __CPUMASK(cpu) ((__cpu_mask) 1 << ((cpu) % __NCPUBITS)) |
| 2334 | + |
| 2335 | +/* Data structure to describe CPU mask. */ |
| 2336 | +typedef struct |
| 2337 | +{ |
| 2338 | + __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS]; |
| 2339 | +} cpu_set_t; |
| 2340 | + |
| 2341 | +/* Access functions for CPU masks. */ |
| 2342 | +# if __GNUC_PREREQ (2, 91) |
| 2343 | +# define __CPU_ZERO_S(setsize, cpusetp) \ |
| 2344 | + do __builtin_memset (cpusetp, '\0', setsize); while (0) |
| 2345 | +# else |
| 2346 | +# define __CPU_ZERO_S(setsize, cpusetp) \ |
| 2347 | + do { \ |
| 2348 | + size_t __i; \ |
| 2349 | + size_t __imax = (setsize) / sizeof (__cpu_mask); \ |
| 2350 | + __cpu_mask *__bits = (cpusetp)->__bits; \ |
| 2351 | + for (__i = 0; __i < __imax; ++__i) \ |
| 2352 | + __bits[__i] = 0; \ |
| 2353 | + } while (0) |
| 2354 | +# endif |
| 2355 | +# define __CPU_SET_S(cpu, setsize, cpusetp) \ |
| 2356 | + (__extension__ \ |
| 2357 | + ({ size_t __cpu = (cpu); \ |
| 2358 | + __cpu < 8 * (setsize) \ |
| 2359 | + ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ |
| 2360 | + |= __CPUMASK (__cpu)) \ |
| 2361 | + : 0; })) |
| 2362 | +# define __CPU_CLR_S(cpu, setsize, cpusetp) \ |
| 2363 | + (__extension__ \ |
| 2364 | + ({ size_t __cpu = (cpu); \ |
| 2365 | + __cpu < 8 * (setsize) \ |
| 2366 | + ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ |
| 2367 | + &= ~__CPUMASK (__cpu)) \ |
| 2368 | + : 0; })) |
| 2369 | +# define __CPU_ISSET_S(cpu, setsize, cpusetp) \ |
| 2370 | + (__extension__ \ |
| 2371 | + ({ size_t __cpu = (cpu); \ |
| 2372 | + __cpu < 8 * (setsize) \ |
| 2373 | + ? ((((__const __cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ |
| 2374 | + & __CPUMASK (__cpu))) != 0 \ |
| 2375 | + : 0; })) |
| 2376 | + |
| 2377 | +# define __CPU_COUNT_S(setsize, cpusetp) \ |
| 2378 | + __sched_cpucount (setsize, cpusetp) |
| 2379 | + |
| 2380 | +# if __GNUC_PREREQ (2, 91) |
| 2381 | +# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ |
| 2382 | + (__builtin_memcmp (cpusetp1, cpusetp2, setsize) == 0) |
| 2383 | +# else |
| 2384 | +# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ |
| 2385 | + (__extension__ \ |
| 2386 | + ({ __const __cpu_mask *__arr1 = (cpusetp1)->__bits; \ |
| 2387 | + __const __cpu_mask *__arr2 = (cpusetp2)->__bits; \ |
| 2388 | + size_t __imax = (setsize) / sizeof (__cpu_mask); \ |
| 2389 | + size_t __i; \ |
| 2390 | + for (__i = 0; __i < __imax; ++__i) \ |
| 2391 | + if (__bits[__i] != __bits[__i]) \ |
| 2392 | + break; \ |
| 2393 | + __i == __imax; })) |
| 2394 | +# endif |
| 2395 | + |
| 2396 | +# define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \ |
| 2397 | + (__extension__ \ |
| 2398 | + ({ cpu_set_t *__dest = (destset); \ |
| 2399 | + __const __cpu_mask *__arr1 = (srcset1)->__bits; \ |
| 2400 | + __const __cpu_mask *__arr2 = (srcset2)->__bits; \ |
| 2401 | + size_t __imax = (setsize) / sizeof (__cpu_mask); \ |
| 2402 | + size_t __i; \ |
| 2403 | + for (__i = 0; __i < __imax; ++__i) \ |
| 2404 | + ((__cpu_mask *) __dest->__bits)[__i] = __arr1[__i] op __arr2[__i]; \ |
| 2405 | + __dest; })) |
| 2406 | + |
| 2407 | +# define __CPU_ALLOC_SIZE(count) \ |
| 2408 | + ((((count) + __NCPUBITS - 1) / __NCPUBITS) * sizeof (__cpu_mask)) |
| 2409 | +# define __CPU_ALLOC(count) __sched_cpualloc (count) |
| 2410 | +# define __CPU_FREE(cpuset) __sched_cpufree (cpuset) |
| 2411 | + |
| 2412 | +__BEGIN_DECLS |
| 2413 | + |
| 2414 | +extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp) |
| 2415 | + __THROW; |
| 2416 | +extern cpu_set_t *__sched_cpualloc (size_t __count) __THROW __wur; |
| 2417 | +extern void __sched_cpufree (cpu_set_t *__set) __THROW; |
| 2418 | + |
| 2419 | +__END_DECLS |
| 2420 | + |
| 2421 | +#endif |
| 2422 | --- /dev/null |
| 2423 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/sem.h |
| 2424 | @@ -0,0 +1,95 @@ |
| 2425 | +/* Copyright (C) 1995-1998, 2002 Free Software Foundation, Inc. |
| 2426 | + This file is part of the GNU C Library. |
| 2427 | + |
| 2428 | + The GNU C Library is free software; you can redistribute it and/or |
| 2429 | + modify it under the terms of the GNU Lesser General Public |
| 2430 | + License as published by the Free Software Foundation; either |
| 2431 | + version 2.1 of the License, or (at your option) any later version. |
| 2432 | + |
| 2433 | + The GNU C Library is distributed in the hope that it will be useful, |
| 2434 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 2435 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 2436 | + Lesser General Public License for more details. |
| 2437 | + |
| 2438 | + You should have received a copy of the GNU Lesser General Public |
| 2439 | + License along with the GNU C Library; if not, write to the Free |
| 2440 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 2441 | + 02111-1307 USA. */ |
| 2442 | + |
| 2443 | +#ifndef _SYS_SEM_H |
| 2444 | +# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead." |
| 2445 | +#endif |
| 2446 | + |
| 2447 | +#include <sys/types.h> |
| 2448 | + |
| 2449 | +/* Flags for `semop'. */ |
| 2450 | +#define SEM_UNDO 0x1000 /* undo the operation on exit */ |
| 2451 | + |
| 2452 | +/* Commands for `semctl'. */ |
| 2453 | +#define GETPID 4 /* get sempid */ |
| 2454 | +#define GETVAL 5 /* get semval */ |
| 2455 | +#define GETALL 6 /* get all semval's */ |
| 2456 | +#define GETNCNT 3 /* get semncnt */ |
| 2457 | +#define GETZCNT 7 /* get semzcnt */ |
| 2458 | +#define SETVAL 8 /* set semval */ |
| 2459 | +#define SETALL 9 /* set all semval's */ |
| 2460 | + |
| 2461 | +#ifdef __USE_BSD |
| 2462 | +# define SEM_R IPC_R /* read permission for user */ |
| 2463 | +# define SEM_A IPC_W /* alter permission for user */ |
| 2464 | +#endif |
| 2465 | + |
| 2466 | + |
| 2467 | +/* Data structure describing a set of semaphores. */ |
| 2468 | +struct semid_ds |
| 2469 | +{ |
| 2470 | + struct ipc_perm sem_perm; /* operation permission struct */ |
| 2471 | + void *__sem_base; |
| 2472 | + unsigned short int sem_nsems; /* number of semaphores in set */ |
| 2473 | + __time_t sem_otime; /* last semop() time */ |
| 2474 | + long __unused1; |
| 2475 | + __time_t sem_ctime; /* last time changed by semctl() */ |
| 2476 | + long __unused2; |
| 2477 | + long __unused3[4]; |
| 2478 | +}; |
| 2479 | + |
| 2480 | +/* The user should define a union like the following to use it for arguments |
| 2481 | + for `semctl'. |
| 2482 | + |
| 2483 | + union semun |
| 2484 | + { |
| 2485 | + int val; <= value for SETVAL |
| 2486 | + struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET |
| 2487 | + unsigned short int *array; <= array for GETALL & SETALL |
| 2488 | + struct seminfo *__buf; <= buffer for IPC_INFO |
| 2489 | + }; |
| 2490 | + |
| 2491 | + Previous versions of this file used to define this union but this is |
| 2492 | + incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether |
| 2493 | + one must define the union or not. */ |
| 2494 | +#define _SEM_SEMUN_UNDEFINED 1 |
| 2495 | + |
| 2496 | +#ifdef __USE_MISC |
| 2497 | + |
| 2498 | +/* ipcs ctl cmds */ |
| 2499 | +# define SEM_STAT 10 |
| 2500 | +# define SEM_INFO 11 |
| 2501 | + |
| 2502 | +/* |
| 2503 | + * semaphore info struct |
| 2504 | + */ |
| 2505 | +struct seminfo { |
| 2506 | + int semmap, /* # of entries in semaphore map */ |
| 2507 | + semmni, /* # of semaphore identifiers */ |
| 2508 | + semmns, /* # of semaphores in system */ |
| 2509 | + semmnu, /* # of undo structures in system */ |
| 2510 | + semmsl, /* max # of semaphores per id */ |
| 2511 | + semopm, /* max # of operations per semop call */ |
| 2512 | + semume, /* max # of undo entries per process */ |
| 2513 | + semusz, /* size in bytes of undo structure */ |
| 2514 | + semvmx, /* semaphore maximum value */ |
| 2515 | + semaem; /* adjust on exit max value */ |
| 2516 | +}; |
| 2517 | + |
| 2518 | +#endif |
| 2519 | + |
| 2520 | --- /dev/null |
| 2521 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/shm.h |
| 2522 | @@ -0,0 +1,90 @@ |
| 2523 | +/* Copyright (C) 1995-1997, 2000, 2002 Free Software Foundation, Inc. |
| 2524 | + This file is part of the GNU C Library. |
| 2525 | + |
| 2526 | + The GNU C Library is free software; you can redistribute it and/or |
| 2527 | + modify it under the terms of the GNU Lesser General Public |
| 2528 | + License as published by the Free Software Foundation; either |
| 2529 | + version 2.1 of the License, or (at your option) any later version. |
| 2530 | + |
| 2531 | + The GNU C Library is distributed in the hope that it will be useful, |
| 2532 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 2533 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 2534 | + Lesser General Public License for more details. |
| 2535 | + |
| 2536 | + You should have received a copy of the GNU Lesser General Public |
| 2537 | + License along with the GNU C Library; if not, write to the Free |
| 2538 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 2539 | + 02111-1307 USA. */ |
| 2540 | + |
| 2541 | +#ifndef _SYS_SHM_H |
| 2542 | +# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead." |
| 2543 | +#endif |
| 2544 | + |
| 2545 | +#include <bits/types.h> |
| 2546 | + |
| 2547 | +/* Permission flag for shmget. */ |
| 2548 | +#ifdef __USE_BSD |
| 2549 | +# define SHM_R IPC_R /* read permission for user */ |
| 2550 | +# define SHM_W IPC_W /* write permission for user */ |
| 2551 | +#endif |
| 2552 | + |
| 2553 | +/* Flags for `shmat'. */ |
| 2554 | +#define SHM_RDONLY 010000 /* attach read-only else read-write */ |
| 2555 | +#define SHM_RND 020000 /* round attach address to SHMLBA */ |
| 2556 | + |
| 2557 | +/* Commands for `shmctl'. */ |
| 2558 | +#define SHM_LOCK 11 /* lock segment (root only) */ |
| 2559 | +#define SHM_UNLOCK 12 /* unlock segment (root only) */ |
| 2560 | + |
| 2561 | +__BEGIN_DECLS |
| 2562 | + |
| 2563 | +/* Segment low boundary address multiple. */ |
| 2564 | +#define SHMLBA (__getpagesize ()) |
| 2565 | +extern int __getpagesize (void) __THROW __attribute__ ((__const__)); |
| 2566 | + |
| 2567 | + |
| 2568 | +/* Type to count number of attaches. */ |
| 2569 | +typedef unsigned short int shmatt_t; |
| 2570 | + |
| 2571 | +/* Data structure describing a set of semaphores. */ |
| 2572 | +struct shmid_ds |
| 2573 | + { |
| 2574 | + struct ipc_perm shm_perm; /* operation permission struct */ |
| 2575 | + int shm_segsz; /* size of segment in bytes */ |
| 2576 | + __pid_t shm_lpid; /* pid of last shmop */ |
| 2577 | + __pid_t shm_cpid; /* pid of creator */ |
| 2578 | + shmatt_t shm_nattch; /* number of current attaches */ |
| 2579 | + __time_t shm_atime; /* time of last shmat() */ |
| 2580 | + __time_t shm_dtime; /* time of last shmdt() */ |
| 2581 | + __time_t shm_ctime; /* time of last change by shmctl() */ |
| 2582 | + void *__shm_internal; |
| 2583 | + }; |
| 2584 | + |
| 2585 | +#ifdef __USE_MISC |
| 2586 | + |
| 2587 | +/* ipcs ctl commands */ |
| 2588 | +# define SHM_STAT 13 |
| 2589 | +# define SHM_INFO 14 |
| 2590 | + |
| 2591 | +struct shminfo |
| 2592 | + { |
| 2593 | + int shmmax, /* max shared memory segment size (bytes) */ |
| 2594 | + shmmin, /* min shared memory segment size (bytes) */ |
| 2595 | + shmmni, /* max number of shared memory identifiers */ |
| 2596 | + shmseg, /* max shared memory segments per process */ |
| 2597 | + shmall; /* max amount of shared memory (pages) */ |
| 2598 | + }; |
| 2599 | + |
| 2600 | +struct shm_info |
| 2601 | + { |
| 2602 | + int used_ids; |
| 2603 | + unsigned long int shm_tot; /* total allocated shm */ |
| 2604 | + unsigned long int shm_rss; /* total resident shm */ |
| 2605 | + unsigned long int shm_swp; /* total swapped shm */ |
| 2606 | + unsigned long int swap_attempts; |
| 2607 | + unsigned long int swap_successes; |
| 2608 | + }; |
| 2609 | + |
| 2610 | +#endif /* __USE_MISC */ |
| 2611 | + |
| 2612 | +__END_DECLS |
| 2613 | --- /dev/null |
| 2614 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/sigaction.h |
| 2615 | @@ -0,0 +1,76 @@ |
| 2616 | +/* Copyright (C) 1991-1992,1996-1998,2001-2002 Free Software Foundation, Inc. |
| 2617 | + This file is part of the GNU C Library. |
| 2618 | + |
| 2619 | + The GNU C Library is free software; you can redistribute it and/or |
| 2620 | + modify it under the terms of the GNU Lesser General Public |
| 2621 | + License as published by the Free Software Foundation; either |
| 2622 | + version 2.1 of the License, or (at your option) any later version. |
| 2623 | + |
| 2624 | + The GNU C Library is distributed in the hope that it will be useful, |
| 2625 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 2626 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 2627 | + Lesser General Public License for more details. |
| 2628 | + |
| 2629 | + You should have received a copy of the GNU Lesser General Public |
| 2630 | + License along with the GNU C Library; if not, write to the Free |
| 2631 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 2632 | + 02111-1307 USA. */ |
| 2633 | + |
| 2634 | +#ifndef _SIGNAL_H |
| 2635 | +# error "Never include <bits/sigaction.h> directly; use <signal.h> instead." |
| 2636 | +#endif |
| 2637 | + |
| 2638 | +/* These definitions match those used by the FreeBSD kernel. */ |
| 2639 | + |
| 2640 | +/* Structure describing the action to be taken when a signal arrives. */ |
| 2641 | +struct sigaction |
| 2642 | + { |
| 2643 | + /* Signal handler. */ |
| 2644 | +#ifdef __USE_POSIX199309 |
| 2645 | + union |
| 2646 | + { |
| 2647 | + /* Used if SA_SIGINFO is not set. */ |
| 2648 | + __sighandler_t sa_handler; |
| 2649 | + /* Used if SA_SIGINFO is set. */ |
| 2650 | + void (*sa_sigaction) (int, siginfo_t *, void *); |
| 2651 | + } |
| 2652 | + __sigaction_handler; |
| 2653 | +# define sa_handler __sigaction_handler.sa_handler |
| 2654 | +# define sa_sigaction __sigaction_handler.sa_sigaction |
| 2655 | +#else |
| 2656 | + __sighandler_t sa_handler; |
| 2657 | +#endif |
| 2658 | + |
| 2659 | + /* Special flags. */ |
| 2660 | + int sa_flags; |
| 2661 | + |
| 2662 | + /* Additional set of signals to be blocked. */ |
| 2663 | + __sigset_t sa_mask; |
| 2664 | + }; |
| 2665 | + |
| 2666 | +/* Bits in `sa_flags'. */ |
| 2667 | +#if defined __USE_UNIX98 || defined __USE_MISC |
| 2668 | +# define SA_ONSTACK 0x0001 /* Take signal on signal stack. */ |
| 2669 | +# define SA_RESTART 0x0002 /* Restart syscall on signal return. */ |
| 2670 | +# define SA_RESETHAND 0x0004 /* Reset to SIG_DFL on entry to handler. */ |
| 2671 | +# define SA_NODEFER 0x0010 /* Don't automatically block the signal when |
| 2672 | + its handler is being executed. */ |
| 2673 | +# define SA_NOCLDWAIT 0x0020 /* Don't save zombie processes. */ |
| 2674 | +# define SA_SIGINFO 0x0040 /* Provide additional info to the handler. */ |
| 2675 | +#endif |
| 2676 | +#define SA_NOCLDSTOP 0x0008 /* Don't send SIGCHLD when children stop. */ |
| 2677 | + |
| 2678 | +#ifdef __USE_MISC |
| 2679 | +# define SA_INTERRUPT 0 /* Historical no-op ("not SA_RESTART"). */ |
| 2680 | + |
| 2681 | +/* Some aliases for the SA_ constants. */ |
| 2682 | +# define SA_NOMASK SA_NODEFER |
| 2683 | +# define SA_ONESHOT SA_RESETHAND |
| 2684 | +# define SA_STACK SA_ONSTACK |
| 2685 | +#endif |
| 2686 | + |
| 2687 | + |
| 2688 | +/* Values for the HOW argument to `sigprocmask'. */ |
| 2689 | +#define SIG_BLOCK 1 /* Block signals. */ |
| 2690 | +#define SIG_UNBLOCK 2 /* Unblock signals. */ |
| 2691 | +#define SIG_SETMASK 3 /* Set the set of blocked signals. */ |
| 2692 | --- /dev/null |
| 2693 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/siginfo.h |
| 2694 | @@ -0,0 +1,235 @@ |
| 2695 | +/* siginfo_t, sigevent and constants. FreeBSD version. |
| 2696 | + Copyright (C) 1997-1998, 2000-2002 Free Software Foundation, Inc. |
| 2697 | + This file is part of the GNU C Library. |
| 2698 | + |
| 2699 | + The GNU C Library is free software; you can redistribute it and/or |
| 2700 | + modify it under the terms of the GNU Lesser General Public |
| 2701 | + License as published by the Free Software Foundation; either |
| 2702 | + version 2.1 of the License, or (at your option) any later version. |
| 2703 | + |
| 2704 | + The GNU C Library is distributed in the hope that it will be useful, |
| 2705 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 2706 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 2707 | + Lesser General Public License for more details. |
| 2708 | + |
| 2709 | + You should have received a copy of the GNU Lesser General Public |
| 2710 | + License along with the GNU C Library; if not, write to the Free |
| 2711 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 2712 | + 02111-1307 USA. */ |
| 2713 | + |
| 2714 | +#if !defined _SIGNAL_H && !defined __need_siginfo_t \ |
| 2715 | + && !defined __need_sigevent_t |
| 2716 | +# error "Never include this file directly. Use <signal.h> instead" |
| 2717 | +#endif |
| 2718 | + |
| 2719 | +#if (!defined __have_sigval_t \ |
| 2720 | + && (defined _SIGNAL_H || defined __need_siginfo_t \ |
| 2721 | + || defined __need_sigevent_t)) |
| 2722 | +# define __have_sigval_t 1 |
| 2723 | + |
| 2724 | +/* Type for data associated with a signal. */ |
| 2725 | +typedef union sigval |
| 2726 | + { |
| 2727 | + int sival_int; |
| 2728 | + void *sival_ptr; |
| 2729 | + } sigval_t; |
| 2730 | +#endif |
| 2731 | + |
| 2732 | +#if (!defined __have_siginfo_t \ |
| 2733 | + && (defined _SIGNAL_H || defined __need_siginfo_t)) |
| 2734 | +# define __have_siginfo_t 1 |
| 2735 | + |
| 2736 | +typedef struct siginfo |
| 2737 | + { |
| 2738 | + int si_signo; /* Signal number. */ |
| 2739 | + int si_errno; /* If non-zero, an errno value associated with |
| 2740 | + this signal, as defined in <errno.h>. */ |
| 2741 | + int si_code; /* Signal code. */ |
| 2742 | + int si_pid; /* Sending process ID. */ |
| 2743 | + unsigned int si_uid; /* Real user ID of sending process. */ |
| 2744 | + int si_status; /* Exit value or signal. */ |
| 2745 | + void *si_addr; /* Address of faulting instruction. */ |
| 2746 | + union sigval si_value; /* Signal value. */ |
| 2747 | + long int si_band; /* Band event for SIGPOLL. */ |
| 2748 | + int __si_spare[7]; |
| 2749 | + } siginfo_t; |
| 2750 | + |
| 2751 | + |
| 2752 | +/* Values for `si_code'. Positive values are reserved for kernel-generated |
| 2753 | + signals. */ |
| 2754 | +enum |
| 2755 | +{ |
| 2756 | + SI_ASYNCIO = 0x10004, /* Sent by AIO completion. */ |
| 2757 | +# define SI_ASYNCIO SI_ASYNCIO |
| 2758 | + SI_MESGQ = 0x10005, /* Sent by real time mesq state change. */ |
| 2759 | +# define SI_MESGQ SI_MESGQ |
| 2760 | + SI_TIMER = 0x10003, /* Sent by timer expiration. */ |
| 2761 | +# define SI_TIMER SI_TIMER |
| 2762 | + SI_QUEUE = 0x10002, /* Sent by sigqueue. */ |
| 2763 | +# define SI_QUEUE SI_QUEUE |
| 2764 | + SI_USER = 0x10001, /* Sent by kill, sigsend, raise. */ |
| 2765 | +# define SI_USER SI_USER |
| 2766 | + SI_KERNEL = 0x10006, |
| 2767 | +# define SI_KERNEL SI_KERNEL |
| 2768 | + SI_LWP = 0x10007, /* Sent by thr_kill. */ |
| 2769 | +# define SI_LWP SI_LWP |
| 2770 | + SI_UNDEFINED = 0 |
| 2771 | +# define SI_UNDEFINED SI_UNDEFINED |
| 2772 | +}; |
| 2773 | + |
| 2774 | +/* `si_code' values for SIGILL signal. */ |
| 2775 | +enum |
| 2776 | +{ |
| 2777 | + ILL_ILLOPC = 1, /* Illegal opcode. */ |
| 2778 | +# define ILL_ILLOPC ILL_ILLOPC |
| 2779 | + ILL_ILLOPN, /* Illegal operand. */ |
| 2780 | +# define ILL_ILLOPN ILL_ILLOPN |
| 2781 | + ILL_ILLADR, /* Illegal addressing mode. */ |
| 2782 | +# define ILL_ILLADR ILL_ILLADR |
| 2783 | + ILL_ILLTRP, /* Illegal trap. */ |
| 2784 | +# define ILL_ILLTRP ILL_ILLTRP |
| 2785 | + ILL_PRVOPC, /* Privileged opcode. */ |
| 2786 | +# define ILL_PRVOPC ILL_PRVOPC |
| 2787 | + ILL_PRVREG, /* Privileged register. */ |
| 2788 | +# define ILL_PRVREG ILL_PRVREG |
| 2789 | + ILL_COPROC, /* Coprocessor error. */ |
| 2790 | +# define ILL_COPROC ILL_COPROC |
| 2791 | + ILL_BADSTK /* Internal stack error. */ |
| 2792 | +# define ILL_BADSTK ILL_BADSTK |
| 2793 | +}; |
| 2794 | + |
| 2795 | +/* `si_code' values for SIGFPE signal. */ |
| 2796 | +enum |
| 2797 | +{ |
| 2798 | + FPE_INTOVF = 1, /* Integer overflow. */ |
| 2799 | +# define FPE_INTOVF FPE_INTOVF |
| 2800 | + FPE_INTDIV, /* Integer divide by zero. */ |
| 2801 | +# define FPE_INTDIV FPE_INTDIV |
| 2802 | + FPE_FLTDIV, /* Floating point divide by zero. */ |
| 2803 | +# define FPE_FLTDIV FPE_FLTDIV |
| 2804 | + FPE_FLTOVF, /* Floating point overflow. */ |
| 2805 | +# define FPE_FLTOVF FPE_FLTOVF |
| 2806 | + FPE_FLTUND, /* Floating point underflow. */ |
| 2807 | +# define FPE_FLTUND FPE_FLTUND |
| 2808 | + FPE_FLTRES, /* Floating point inexact result. */ |
| 2809 | +# define FPE_FLTRES FPE_FLTRES |
| 2810 | + FPE_FLTINV, /* Floating point invalid operation. */ |
| 2811 | +# define FPE_FLTINV FPE_FLTINV |
| 2812 | + FPE_FLTSUB /* Subscript out of range. */ |
| 2813 | +# define FPE_FLTSUB FPE_FLTSUB |
| 2814 | +}; |
| 2815 | + |
| 2816 | +/* `si_code' values for SIGSEGV signal. */ |
| 2817 | +enum |
| 2818 | +{ |
| 2819 | + SEGV_MAPERR = 1, /* Address not mapped to object. */ |
| 2820 | +# define SEGV_MAPERR SEGV_MAPERR |
| 2821 | + SEGV_ACCERR /* Invalid permissions for mapped object. */ |
| 2822 | +# define SEGV_ACCERR SEGV_ACCERR |
| 2823 | +}; |
| 2824 | + |
| 2825 | +/* `si_code' values for SIGBUS signal. */ |
| 2826 | +enum |
| 2827 | +{ |
| 2828 | + BUS_ADRALN = 1, /* Invalid address alignment. */ |
| 2829 | +# define BUS_ADRALN BUS_ADRALN |
| 2830 | + BUS_ADRERR, /* Non-existant physical address. */ |
| 2831 | +# define BUS_ADRERR BUS_ADRERR |
| 2832 | + BUS_OBJERR /* Object specific hardware error. */ |
| 2833 | +# define BUS_OBJERR BUS_OBJERR |
| 2834 | +}; |
| 2835 | + |
| 2836 | +/* `si_code' values for SIGTRAP signal. */ |
| 2837 | +enum |
| 2838 | +{ |
| 2839 | + TRAP_BRKPT = 1, /* Process breakpoint. */ |
| 2840 | +# define TRAP_BRKPT TRAP_BRKPT |
| 2841 | + TRAP_TRACE /* Process trace trap. */ |
| 2842 | +# define TRAP_TRACE TRAP_TRACE |
| 2843 | +}; |
| 2844 | + |
| 2845 | +/* `si_code' values for SIGCHLD signal. */ |
| 2846 | +/* XXX These are only used by the waitid() function, not by the kernel. */ |
| 2847 | +enum |
| 2848 | +{ |
| 2849 | + CLD_EXITED = 1, /* Child has exited. */ |
| 2850 | +# define CLD_EXITED CLD_EXITED |
| 2851 | + CLD_KILLED, /* Child was killed. */ |
| 2852 | +# define CLD_KILLED CLD_KILLED |
| 2853 | + CLD_DUMPED, /* Child terminated abnormally. */ |
| 2854 | +# define CLD_DUMPED CLD_DUMPED |
| 2855 | + CLD_TRAPPED, /* Traced child has trapped. */ |
| 2856 | +# define CLD_TRAPPED CLD_TRAPPED |
| 2857 | + CLD_STOPPED, /* Child has stopped. */ |
| 2858 | +# define CLD_STOPPED CLD_STOPPED |
| 2859 | + CLD_CONTINUED /* Stopped child has continued. */ |
| 2860 | +# define CLD_CONTINUED CLD_CONTINUED |
| 2861 | +}; |
| 2862 | + |
| 2863 | +/* `si_code' values for SIGPOLL signal. */ |
| 2864 | +enum |
| 2865 | +{ |
| 2866 | + POLL_IN = 1, /* Data input available. */ |
| 2867 | +# define POLL_IN POLL_IN |
| 2868 | + POLL_OUT, /* Output buffers available. */ |
| 2869 | +# define POLL_OUT POLL_OUT |
| 2870 | + POLL_MSG, /* Input message available. */ |
| 2871 | +# define POLL_MSG POLL_MSG |
| 2872 | + POLL_ERR, /* I/O error. */ |
| 2873 | +# define POLL_ERR POLL_ERR |
| 2874 | + POLL_PRI, /* High priority input available. */ |
| 2875 | +# define POLL_PRI POLL_PRI |
| 2876 | + POLL_HUP /* Device disconnected. */ |
| 2877 | +# define POLL_HUP POLL_HUP |
| 2878 | +}; |
| 2879 | + |
| 2880 | +# undef __need_siginfo_t |
| 2881 | +#endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t). */ |
| 2882 | + |
| 2883 | + |
| 2884 | +#if (defined _SIGNAL_H || defined __need_sigevent_t) \ |
| 2885 | + && !defined __have_sigevent_t |
| 2886 | +# define __have_sigevent_t 1 |
| 2887 | + |
| 2888 | +#include <sys/_types.h> /* __lwpid_t */ |
| 2889 | + |
| 2890 | +/* Structure to transport application-defined values with signals. */ |
| 2891 | + |
| 2892 | +typedef struct sigevent |
| 2893 | + { |
| 2894 | + int sigev_notify; |
| 2895 | + int sigev_signo; |
| 2896 | + sigval_t sigev_value; |
| 2897 | + union |
| 2898 | + { |
| 2899 | + __lwpid_t threadid; |
| 2900 | + struct |
| 2901 | + { |
| 2902 | + void (*function) (sigval_t); /* Function to start. */ |
| 2903 | + void *attributes; /* Really pthread_attr_t. */ |
| 2904 | + } thread; |
| 2905 | + } un; |
| 2906 | + } sigevent_t; |
| 2907 | + |
| 2908 | +#define sigev_notify_kqueue sigev_signo |
| 2909 | +#define sigev_notify_function un.thread.function |
| 2910 | +#define sigev_notify_attributes un.thread.attributes |
| 2911 | +#define sigev_notify_thread_id un.threadid |
| 2912 | + |
| 2913 | +/* `sigev_notify' values. */ |
| 2914 | +enum |
| 2915 | +{ |
| 2916 | + SIGEV_SIGNAL = 1, /* Notify via signal. */ |
| 2917 | +# define SIGEV_SIGNAL SIGEV_SIGNAL |
| 2918 | + SIGEV_NONE = 0, /* Other notification: meaningless. */ |
| 2919 | +# define SIGEV_NONE SIGEV_NONE |
| 2920 | + /* Not yet supported by the kernel. */ |
| 2921 | + SIGEV_THREAD = 2, /* Deliver via thread creation. */ |
| 2922 | +# define SIGEV_THREAD SIGEV_THREAD |
| 2923 | + SIGEV_KEVENT = 3, |
| 2924 | +# define SIGEV_KEVENT SIGEV_KEVENT |
| 2925 | + SIGEV_THREAD_ID = 4, |
| 2926 | +# define SIGEV_THREAD_ID SIGEV_THREAD_ID |
| 2927 | +}; |
| 2928 | + |
| 2929 | +#endif /* have _SIGNAL_H. */ |
| 2930 | --- /dev/null |
| 2931 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/signum.h |
| 2932 | @@ -0,0 +1,84 @@ |
| 2933 | +/* Signal number definitions. FreeBSD version. |
| 2934 | + Copyright (C) 1991-1993, 1996, 1998, 2002 Free Software Foundation, Inc. |
| 2935 | + This file is part of the GNU C Library. |
| 2936 | + |
| 2937 | + The GNU C Library is free software; you can redistribute it and/or |
| 2938 | + modify it under the terms of the GNU Lesser General Public |
| 2939 | + License as published by the Free Software Foundation; either |
| 2940 | + version 2.1 of the License, or (at your option) any later version. |
| 2941 | + |
| 2942 | + The GNU C Library is distributed in the hope that it will be useful, |
| 2943 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 2944 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 2945 | + Lesser General Public License for more details. |
| 2946 | + |
| 2947 | + You should have received a copy of the GNU Lesser General Public |
| 2948 | + License along with the GNU C Library; if not, write to the Free |
| 2949 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 2950 | + 02111-1307 USA. */ |
| 2951 | + |
| 2952 | +#ifdef _SIGNAL_H |
| 2953 | + |
| 2954 | +/* This file defines the fake signal functions and signal |
| 2955 | + number constants for 4.2 or 4.3 BSD-derived Unix system. */ |
| 2956 | + |
| 2957 | +/* Fake signal functions. */ |
| 2958 | +#define SIG_ERR ((__sighandler_t) -1) /* Error return. */ |
| 2959 | +#define SIG_DFL ((__sighandler_t) 0) /* Default action. */ |
| 2960 | +#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ |
| 2961 | + |
| 2962 | +#define SIG_CATCH ((__sighandler_t) 2) /* FreeBSD specific ? */ |
| 2963 | +#define SIG_HOLD ((__sighandler_t) 3) /* Add signal to hold mask. */ |
| 2964 | + |
| 2965 | +/* Signals. */ |
| 2966 | +#define SIGHUP 1 /* Hangup (POSIX). */ |
| 2967 | +#define SIGINT 2 /* Interrupt (ANSI). */ |
| 2968 | +#define SIGQUIT 3 /* Quit (POSIX). */ |
| 2969 | +#define SIGILL 4 /* Illegal instruction (ANSI). */ |
| 2970 | +#define SIGABRT SIGIOT /* Abort (ANSI). */ |
| 2971 | +#define SIGTRAP 5 /* Trace trap (POSIX). */ |
| 2972 | +#define SIGIOT 6 /* IOT trap (4.2 BSD). */ |
| 2973 | +#define SIGEMT 7 /* EMT trap (4.2 BSD). */ |
| 2974 | +#define SIGFPE 8 /* Floating-point exception (ANSI). */ |
| 2975 | +#define SIGKILL 9 /* Kill, unblockable (POSIX). */ |
| 2976 | +#define SIGBUS 10 /* Bus error (4.2 BSD). */ |
| 2977 | +#define SIGSEGV 11 /* Segmentation violation (ANSI). */ |
| 2978 | +#define SIGSYS 12 /* Bad argument to system call (4.2 BSD). */ |
| 2979 | +#define SIGPIPE 13 /* Broken pipe (POSIX). */ |
| 2980 | +#define SIGALRM 14 /* Alarm clock (POSIX). */ |
| 2981 | +#define SIGTERM 15 /* Termination (ANSI). */ |
| 2982 | +#define SIGURG 16 /* Urgent condition on socket (4.2 BSD). */ |
| 2983 | +#define SIGSTOP 17 /* Stop, unblockable (POSIX). */ |
| 2984 | +#define SIGTSTP 18 /* Keyboard stop (POSIX). */ |
| 2985 | +#define SIGCONT 19 /* Continue (POSIX). */ |
| 2986 | +#define SIGCHLD 20 /* Child status has changed (POSIX). */ |
| 2987 | +#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ |
| 2988 | +#define SIGTTIN 21 /* Background read from tty (POSIX). */ |
| 2989 | +#define SIGTTOU 22 /* Background write to tty (POSIX). */ |
| 2990 | +#define SIGIO 23 /* I/O now possible (4.2 BSD). */ |
| 2991 | +#define SIGPOLL SIGIO /* Pollable event occurred (System V). */ |
| 2992 | +#define SIGXCPU 24 /* CPU limit exceeded (4.2 BSD). */ |
| 2993 | +#define SIGXFSZ 25 /* File size limit exceeded (4.2 BSD). */ |
| 2994 | +#define SIGVTALRM 26 /* Virtual alarm clock (4.2 BSD). */ |
| 2995 | +#define SIGPROF 27 /* Profiling alarm clock (4.2 BSD). */ |
| 2996 | +#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */ |
| 2997 | +#define SIGINFO 29 /* Information request (4.4 BSD). */ |
| 2998 | +#define SIGUSR1 30 /* User-defined signal 1 (POSIX). */ |
| 2999 | +#define SIGUSR2 31 /* User-defined signal 2 (POSIX). */ |
| 3000 | +/* Signals 32 and 33 are reserved for system libraries. */ |
| 3001 | + |
| 3002 | +/* Signal 34 is used (but not reserved) by thread library. |
| 3003 | + See PTHREAD_SIGBASE in kernel-features.h. */ |
| 3004 | + |
| 3005 | +#define _NSIG 129 /* Biggest signal number + 1 |
| 3006 | + (including real-time signals). */ |
| 3007 | + |
| 3008 | +#define SIGRTMIN (__libc_current_sigrtmin ()) |
| 3009 | +#define SIGRTMAX (__libc_current_sigrtmax ()) |
| 3010 | + |
| 3011 | +/* These are the hard limits of the kernel. These values should not be |
| 3012 | + used directly at user level. */ |
| 3013 | +#define __SIGRTMIN 65 /* be in sync with FreeBSD kernel */ |
| 3014 | +#define __SIGRTMAX 126 /* be in sync with FreeBSD kernel */ |
| 3015 | + |
| 3016 | +#endif /* <signal.h> included. */ |
| 3017 | --- /dev/null |
| 3018 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/sigset.h |
| 3019 | @@ -0,0 +1,140 @@ |
| 3020 | +/* __sig_atomic_t, __sigset_t, and related definitions. FreeBSD version. |
| 3021 | + Copyright (C) 1994-1996, 2002 Free Software Foundation, Inc. |
| 3022 | + This file is part of the GNU C Library. |
| 3023 | + |
| 3024 | + The GNU C Library is free software; you can redistribute it and/or |
| 3025 | + modify it under the terms of the GNU Lesser General Public |
| 3026 | + License as published by the Free Software Foundation; either |
| 3027 | + version 2.1 of the License, or (at your option) any later version. |
| 3028 | + |
| 3029 | + The GNU C Library is distributed in the hope that it will be useful, |
| 3030 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 3031 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 3032 | + Lesser General Public License for more details. |
| 3033 | + |
| 3034 | + You should have received a copy of the GNU Lesser General Public |
| 3035 | + License along with the GNU C Library; if not, write to the Free |
| 3036 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 3037 | + 02111-1307 USA. */ |
| 3038 | + |
| 3039 | +#ifndef _SIGSET_H_types |
| 3040 | +# define _SIGSET_H_types 1 |
| 3041 | + |
| 3042 | +typedef int __sig_atomic_t; |
| 3043 | + |
| 3044 | +/* A `sigset_t' has a bit for each signal. */ |
| 3045 | +__extension__ typedef struct |
| 3046 | + { |
| 3047 | + __extension__ union |
| 3048 | + { |
| 3049 | + unsigned int __sigbits[4]; |
| 3050 | + unsigned int __bits[4]; |
| 3051 | + }; |
| 3052 | + } __sigset_t; |
| 3053 | + |
| 3054 | +#endif |
| 3055 | + |
| 3056 | + |
| 3057 | +/* We only want to define these functions if <signal.h> was actually |
| 3058 | + included; otherwise we were included just to define the types. Since we |
| 3059 | + are namespace-clean, it wouldn't hurt to define extra macros. But |
| 3060 | + trouble can be caused by functions being defined (e.g., any global |
| 3061 | + register vars declared later will cause compilation errors). */ |
| 3062 | + |
| 3063 | +#if !defined _SIGSET_H_fns && defined _SIGNAL_H |
| 3064 | +# define _SIGSET_H_fns 1 |
| 3065 | + |
| 3066 | +# ifndef _EXTERN_INLINE |
| 3067 | +# define _EXTERN_INLINE __extern_inline |
| 3068 | +# endif |
| 3069 | + |
| 3070 | +/* Return a mask that includes the bit for SIG only. */ |
| 3071 | +# define __sigmask(sig) ((unsigned int) 1 << ((sig) - 1) % 32) |
| 3072 | + |
| 3073 | +/* Return the word index for SIG. */ |
| 3074 | +# define __sigword(sig) (((sig) - 1) >> 5) |
| 3075 | + |
| 3076 | +# if defined __GNUC__ && __GNUC__ >= 2 |
| 3077 | +# define __sigemptyset(set) \ |
| 3078 | + (__extension__ ({ sigset_t *__set = (set); \ |
| 3079 | + __set->__sigbits[0] = 0; __set->__sigbits[1] = 0; \ |
| 3080 | + __set->__sigbits[2] = 0; __set->__sigbits[3] = 0; \ |
| 3081 | + 0; })) |
| 3082 | +# define __sigfillset(set) \ |
| 3083 | + (__extension__ ({ sigset_t *__set = (set); \ |
| 3084 | + __set->__sigbits[0] = ~0; __set->__sigbits[1] = ~0; \ |
| 3085 | + __set->__sigbits[2] = ~0; __set->__sigbits[3] = ~0; \ |
| 3086 | + 0; })) |
| 3087 | + |
| 3088 | +# ifdef __USE_GNU |
| 3089 | +/* The POSIX does not specify for handling the whole signal set in one |
| 3090 | + command. This is often wanted and so we define three more functions |
| 3091 | + here. */ |
| 3092 | +# define __sigisemptyset(set) \ |
| 3093 | + (__extension__ ({ const sigset_t *__set = (set); \ |
| 3094 | + __set->__sigbits[0] == 0 \ |
| 3095 | + && __set->__sigbits[1] == 0 \ |
| 3096 | + && __set->__sigbits[2] == 0 \ |
| 3097 | + && __set->__sigbits[3] == 0; })) |
| 3098 | +# define __sigandset(dest, left, right) \ |
| 3099 | + (__extension__ ({ sigset_t *__dest = (dest); \ |
| 3100 | + const sigset_t *__left = (left); \ |
| 3101 | + const sigset_t *__right = (right); \ |
| 3102 | + __dest->__sigbits[0] = \ |
| 3103 | + __left->__sigbits[0] & __right->__sigbits[0]; \ |
| 3104 | + __dest->__sigbits[1] = \ |
| 3105 | + __left->__sigbits[1] & __right->__sigbits[1]; \ |
| 3106 | + __dest->__sigbits[2] = \ |
| 3107 | + __left->__sigbits[2] & __right->__sigbits[2]; \ |
| 3108 | + __dest->__sigbits[3] = \ |
| 3109 | + __left->__sigbits[3] & __right->__sigbits[3]; \ |
| 3110 | + 0; })) |
| 3111 | +# define __sigorset(dest, left, right) \ |
| 3112 | + (__extension__ ({ sigset_t *__dest = (dest); \ |
| 3113 | + const sigset_t *__left = (left); \ |
| 3114 | + const sigset_t *__right = (right); \ |
| 3115 | + __dest->__sigbits[0] = \ |
| 3116 | + __left->__sigbits[0] | __right->__sigbits[0]; \ |
| 3117 | + __dest->__sigbits[1] = \ |
| 3118 | + __left->__sigbits[1] | __right->__sigbits[1]; \ |
| 3119 | + __dest->__sigbits[2] = \ |
| 3120 | + __left->__sigbits[2] | __right->__sigbits[2]; \ |
| 3121 | + __dest->__sigbits[3] = \ |
| 3122 | + __left->__sigbits[3] | __right->__sigbits[3]; \ |
| 3123 | + 0; })) |
| 3124 | +# endif |
| 3125 | +# endif |
| 3126 | + |
| 3127 | +/* These functions needn't check for a bogus signal number -- error |
| 3128 | + checking is done in the non __ versions. */ |
| 3129 | + |
| 3130 | +extern int __sigismember (__const __sigset_t *, int); |
| 3131 | +extern int __sigaddset (__sigset_t *, int); |
| 3132 | +extern int __sigdelset (__sigset_t *, int); |
| 3133 | + |
| 3134 | +# ifdef __USE_EXTERN_INLINES |
| 3135 | + |
| 3136 | +_EXTERN_INLINE int |
| 3137 | +__sigismember (__const __sigset_t *__set, int __sig) |
| 3138 | +{ |
| 3139 | + return (__set->__sigbits[__sigword (__sig)] & __sigmask (__sig) ? 1 : 0); |
| 3140 | +} |
| 3141 | + |
| 3142 | +_EXTERN_INLINE int |
| 3143 | +__sigaddset (__sigset_t *__set, int __sig) |
| 3144 | +{ |
| 3145 | + __set->__sigbits[__sigword (__sig)] |= __sigmask (__sig); |
| 3146 | + return 0; |
| 3147 | +} |
| 3148 | + |
| 3149 | +_EXTERN_INLINE int |
| 3150 | +__sigdelset (__sigset_t *__set, int __sig) |
| 3151 | +{ |
| 3152 | + __set->__sigbits[__sigword (__sig)] &= ~__sigmask (__sig); |
| 3153 | + return 0; |
| 3154 | +} |
| 3155 | + |
| 3156 | +# endif |
| 3157 | + |
| 3158 | + |
| 3159 | +#endif /* ! _SIGSET_H_fns. */ |
| 3160 | --- /dev/null |
| 3161 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/socket.h |
| 3162 | @@ -0,0 +1,397 @@ |
| 3163 | +/* System-specific socket constants and types. FreeBSD version. |
| 3164 | + Copyright (C) 1991-1992,1994-1999,2000-2002 Free Software Foundation, Inc. |
| 3165 | + This file is part of the GNU C Library. |
| 3166 | + |
| 3167 | + The GNU C Library is free software; you can redistribute it and/or |
| 3168 | + modify it under the terms of the GNU Library General Public License as |
| 3169 | + published by the Free Software Foundation; either version 2 of the |
| 3170 | + License, or (at your option) any later version. |
| 3171 | + |
| 3172 | + The GNU C Library is distributed in the hope that it will be useful, |
| 3173 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 3174 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 3175 | + Library General Public License for more details. |
| 3176 | + |
| 3177 | + You should have received a copy of the GNU Library General Public |
| 3178 | + License along with the GNU C Library; see the file COPYING.LIB. If not, |
| 3179 | + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 3180 | + Boston, MA 02111-1307, USA. */ |
| 3181 | + |
| 3182 | +#ifndef __BITS_SOCKET_H |
| 3183 | +#define __BITS_SOCKET_H 1 |
| 3184 | + |
| 3185 | +#if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H |
| 3186 | +# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead." |
| 3187 | +#endif |
| 3188 | + |
| 3189 | +#define __need_size_t |
| 3190 | +#define __need_NULL |
| 3191 | +#include <stddef.h> |
| 3192 | + |
| 3193 | +#include <limits.h> /* XXX Is this allowed? */ |
| 3194 | +#include <bits/types.h> |
| 3195 | + |
| 3196 | +/* Type for length arguments in socket calls. */ |
| 3197 | +#ifndef __socklen_t_defined |
| 3198 | +typedef __socklen_t socklen_t; |
| 3199 | +# define __socklen_t_defined |
| 3200 | +#endif |
| 3201 | + |
| 3202 | + |
| 3203 | +/* Types of sockets. */ |
| 3204 | +enum __socket_type |
| 3205 | +{ |
| 3206 | + SOCK_STREAM = 1, /* Sequenced, reliable, connection-based |
| 3207 | + byte streams. */ |
| 3208 | +#define SOCK_STREAM SOCK_STREAM |
| 3209 | + SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams |
| 3210 | + of fixed maximum length. */ |
| 3211 | +#define SOCK_DGRAM SOCK_DGRAM |
| 3212 | + SOCK_RAW = 3, /* Raw protocol interface. */ |
| 3213 | +#define SOCK_RAW SOCK_RAW |
| 3214 | + SOCK_RDM = 4, /* Reliably-delivered messages. */ |
| 3215 | +#define SOCK_RDM SOCK_RDM |
| 3216 | + SOCK_SEQPACKET = 5 /* Sequenced, reliable, connection-based, |
| 3217 | + datagrams of fixed maximum length. */ |
| 3218 | +#define SOCK_SEQPACKET SOCK_SEQPACKET |
| 3219 | +}; |
| 3220 | + |
| 3221 | +/* |
| 3222 | + * Structure used by kernel to pass protocol |
| 3223 | + * information in raw sockets. |
| 3224 | + */ |
| 3225 | +struct sockproto { |
| 3226 | + unsigned short sp_family; /* address family */ |
| 3227 | + unsigned short sp_protocol; /* protocol */ |
| 3228 | +}; |
| 3229 | + |
| 3230 | +/* Protocol families. */ |
| 3231 | +#define PF_UNSPEC 0 /* Unspecified. */ |
| 3232 | +#define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ |
| 3233 | +#define PF_UNIX PF_LOCAL /* Old BSD name for PF_LOCAL. */ |
| 3234 | +#define PF_FILE PF_LOCAL /* POSIX name for PF_LOCAL. */ |
| 3235 | +#define PF_INET 2 /* IP protocol family. */ |
| 3236 | +#define PF_IMPLINK 3 /* ARPAnet IMP protocol. */ |
| 3237 | +#define PF_PUP 4 /* PUP protocols. */ |
| 3238 | +#define PF_CHAOS 5 /* MIT Chaos protocols. */ |
| 3239 | +#define PF_NETBIOS 6 /* SMB protocols. */ |
| 3240 | +#define PF_ISO 7 /* ISO protocols. */ |
| 3241 | +#define PF_OSI PF_ISO |
| 3242 | +#define PF_ECMA 8 /* ECMA protocols. */ |
| 3243 | +#define PF_DATAKIT 9 /* AT&T Datakit protocols. */ |
| 3244 | +#define PF_CCITT 10 /* CCITT protocols (X.25 et al). */ |
| 3245 | +#define PF_SNA 11 /* IBM SNA protocol. */ |
| 3246 | +#define PF_DECnet 12 /* DECnet protocols. */ |
| 3247 | +#define PF_DLI 13 /* Direct data link interface. */ |
| 3248 | +#define PF_LAT 14 /* DEC Local Area Transport protocol. */ |
| 3249 | +#define PF_HYLINK 15 /* NSC Hyperchannel protocol. */ |
| 3250 | +#define PF_APPLETALK 16 /* Don't use this. */ |
| 3251 | +#define PF_ROUTE 17 /* Internal Routing Protocol. */ |
| 3252 | +#define PF_LINK 18 /* Link layer interface. */ |
| 3253 | +#define PF_XTP 19 /* eXpress Transfer Protocol (no AF). */ |
| 3254 | +#define PF_COIP 20 /* Connection-oriented IP, aka ST II. */ |
| 3255 | +#define PF_CNT 21 /* Computer Network Technology. */ |
| 3256 | +#define PF_RTIP 22 /* Help Identify RTIP packets. **/ |
| 3257 | +#define PF_IPX 23 /* Novell Internet Protocol. */ |
| 3258 | +#define PF_SIP 24 /* Simple Internet Protocol. */ |
| 3259 | +#define PF_PIP 25 /* Help Identify PIP packets. */ |
| 3260 | +#define PF_ISDN 26 /* Integrated Services Digital Network. */ |
| 3261 | +#define PF_KEY 27 /* Internal key-management function. */ |
| 3262 | +#define PF_INET6 28 /* IP version 6. */ |
| 3263 | +#define PF_NATM 29 /* Native ATM access. */ |
| 3264 | +#define PF_ATM 30 /* ATM. */ |
| 3265 | +#define PF_HDRCMPLT 31 /* Used by BPF to not rewrite headers in |
| 3266 | + interface output routine. */ |
| 3267 | +#define PF_NETGRAPH 32 /* Netgraph sockets. */ |
| 3268 | +#define PF_MAX 33 |
| 3269 | + |
| 3270 | +/* Address families. */ |
| 3271 | +#define AF_UNSPEC PF_UNSPEC |
| 3272 | +#define AF_LOCAL PF_LOCAL |
| 3273 | +#define AF_UNIX PF_UNIX |
| 3274 | +#define AF_FILE PF_FILE |
| 3275 | +#define AF_INET PF_INET |
| 3276 | +#define AF_IMPLINK PF_IMPLINK |
| 3277 | +#define AF_PUP PF_PUP |
| 3278 | +#define AF_CHAOS PF_CHAOS |
| 3279 | +#define AF_NETBIOS PF_NETBIOS |
| 3280 | +#define AF_ISO PF_ISO |
| 3281 | +#define AF_OSI PF_OSI |
| 3282 | +#define AF_ECMA PF_ECMA |
| 3283 | +#define AF_DATAKIT PF_DATAKIT |
| 3284 | +#define AF_CCITT PF_CCITT |
| 3285 | +#define AF_SNA PF_SNA |
| 3286 | +#define AF_DECnet PF_DECnet |
| 3287 | +#define AF_DLI PF_DLI |
| 3288 | +#define AF_LAT PF_LAT |
| 3289 | +#define AF_HYLINK PF_HYLINK |
| 3290 | +#define AF_APPLETALK PF_APPLETALK |
| 3291 | +#define AF_ROUTE PF_ROUTE |
| 3292 | +#define AF_LINK PF_LINK |
| 3293 | +#define pseudo_AF_XTP PF_XTP |
| 3294 | +#define AF_COIP PF_COIP |
| 3295 | +#define AF_CNT PF_CNT |
| 3296 | +#define pseudo_AF_RTIP PF_RTIP |
| 3297 | +#define AF_IPX PF_IPX |
| 3298 | +#define AF_SIP PF_SIP |
| 3299 | +#define pseudo_AF_PIP PF_PIP |
| 3300 | +#define AF_ISDN PF_ISDN |
| 3301 | +#define AF_E164 AF_ISDN /* CCITT E.164 recommendation. */ |
| 3302 | +#define pseudo_AF_KEY PF_KEY |
| 3303 | +#define AF_INET6 PF_INET6 |
| 3304 | +#define AF_NATM PF_NATM |
| 3305 | +#define AF_ATM PF_ATM |
| 3306 | +#define pseudo_AF_HDRCMPLT PF_HDRCMPLT |
| 3307 | +#define AF_NETGRAPH PF_NETGRAPH |
| 3308 | +#define AF_MAX PF_MAX |
| 3309 | + |
| 3310 | +/* Maximum queue length specifiable by listen. */ |
| 3311 | +#define SOMAXCONN 128 /* 5 on the original 4.4 BSD. */ |
| 3312 | + |
| 3313 | +/* Get the definition of the macro to define the common sockaddr members. */ |
| 3314 | +#include <bits/sockaddr.h> |
| 3315 | + |
| 3316 | +/* Structure describing a generic socket address. */ |
| 3317 | +struct sockaddr |
| 3318 | + { |
| 3319 | + __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ |
| 3320 | + char sa_data[14]; /* Address data. */ |
| 3321 | + }; |
| 3322 | + |
| 3323 | + |
| 3324 | +/* Structure large enough to hold any socket address (with the historical |
| 3325 | + exception of AF_UNIX). We reserve 128 bytes. */ |
| 3326 | +#if ULONG_MAX > 0xffffffff |
| 3327 | +# define __ss_aligntype __uint64_t |
| 3328 | +#else |
| 3329 | +# define __ss_aligntype __uint32_t |
| 3330 | +#endif |
| 3331 | +#define _SS_SIZE 128 |
| 3332 | +#define _SS_PADSIZE (_SS_SIZE - (2 * sizeof (__ss_aligntype))) |
| 3333 | + |
| 3334 | +struct sockaddr_storage |
| 3335 | + { |
| 3336 | + __SOCKADDR_COMMON (ss_); /* Address family, etc. */ |
| 3337 | + __ss_aligntype __ss_align; /* Force desired alignment. */ |
| 3338 | + char __ss_padding[_SS_PADSIZE]; |
| 3339 | + }; |
| 3340 | + |
| 3341 | + |
| 3342 | +/* Bits in the FLAGS argument to `send', `recv', et al. */ |
| 3343 | +enum |
| 3344 | + { |
| 3345 | + MSG_OOB = 0x01, /* Process out-of-band data. */ |
| 3346 | +#define MSG_OOB MSG_OOB |
| 3347 | + MSG_PEEK = 0x02, /* Peek at incoming messages. */ |
| 3348 | +#define MSG_PEEK MSG_PEEK |
| 3349 | + MSG_DONTROUTE = 0x04, /* Don't use local routing. */ |
| 3350 | +#define MSG_DONTROUTE MSG_DONTROUTE |
| 3351 | + MSG_EOR = 0x08, /* Data completes record. */ |
| 3352 | +#define MSG_EOR MSG_EOR |
| 3353 | + MSG_TRUNC = 0x10, /* Data discarded before delivery. */ |
| 3354 | +#define MSG_TRUNC MSG_TRUNC |
| 3355 | + MSG_CTRUNC = 0x20, /* Control data lost before delivery. */ |
| 3356 | +#define MSG_CTRUNC MSG_CTRUNC |
| 3357 | + MSG_WAITALL = 0x40, /* Wait for full request or error. */ |
| 3358 | +#define MSG_WAITALL MSG_WAITALL |
| 3359 | + MSG_DONTWAIT = 0x80, /* This message should be nonblocking. */ |
| 3360 | +#define MSG_DONTWAIT MSG_DONTWAIT |
| 3361 | + MSG_EOF = 0x100, /* Data completes connection. */ |
| 3362 | +#define MSG_EOF MSG_EOF |
| 3363 | + MSG_NOTIFICATION = 0x2000,/* SCTP notification */ |
| 3364 | +#define MSG_NOTIFICATION MSG_NOTIFICATION |
| 3365 | + MSG_NBIO = 0x4000,/*FIONBIO mode, used by fifofs */ |
| 3366 | +#define MSG_NBIO MSG_NBIO |
| 3367 | + MSG_COMPAT = 0x8000,/* Used in sendit(). */ |
| 3368 | +#define MSG_COMPAT MSG_COMPAT |
| 3369 | + MSG_NOSIGNAL = 0x20000 /* do not generate SIGPIPE on EOF */ |
| 3370 | +#define MSG_NOSIGNAL MSG_NOSIGNAL |
| 3371 | + }; |
| 3372 | + |
| 3373 | + |
| 3374 | +/* Structure describing messages sent by |
| 3375 | + `sendmsg' and received by `recvmsg'. */ |
| 3376 | +struct msghdr |
| 3377 | + { |
| 3378 | + void *msg_name; /* Address to send to/receive from. */ |
| 3379 | + socklen_t msg_namelen; /* Length of address data. */ |
| 3380 | + |
| 3381 | + struct iovec *msg_iov; /* Vector of data to send/receive into. */ |
| 3382 | + int msg_iovlen; /* Number of elements in the vector. */ |
| 3383 | + |
| 3384 | + void *msg_control; /* Ancillary data (eg BSD filedesc passing). */ |
| 3385 | + socklen_t msg_controllen; /* Ancillary data buffer length. */ |
| 3386 | + |
| 3387 | + int msg_flags; /* Flags in received message. */ |
| 3388 | + }; |
| 3389 | + |
| 3390 | +/* Structure used for storage of ancillary data object information. */ |
| 3391 | +struct cmsghdr |
| 3392 | + { |
| 3393 | + socklen_t cmsg_len; /* Length of data in cmsg_data plus length |
| 3394 | + of cmsghdr structure. */ |
| 3395 | + int cmsg_level; /* Originating protocol. */ |
| 3396 | + int cmsg_type; /* Protocol specific type. */ |
| 3397 | +#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L |
| 3398 | + __extension__ unsigned char __cmsg_data __flexarr __attribute__ ((aligned (__alignof__(size_t)))); /* Ancillary data. */ |
| 3399 | +#endif |
| 3400 | + }; |
| 3401 | + |
| 3402 | +#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg) |
| 3403 | + |
| 3404 | +#define CMSG_FIRSTHDR(mhdr) \ |
| 3405 | + ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \ |
| 3406 | + ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL) |
| 3407 | + |
| 3408 | +#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \ |
| 3409 | + & (size_t) ~(sizeof (size_t) - 1)) |
| 3410 | +#define CMSG_SPACE(len) (CMSG_ALIGN (len) \ |
| 3411 | + + CMSG_ALIGN (sizeof (struct cmsghdr))) |
| 3412 | +#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len)) |
| 3413 | + |
| 3414 | +/* Ancillary data object manipulation macros. */ |
| 3415 | +#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L |
| 3416 | +# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data) |
| 3417 | +#else |
| 3418 | +# define CMSG_DATA(cmsg) ((unsigned char *) (cmsg) + CMSG_ALIGN(sizeof (struct cmsghdr))) |
| 3419 | +#endif |
| 3420 | + |
| 3421 | +extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr, |
| 3422 | + struct cmsghdr *__cmsg) __THROW; |
| 3423 | +#ifdef __USE_EXTERN_INLINES |
| 3424 | +# ifndef _EXTERN_INLINE |
| 3425 | +# define _EXTERN_INLINE __extern_inline |
| 3426 | +# endif |
| 3427 | +_EXTERN_INLINE struct cmsghdr * |
| 3428 | +__NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) |
| 3429 | +{ |
| 3430 | + if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr)) |
| 3431 | + /* The kernel header does this so there may be a reason. */ |
| 3432 | + return 0; |
| 3433 | + |
| 3434 | + __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg |
| 3435 | + + CMSG_ALIGN (__cmsg->cmsg_len)); |
| 3436 | + if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control |
| 3437 | + + __mhdr->msg_controllen) |
| 3438 | + || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len) |
| 3439 | + > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen))) |
| 3440 | + /* No more entries. */ |
| 3441 | + return 0; |
| 3442 | + return __cmsg; |
| 3443 | +} |
| 3444 | +#endif /* Use `extern inline'. */ |
| 3445 | + |
| 3446 | +/* Socket level message types. */ |
| 3447 | +enum |
| 3448 | + { |
| 3449 | + SCM_RIGHTS = 0x01, /* Access rights (array of int). */ |
| 3450 | +#define SCM_RIGHTS SCM_RIGHTS |
| 3451 | + SCM_TIMESTAMP = 0x02, /* Timestamp (struct timeval). */ |
| 3452 | +#define SCM_TIMESTAMP SCM_TIMESTAMP |
| 3453 | + SCM_CREDS = 0x03 /* Process creds (struct cmsgcred). */ |
| 3454 | +#define SCM_CREDS SCM_CREDS |
| 3455 | + }; |
| 3456 | + |
| 3457 | +/* Unfortunately, BSD practice dictates this structure be of fixed size. |
| 3458 | + If there are more than CMGROUP_MAX groups, the list is truncated. |
| 3459 | + (On GNU systems, the `cmcred_euid' field is just the first in the |
| 3460 | + list of effective UIDs.) */ |
| 3461 | +#define CMGROUP_MAX 16 |
| 3462 | + |
| 3463 | +/* Structure delivered by SCM_CREDS. This describes the identity of the |
| 3464 | + sender of the data simultaneously received on the socket. By BSD |
| 3465 | + convention, this is included only when a sender on a AF_LOCAL socket |
| 3466 | + sends cmsg data of this type and size; the sender's structure is |
| 3467 | + ignored, and the system fills in the various IDs of the sender process. */ |
| 3468 | +struct cmsgcred |
| 3469 | + { |
| 3470 | + __pid_t cmcred_pid; |
| 3471 | + __uid_t cmcred_uid; |
| 3472 | + __uid_t cmcred_euid; |
| 3473 | + __gid_t cmcred_gid; |
| 3474 | + short cmcred_ngroups; |
| 3475 | + __gid_t cmcred_groups[CMGROUP_MAX]; |
| 3476 | + }; |
| 3477 | + |
| 3478 | +/* Protocol number used to manipulate socket-level options |
| 3479 | + with `getsockopt' and `setsockopt'. */ |
| 3480 | +#define SOL_SOCKET 0xffff |
| 3481 | + |
| 3482 | +/* Socket-level options for `getsockopt' and `setsockopt'. */ |
| 3483 | +enum |
| 3484 | + { |
| 3485 | + SO_DEBUG = 0x0001, /* Record debugging information. */ |
| 3486 | +#define SO_DEBUG SO_DEBUG |
| 3487 | + SO_ACCEPTCONN = 0x0002, /* Accept connections on socket. */ |
| 3488 | +#define SO_ACCEPTCONN SO_ACCEPTCONN |
| 3489 | + SO_REUSEADDR = 0x0004, /* Allow reuse of local addresses. */ |
| 3490 | +#define SO_REUSEADDR SO_REUSEADDR |
| 3491 | + SO_KEEPALIVE = 0x0008, /* Keep connections alive and send |
| 3492 | + SIGPIPE when they die. */ |
| 3493 | +#define SO_KEEPALIVE SO_KEEPALIVE |
| 3494 | + SO_DONTROUTE = 0x0010, /* Don't do local routing. */ |
| 3495 | +#define SO_DONTROUTE SO_DONTROUTE |
| 3496 | + SO_BROADCAST = 0x0020, /* Allow transmission of |
| 3497 | + broadcast messages. */ |
| 3498 | +#define SO_BROADCAST SO_BROADCAST |
| 3499 | + SO_USELOOPBACK = 0x0040, /* Use the software loopback to avoid |
| 3500 | + hardware use when possible. */ |
| 3501 | +#define SO_USELOOPBACK SO_USELOOPBACK |
| 3502 | + SO_LINGER = 0x0080, /* Block on close of a reliable |
| 3503 | + socket to transmit pending data. */ |
| 3504 | +#define SO_LINGER SO_LINGER |
| 3505 | + SO_OOBINLINE = 0x0100, /* Receive out-of-band data in-band. */ |
| 3506 | +#define SO_OOBINLINE SO_OOBINLINE |
| 3507 | + SO_REUSEPORT = 0x0200, /* Allow local address and port reuse. */ |
| 3508 | +#define SO_REUSEPORT SO_REUSEPORT |
| 3509 | + SO_TIMESTAMP = 0x0400, /* Timestamp received dgram traffic. */ |
| 3510 | +#define SO_TIMESTAMP SO_TIMESTAMP |
| 3511 | + SO_SNDBUF = 0x1001, /* Send buffer size. */ |
| 3512 | +#define SO_SNDBUF SO_SNDBUF |
| 3513 | + SO_RCVBUF = 0x1002, /* Receive buffer. */ |
| 3514 | +#define SO_RCVBUF SO_RCVBUF |
| 3515 | + SO_SNDLOWAT = 0x1003, /* Send low-water mark. */ |
| 3516 | +#define SO_SNDLOWAT SO_SNDLOWAT |
| 3517 | + SO_RCVLOWAT = 0x1004, /* Receive low-water mark. */ |
| 3518 | +#define SO_RCVLOWAT SO_RCVLOWAT |
| 3519 | + SO_SNDTIMEO = 0x1005, /* Send timeout. */ |
| 3520 | +#define SO_SNDTIMEO SO_SNDTIMEO |
| 3521 | + SO_RCVTIMEO = 0x1006, /* Receive timeout. */ |
| 3522 | +#define SO_RCVTIMEO SO_RCVTIMEO |
| 3523 | + SO_ERROR = 0x1007, /* Get and clear error status. */ |
| 3524 | +#define SO_ERROR SO_ERROR |
| 3525 | + SO_STYLE = 0x1008, /* Get socket connection style. */ |
| 3526 | +#define SO_STYLE SO_STYLE |
| 3527 | + SO_TYPE = SO_STYLE /* Compatible name for SO_STYLE. */ |
| 3528 | +#define SO_TYPE SO_TYPE |
| 3529 | + }; |
| 3530 | + |
| 3531 | +/* Socket options. */ |
| 3532 | +#define LOCAL_PEERCRED 0x001 /* retrieve peer credentials */ |
| 3533 | +#define LOCAL_CREDS 0x002 /* pass credentials to receiver */ |
| 3534 | +#define LOCAL_CONNWAIT 0x004 /* connects block until accepted */ |
| 3535 | + |
| 3536 | +/* Structure used to manipulate the SO_LINGER option. */ |
| 3537 | +struct linger |
| 3538 | + { |
| 3539 | + int l_onoff; /* Nonzero to linger on close. */ |
| 3540 | + int l_linger; /* Time to linger. */ |
| 3541 | + }; |
| 3542 | + |
| 3543 | + |
| 3544 | +#ifdef __USE_BSD |
| 3545 | + |
| 3546 | +struct sf_hdtr; |
| 3547 | + |
| 3548 | +__BEGIN_DECLS |
| 3549 | + |
| 3550 | +extern int bsd_sendfile (int __in_fd, int __out_sock, |
| 3551 | + __off_t __in_offset, size_t __nbytes, |
| 3552 | + struct sf_hdtr *__hdtr, __off_t *__sockbytes, |
| 3553 | + int __flags) __THROW; |
| 3554 | + |
| 3555 | +__END_DECLS |
| 3556 | + |
| 3557 | +#endif /* Use BSD */ |
| 3558 | + |
| 3559 | +#endif /* bits/socket.h */ |
| 3560 | --- /dev/null |
| 3561 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/stat.h |
| 3562 | @@ -0,0 +1,219 @@ |
| 3563 | +/* Copyright (C) 1992, 1996-1997, 2000, 2002 Free Software Foundation, Inc. |
| 3564 | + This file is part of the GNU C Library. |
| 3565 | + |
| 3566 | + The GNU C Library is free software; you can redistribute it and/or |
| 3567 | + modify it under the terms of the GNU Lesser General Public |
| 3568 | + License as published by the Free Software Foundation; either |
| 3569 | + version 2.1 of the License, or (at your option) any later version. |
| 3570 | + |
| 3571 | + The GNU C Library is distributed in the hope that it will be useful, |
| 3572 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 3573 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 3574 | + Lesser General Public License for more details. |
| 3575 | + |
| 3576 | + You should have received a copy of the GNU Lesser General Public |
| 3577 | + License along with the GNU C Library; if not, write to the Free |
| 3578 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 3579 | + 02111-1307 USA. */ |
| 3580 | + |
| 3581 | +#if !defined _SYS_STAT_H && !defined _FCNTL_H |
| 3582 | +# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." |
| 3583 | +#endif |
| 3584 | + |
| 3585 | +#ifndef _BITS_STAT_H |
| 3586 | +#define _BITS_STAT_H 1 |
| 3587 | + |
| 3588 | +/* This structure needs to be defined in accordance with the |
| 3589 | + implementation of __stat, __fstat, and __lstat. */ |
| 3590 | + |
| 3591 | +#include <bits/types.h> |
| 3592 | + |
| 3593 | +/* Versions of the 'struct stat' data structure. */ |
| 3594 | +#define _STAT_VER_ostat 0 /* 'struct ostat' in /usr/src/sys/sys/stat.h */ |
| 3595 | +#define _STAT_VER_stat 1 /* 'struct stat' in /usr/src/sys/sys/stat.h */ |
| 3596 | +#define _STAT_VER_nstat 2 /* 'struct nstat' in /usr/src/sys/sys/stat.h */ |
| 3597 | +#define _STAT_VER_gstat 3 /* glibc's 'struct stat' without LFS */ |
| 3598 | +/* By default we use _STAT_VER_gstat, but we support also _STAT_VER_stat */ |
| 3599 | +#define _STAT_VER _STAT_VER_gstat |
| 3600 | + |
| 3601 | +/* Structure describing file characteristics. */ |
| 3602 | +struct stat |
| 3603 | + { |
| 3604 | + __dev_t st_dev; /* Device containing the file. */ |
| 3605 | +#ifndef __USE_FILE_OFFSET64 |
| 3606 | + __ino_t st_ino; /* File serial number. */ |
| 3607 | +#else |
| 3608 | + __ino64_t st_ino; /* File serial number. */ |
| 3609 | +#endif |
| 3610 | + |
| 3611 | + __mode_t st_mode; /* File mode. */ |
| 3612 | + __mode_t __pad_mode; /* __mode_t is 16 bit, fill to 32 bit to retain previous ABI */ |
| 3613 | + __nlink_t st_nlink; /* Link count. */ |
| 3614 | + __nlink_t __pad_nlink; /* __nlink_t is 16 bit, fill to 32 bit to retain previous ABI */ |
| 3615 | + |
| 3616 | + __uid_t st_uid; /* User ID of the file's owner. */ |
| 3617 | + __gid_t st_gid; /* Group ID of the file's group. */ |
| 3618 | + |
| 3619 | + __dev_t st_rdev; /* Device number, if device. */ |
| 3620 | + |
| 3621 | +#if defined __USE_MISC || defined __USE_XOPEN2K8 |
| 3622 | + /* Nanosecond resolution timestamps are stored in a format |
| 3623 | + equivalent to 'struct timespec'. This is the type used |
| 3624 | + whenever possible but the Unix namespace rules do not allow the |
| 3625 | + identifier 'timespec' to appear in the <sys/stat.h> header. |
| 3626 | + Therefore we have to handle the use of this header in strictly |
| 3627 | + standard-compliant sources special. */ |
| 3628 | + struct timespec st_atim; /* Time of last access. */ |
| 3629 | + struct timespec st_mtim; /* Time of last modification. */ |
| 3630 | + struct timespec st_ctim; /* Time of last status change. */ |
| 3631 | +# define st_atime st_atim.tv_sec /* Backward compatibility. */ |
| 3632 | +# define st_mtime st_mtim.tv_sec |
| 3633 | +# define st_ctime st_ctim.tv_sec |
| 3634 | +#else |
| 3635 | + __time_t st_atime; /* Time of last access. */ |
| 3636 | + long int st_atimensec; /* Nanoseconds of last access. */ |
| 3637 | + __time_t st_mtime; /* Time of last modification. */ |
| 3638 | + long int st_mtimensec; /* Nanoseconds of last modification. */ |
| 3639 | + __time_t st_ctime; /* Time of last status change. */ |
| 3640 | + long int st_ctimensec; /* Nanoseconds of last status change. */ |
| 3641 | +#endif |
| 3642 | + |
| 3643 | + __off_t st_size; /* Size of file, in bytes. */ |
| 3644 | + |
| 3645 | + __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */ |
| 3646 | + |
| 3647 | + __blksize_t st_blksize; /* Optimal block size for I/O. */ |
| 3648 | +#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */ |
| 3649 | + |
| 3650 | + __uint32_t st_flags; /* User defined flags. */ |
| 3651 | + |
| 3652 | + __uint32_t st_gen; /* Generation number. */ |
| 3653 | + |
| 3654 | + __quad_t __unused1[2]; |
| 3655 | + }; |
| 3656 | + |
| 3657 | +#ifdef __USE_LARGEFILE64 |
| 3658 | +struct stat64 |
| 3659 | + { |
| 3660 | + __dev_t st_dev; /* Device containing the file. */ |
| 3661 | + __ino64_t st_ino; /* File serial number. */ |
| 3662 | + |
| 3663 | + __mode_t st_mode; /* File mode. */ |
| 3664 | + __mode_t __pad_mode; /* __mode_t is 16 bit, fill to 32 bit to retain previous ABI */ |
| 3665 | + __nlink_t st_nlink; /* Link count. */ |
| 3666 | + __nlink_t __pad_nlink; /* __nlink_t is 16 bit, fill to 32 bit to retain previous ABI */ |
| 3667 | + |
| 3668 | + __uid_t st_uid; /* User ID of the file's owner. */ |
| 3669 | + __gid_t st_gid; /* Group ID of the file's group. */ |
| 3670 | + |
| 3671 | + __dev_t st_rdev; /* Device number, if device. */ |
| 3672 | + |
| 3673 | +#if defined __USE_MISC || defined __USE_XOPEN2K8 |
| 3674 | + /* Nanosecond resolution timestamps are stored in a format |
| 3675 | + equivalent to 'struct timespec'. This is the type used |
| 3676 | + whenever possible but the Unix namespace rules do not allow the |
| 3677 | + identifier 'timespec' to appear in the <sys/stat.h> header. |
| 3678 | + Therefore we have to handle the use of this header in strictly |
| 3679 | + standard-compliant sources special. */ |
| 3680 | + struct timespec st_atim; /* Time of last access. */ |
| 3681 | + struct timespec st_mtim; /* Time of last modification. */ |
| 3682 | + struct timespec st_ctim; /* Time of last status change. */ |
| 3683 | +# define st_atime st_atim.tv_sec /* Backward compatibility. */ |
| 3684 | +# define st_mtime st_mtim.tv_sec |
| 3685 | +# define st_ctime st_ctim.tv_sec |
| 3686 | +#else |
| 3687 | + __time_t st_atime; /* Time of last access. */ |
| 3688 | + long int st_atimensec; /* Nanoseconds of last access. */ |
| 3689 | + __time_t st_mtime; /* Time of last modification. */ |
| 3690 | + long int st_mtimensec; /* Nanoseconds of last modification. */ |
| 3691 | + __time_t st_ctime; /* Time of last status change. */ |
| 3692 | + long int st_ctimensec; /* Nanoseconds of last status change. */ |
| 3693 | +#endif |
| 3694 | + |
| 3695 | + __off_t st_size; /* Size of file, in bytes. */ |
| 3696 | + |
| 3697 | + __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */ |
| 3698 | + |
| 3699 | + __blksize_t st_blksize; /* Optimal block size for I/O. */ |
| 3700 | + |
| 3701 | + __uint32_t st_flags; /* User defined flags. */ |
| 3702 | + |
| 3703 | + __uint32_t st_gen; /* Generation number. */ |
| 3704 | + |
| 3705 | + __quad_t __unused1[2]; |
| 3706 | + }; |
| 3707 | +#endif |
| 3708 | + |
| 3709 | +/* Encoding of the file mode. These are the standard Unix values, |
| 3710 | + but POSIX.1 does not specify what values should be used. */ |
| 3711 | + |
| 3712 | +#define __S_IFMT 0170000 /* These bits determine file type. */ |
| 3713 | + |
| 3714 | +/* File types. */ |
| 3715 | +#define __S_IFDIR 0040000 /* Directory. */ |
| 3716 | +#define __S_IFCHR 0020000 /* Character device. */ |
| 3717 | +#define __S_IFBLK 0060000 /* Block device. */ |
| 3718 | +#define __S_IFREG 0100000 /* Regular file. */ |
| 3719 | +#define __S_IFLNK 0120000 /* Symbolic link. */ |
| 3720 | +#define __S_IFSOCK 0140000 /* Socket. */ |
| 3721 | +#define __S_IFWHT 0160000 /* Whiteout. */ |
| 3722 | +#define __S_IFIFO 0010000 /* FIFO. */ |
| 3723 | + |
| 3724 | +/* POSIX.1b objects. */ |
| 3725 | +#define __S_TYPEISMQ(buf) 0 |
| 3726 | +#define __S_TYPEISSEM(buf) 0 |
| 3727 | +#define __S_TYPEISSHM(buf) 0 |
| 3728 | + |
| 3729 | +/* Protection bits. */ |
| 3730 | + |
| 3731 | +#define __S_ISUID 04000 /* Set user ID on execution. */ |
| 3732 | +#define __S_ISGID 02000 /* Set group ID on execution. */ |
| 3733 | +#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ |
| 3734 | +#define __S_IREAD 0400 /* Read by owner. */ |
| 3735 | +#define __S_IWRITE 0200 /* Write by owner. */ |
| 3736 | +#define __S_IEXEC 0100 /* Execute by owner. */ |
| 3737 | + |
| 3738 | +#ifdef __USE_BSD |
| 3739 | + |
| 3740 | +/* Definitions of flags stored in file flags word. */ |
| 3741 | + |
| 3742 | +/* Super-user and owner changeable flags. */ |
| 3743 | +# define UF_SETTABLE 0x0000ffff /* mask of owner changeable flags */ |
| 3744 | +# define UF_NODUMP 0x00000001 /* do not dump file */ |
| 3745 | +# define UF_IMMUTABLE 0x00000002 /* file may not be changed */ |
| 3746 | +# define UF_APPEND 0x00000004 /* writes to file may only append */ |
| 3747 | +# define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */ |
| 3748 | +# define UF_NOUNLINK 0x00000010 /* file may not be removed or renamed */ |
| 3749 | + |
| 3750 | +/* Super-user changeable flags. */ |
| 3751 | +# define SF_SETTABLE 0xffff0000 /* mask of superuser changeable flags */ |
| 3752 | +# define SF_ARCHIVED 0x00010000 /* file is archived */ |
| 3753 | +# define SF_IMMUTABLE 0x00020000 /* file may not be changed */ |
| 3754 | +# define SF_APPEND 0x00040000 /* writes to file may only append */ |
| 3755 | +# define SF_NOUNLINK 0x00100000 /* file may not be removed or renamed */ |
| 3756 | +# define SF_SNAPSHOT 0x00200000 /* snapshot inode */ |
| 3757 | + |
| 3758 | +__BEGIN_DECLS |
| 3759 | + |
| 3760 | +/* Set file flags for FILE to FLAGS. */ |
| 3761 | +extern int chflags (__const char *__file, unsigned long int __flags) __THROW; |
| 3762 | + |
| 3763 | +/* Set file flags of the file referred to by FD to FLAGS. */ |
| 3764 | +extern int fchflags (int __fd, unsigned long int __flags) __THROW; |
| 3765 | + |
| 3766 | +/* Set file flags for FILE to FLAGS without following symlinks. */ |
| 3767 | +extern int lchflags(__const char *__file, int __flags); |
| 3768 | + |
| 3769 | +/* Get device name in /dev with a device number of dev and a file type |
| 3770 | + matching the one encoded in type. */ |
| 3771 | +extern char *devname(__dev_t dev, __mode_t type) __THROW; |
| 3772 | + |
| 3773 | +/* Store at most BUFLEN characters of the device name in /dev with a |
| 3774 | + device number of dev and a file type matching the one encoded in type. */ |
| 3775 | +extern char *devname_r(__dev_t dev, __mode_t type, char *buf, int buflen) __THROW; |
| 3776 | + |
| 3777 | +__END_DECLS |
| 3778 | + |
| 3779 | +#endif /* __USE_BSD */ |
| 3780 | + |
| 3781 | +#endif /* bits/stat.h */ |
| 3782 | --- /dev/null |
| 3783 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/stat16.h |
| 3784 | @@ -0,0 +1,56 @@ |
| 3785 | +/* Copyright (C) 2002, 2006, 2010 Free Software Foundation, Inc. |
| 3786 | + This file is part of the GNU C Library. |
| 3787 | + |
| 3788 | + The GNU C Library is free software; you can redistribute it and/or |
| 3789 | + modify it under the terms of the GNU Lesser General Public |
| 3790 | + License as published by the Free Software Foundation; either |
| 3791 | + version 2.1 of the License, or (at your option) any later version. |
| 3792 | + |
| 3793 | + The GNU C Library is distributed in the hope that it will be useful, |
| 3794 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 3795 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 3796 | + Lesser General Public License for more details. |
| 3797 | + |
| 3798 | + You should have received a copy of the GNU Lesser General Public |
| 3799 | + License along with the GNU C Library; if not, write to the Free |
| 3800 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 3801 | + 02111-1307 USA. */ |
| 3802 | + |
| 3803 | +/* This structure corresponds to the standard FreeBSD 'struct stat' |
| 3804 | + (i.e. _STAT_VER_stat), and is used by the stat() system call family. */ |
| 3805 | + |
| 3806 | +struct stat16 |
| 3807 | + { |
| 3808 | + __dev_t st_dev; /* Device containing the file. */ |
| 3809 | + __ino_t st_ino; /* File serial number. */ |
| 3810 | + |
| 3811 | + __uint16_t st_mode; /* File mode. */ |
| 3812 | + __uint16_t st_nlink; /* Link count. */ |
| 3813 | + |
| 3814 | + __uid_t st_uid; /* User ID of the file's owner. */ |
| 3815 | + __gid_t st_gid; /* Group ID of the file's group. */ |
| 3816 | + |
| 3817 | + __dev_t st_rdev; /* Device number, if device. */ |
| 3818 | + |
| 3819 | + struct timespec st_atimespec; /* time of last access */ |
| 3820 | + struct timespec st_mtimespec; /* time of last data modification */ |
| 3821 | + struct timespec st_ctimespec; /* time of last file status change */ |
| 3822 | + |
| 3823 | + __off_t st_size; /* Size of file, in bytes. */ |
| 3824 | + |
| 3825 | + __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */ |
| 3826 | + |
| 3827 | + __blksize_t st_blksize; /* Optimal block size for I/O. */ |
| 3828 | + |
| 3829 | + __uint32_t st_flags; /* User defined flags. */ |
| 3830 | + |
| 3831 | + __uint32_t st_gen; /* Generation number. */ |
| 3832 | + |
| 3833 | + __uint32_t __unused1; |
| 3834 | + |
| 3835 | + __time_t st_birthtime; /* Time of file creation. */ |
| 3836 | + long int st_birthtimensec; /* Nanoseconds of file creation. */ |
| 3837 | + |
| 3838 | +#define _BIRTH_PADSIZE (16 - sizeof(__time_t) - sizeof (long int)) |
| 3839 | + char __birth_padding[_BIRTH_PADSIZE]; |
| 3840 | + }; |
| 3841 | --- /dev/null |
| 3842 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/statfs.h |
| 3843 | @@ -0,0 +1,91 @@ |
| 3844 | +/* Definition of `struct statfs', information about a filesystem. |
| 3845 | + Copyright (C) 1996-1997, 2002 Free Software Foundation, Inc. |
| 3846 | + This file is part of the GNU C Library. |
| 3847 | + |
| 3848 | + The GNU C Library is free software; you can redistribute it and/or |
| 3849 | + modify it under the terms of the GNU Lesser General Public |
| 3850 | + License as published by the Free Software Foundation; either |
| 3851 | + version 2.1 of the License, or (at your option) any later version. |
| 3852 | + |
| 3853 | + The GNU C Library is distributed in the hope that it will be useful, |
| 3854 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 3855 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 3856 | + Lesser General Public License for more details. |
| 3857 | + |
| 3858 | + You should have received a copy of the GNU Lesser General Public |
| 3859 | + License along with the GNU C Library; if not, write to the Free |
| 3860 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 3861 | + 02111-1307 USA. */ |
| 3862 | + |
| 3863 | +#ifndef _BITS_STATFS_H |
| 3864 | +#define _BITS_STATFS_H 1 |
| 3865 | + |
| 3866 | +#if !defined _SYS_STATFS_H && !defined _SYS_MOUNT_H |
| 3867 | +# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead." |
| 3868 | +#endif |
| 3869 | + |
| 3870 | +#include <bits/types.h> |
| 3871 | + |
| 3872 | +struct statfs |
| 3873 | + { |
| 3874 | + unsigned long f_version; |
| 3875 | + unsigned long f_bsize; |
| 3876 | + unsigned long f_iosize; |
| 3877 | +#ifndef __USE_FILE_OFFSET64 |
| 3878 | + __fsblkcnt_t f_blocks; |
| 3879 | + __fsblkcnt_t f_bfree; |
| 3880 | + __fsblkcnt_t f_bavail; |
| 3881 | + __fsfilcnt_t f_files; |
| 3882 | + __fsfilcnt_t f_ffree; |
| 3883 | +#else |
| 3884 | + __fsblkcnt64_t f_blocks; |
| 3885 | + __fsblkcnt64_t f_bfree; |
| 3886 | + __fsblkcnt64_t f_bavail; |
| 3887 | + __fsfilcnt64_t f_files; |
| 3888 | + __fsfilcnt64_t f_ffree; |
| 3889 | +#endif |
| 3890 | + __fsid_t f_fsid; |
| 3891 | + __uid_t f_owner; |
| 3892 | + int f_type; |
| 3893 | + int f_flags; |
| 3894 | + unsigned long int f_syncwrites; |
| 3895 | + unsigned long int f_asyncwrites; |
| 3896 | + char f_fstypename[16]; |
| 3897 | + char f_mntonname[80]; |
| 3898 | + unsigned long int f_syncreads; |
| 3899 | + unsigned long int f_asyncreads; |
| 3900 | + unsigned short f_namemax; |
| 3901 | + char f_mntfromname[80]; |
| 3902 | + short __unused3; |
| 3903 | + long __unused4[2]; |
| 3904 | + }; |
| 3905 | + |
| 3906 | +#ifdef __USE_LARGEFILE64 |
| 3907 | +struct statfs64 |
| 3908 | + { |
| 3909 | + unsigned long f_version; |
| 3910 | + unsigned long f_bsize; |
| 3911 | + unsigned long f_iosize; |
| 3912 | + __fsblkcnt64_t f_blocks; |
| 3913 | + __fsblkcnt64_t f_bfree; |
| 3914 | + __fsblkcnt64_t f_bavail; |
| 3915 | + __fsfilcnt64_t f_files; |
| 3916 | + __fsfilcnt64_t f_ffree; |
| 3917 | + __fsid_t f_fsid; |
| 3918 | + __uid_t f_owner; |
| 3919 | + int f_type; |
| 3920 | + int f_flags; |
| 3921 | + unsigned long int f_syncwrites; |
| 3922 | + unsigned long int f_asyncwrites; |
| 3923 | + char f_fstypename[16]; |
| 3924 | + char f_mntonname[80]; |
| 3925 | + unsigned long int f_syncreads; |
| 3926 | + unsigned long int f_asyncreads; |
| 3927 | + unsigned short f_namemax; |
| 3928 | + char f_mntfromname[80]; |
| 3929 | + short __unused3; |
| 3930 | + long __unused4[2]; |
| 3931 | + }; |
| 3932 | +#endif |
| 3933 | + |
| 3934 | +#endif /* _BITS_STATFS_H */ |
| 3935 | --- /dev/null |
| 3936 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/statvfs.h |
| 3937 | @@ -0,0 +1,97 @@ |
| 3938 | +/* Definition of `struct statvfs', information about a filesystem. |
| 3939 | + Copyright (C) 1998, 2000-2002 Free Software Foundation, Inc. |
| 3940 | + This file is part of the GNU C Library. |
| 3941 | + |
| 3942 | + The GNU C Library is free software; you can redistribute it and/or |
| 3943 | + modify it under the terms of the GNU Lesser General Public |
| 3944 | + License as published by the Free Software Foundation; either |
| 3945 | + version 2.1 of the License, or (at your option) any later version. |
| 3946 | + |
| 3947 | + The GNU C Library is distributed in the hope that it will be useful, |
| 3948 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 3949 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 3950 | + Lesser General Public License for more details. |
| 3951 | + |
| 3952 | + You should have received a copy of the GNU Lesser General Public |
| 3953 | + License along with the GNU C Library; if not, write to the Free |
| 3954 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 3955 | + 02111-1307 USA. */ |
| 3956 | + |
| 3957 | +#ifndef _SYS_STATVFS_H |
| 3958 | +# error "Never include <bits/statvfs.h> directly; use <sys/statvfs.h> instead." |
| 3959 | +#endif |
| 3960 | + |
| 3961 | +#include <bits/types.h> |
| 3962 | + |
| 3963 | +#if __WORDSIZE == 32 |
| 3964 | +#define _STATVFSBUF_F_UNUSED |
| 3965 | +#endif |
| 3966 | + |
| 3967 | +struct statvfs |
| 3968 | + { |
| 3969 | + unsigned long int f_bsize; |
| 3970 | + unsigned long int f_frsize; |
| 3971 | +#ifndef __USE_FILE_OFFSET64 |
| 3972 | + __fsblkcnt_t f_blocks; |
| 3973 | + __fsblkcnt_t f_bfree; |
| 3974 | + __fsblkcnt_t f_bavail; |
| 3975 | + __fsfilcnt_t f_files; |
| 3976 | + __fsfilcnt_t f_ffree; |
| 3977 | + __fsfilcnt_t f_favail; |
| 3978 | +#else |
| 3979 | + __fsblkcnt64_t f_blocks; |
| 3980 | + __fsblkcnt64_t f_bfree; |
| 3981 | + __fsblkcnt64_t f_bavail; |
| 3982 | + __fsfilcnt64_t f_files; |
| 3983 | + __fsfilcnt64_t f_ffree; |
| 3984 | + __fsfilcnt64_t f_favail; |
| 3985 | +#endif |
| 3986 | + unsigned long int f_fsid; |
| 3987 | +#ifdef _STATVFSBUF_F_UNUSED |
| 3988 | + int __f_unused; |
| 3989 | +#endif |
| 3990 | + unsigned long int f_flag; |
| 3991 | + unsigned long int f_namemax; |
| 3992 | + unsigned int f_spare[6]; |
| 3993 | + }; |
| 3994 | + |
| 3995 | +#ifdef __USE_LARGEFILE64 |
| 3996 | +struct statvfs64 |
| 3997 | + { |
| 3998 | + unsigned long int f_bsize; |
| 3999 | + unsigned long int f_frsize; |
| 4000 | + __fsblkcnt64_t f_blocks; |
| 4001 | + __fsblkcnt64_t f_bfree; |
| 4002 | + __fsblkcnt64_t f_bavail; |
| 4003 | + __fsfilcnt64_t f_files; |
| 4004 | + __fsfilcnt64_t f_ffree; |
| 4005 | + __fsfilcnt64_t f_favail; |
| 4006 | + unsigned long int f_fsid; |
| 4007 | +#ifdef _STATVFSBUF_F_UNUSED |
| 4008 | + int __f_unused; |
| 4009 | +#endif |
| 4010 | + unsigned long int f_flag; |
| 4011 | + unsigned long int f_namemax; |
| 4012 | + unsigned int f_spare[6]; |
| 4013 | + }; |
| 4014 | +#endif |
| 4015 | + |
| 4016 | +/* Definitions for the flag in `f_flag'. */ |
| 4017 | +enum |
| 4018 | +{ |
| 4019 | + ST_RDONLY = 1, /* Mount read-only. */ |
| 4020 | +#define ST_RDONLY ST_RDONLY |
| 4021 | + ST_NOSUID = 2 /* Ignore suid and sgid bits. */ |
| 4022 | +#define ST_NOSUID ST_NOSUID |
| 4023 | +#ifdef __USE_GNU |
| 4024 | + , |
| 4025 | + ST_NODEV = 4, /* Disallow access to device special files. */ |
| 4026 | +# define ST_NODEV ST_NODEV |
| 4027 | + ST_NOEXEC = 8, /* Disallow program execution. */ |
| 4028 | +# define ST_NOEXEC ST_NOEXEC |
| 4029 | + ST_SYNCHRONOUS = 16, /* Writes are synced at once. */ |
| 4030 | +# define ST_SYNCHRONOUS ST_SYNCHRONOUS |
| 4031 | + ST_NOATIME = 0x10000000 /* Do not update access times. */ |
| 4032 | +# define ST_NOATIME ST_NOATIME |
| 4033 | +#endif /* Use GNU. */ |
| 4034 | +}; |
| 4035 | --- /dev/null |
| 4036 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/sys_errlist.h |
| 4037 | @@ -0,0 +1,33 @@ |
| 4038 | +/* Declare sys_errlist and sys_nerr, or don't. Compatibility (do) version. |
| 4039 | + Copyright (C) 2002 Free Software Foundation, Inc. |
| 4040 | + This file is part of the GNU C Library. |
| 4041 | + |
| 4042 | + The GNU C Library is free software; you can redistribute it and/or |
| 4043 | + modify it under the terms of the GNU Lesser General Public |
| 4044 | + License as published by the Free Software Foundation; either |
| 4045 | + version 2.1 of the License, or (at your option) any later version. |
| 4046 | + |
| 4047 | + The GNU C Library is distributed in the hope that it will be useful, |
| 4048 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 4049 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 4050 | + Lesser General Public License for more details. |
| 4051 | + |
| 4052 | + You should have received a copy of the GNU Lesser General Public |
| 4053 | + License along with the GNU C Library; if not, write to the Free |
| 4054 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 4055 | + 02111-1307 USA. */ |
| 4056 | + |
| 4057 | +#ifndef _STDIO_H |
| 4058 | +# error "Never include <bits/sys_errlist.h> directly; use <stdio.h> instead." |
| 4059 | +#endif |
| 4060 | + |
| 4061 | +/* sys_errlist and sys_nerr are deprecated. Use strerror instead. */ |
| 4062 | + |
| 4063 | +#ifdef __USE_BSD |
| 4064 | +extern int sys_nerr; |
| 4065 | +extern __const char *__const sys_errlist[]; |
| 4066 | +#endif |
| 4067 | +#ifdef __USE_GNU |
| 4068 | +extern int _sys_nerr; |
| 4069 | +extern __const char *__const _sys_errlist[]; |
| 4070 | +#endif |
| 4071 | --- /dev/null |
| 4072 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/syslog-path.h |
| 4073 | @@ -0,0 +1,31 @@ |
| 4074 | +/* <bits/syslog-path.h> -- _PATH_LOG definition |
| 4075 | + Copyright (C) 2006 Free Software Foundation, Inc. |
| 4076 | + This file is part of the GNU C Library. |
| 4077 | + |
| 4078 | + The GNU C Library is free software; you can redistribute it and/or |
| 4079 | + modify it under the terms of the GNU Lesser General Public |
| 4080 | + License as published by the Free Software Foundation; either |
| 4081 | + version 2.1 of the License, or (at your option) any later version. |
| 4082 | + |
| 4083 | + The GNU C Library is distributed in the hope that it will be useful, |
| 4084 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 4085 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 4086 | + Lesser General Public License for more details. |
| 4087 | + |
| 4088 | + You should have received a copy of the GNU Lesser General Public |
| 4089 | + License along with the GNU C Library; if not, write to the Free |
| 4090 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 4091 | + 02111-1307 USA. */ |
| 4092 | + |
| 4093 | +#ifndef _SYS_SYSLOG_H |
| 4094 | +# error "Never include this file directly. Use <sys/syslog.h> instead" |
| 4095 | +#endif |
| 4096 | + |
| 4097 | +#ifndef _BITS_SYSLOG_PATH_H |
| 4098 | +#define _BITS_SYSLOG_PATH_H 1 |
| 4099 | + |
| 4100 | +/* On kFreeBSD, named pipes are not allowed in /dev (devfs), so we pick this |
| 4101 | + alternate path. */ |
| 4102 | +#define _PATH_LOG "/var/run/log" |
| 4103 | + |
| 4104 | +#endif /* bits/syslog-path.h */ |
| 4105 | --- /dev/null |
| 4106 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/termios.h |
| 4107 | @@ -0,0 +1,253 @@ |
| 4108 | +/* termios type and macro definitions. FreeBSD version. |
| 4109 | + Copyright (C) 1993-1994,1996-1997,1999,2001-2002 Free Software Foundation, Inc. |
| 4110 | + This file is part of the GNU C Library. |
| 4111 | + |
| 4112 | + The GNU C Library is free software; you can redistribute it and/or |
| 4113 | + modify it under the terms of the GNU Lesser General Public |
| 4114 | + License as published by the Free Software Foundation; either |
| 4115 | + version 2.1 of the License, or (at your option) any later version. |
| 4116 | + |
| 4117 | + The GNU C Library is distributed in the hope that it will be useful, |
| 4118 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 4119 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 4120 | + Lesser General Public License for more details. |
| 4121 | + |
| 4122 | + You should have received a copy of the GNU Lesser General Public |
| 4123 | + License along with the GNU C Library; if not, write to the Free |
| 4124 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 4125 | + 02111-1307 USA. */ |
| 4126 | + |
| 4127 | +#ifndef _TERMIOS_H |
| 4128 | +# error "Never include <bits/termios.h> directly; use <termios.h> instead." |
| 4129 | +#endif |
| 4130 | + |
| 4131 | +/* These macros are also defined in some <bits/ioctls.h> files (with |
| 4132 | + numerically identical values), but this serves to shut up cpp's |
| 4133 | + complaining. */ |
| 4134 | +#ifdef __USE_BSD |
| 4135 | + |
| 4136 | +# ifdef MDMBUF |
| 4137 | +# undef MDMBUF |
| 4138 | +# endif |
| 4139 | +# ifdef FLUSHO |
| 4140 | +# undef FLUSHO |
| 4141 | +# endif |
| 4142 | +# ifdef PENDIN |
| 4143 | +# undef PENDIN |
| 4144 | +# endif |
| 4145 | + |
| 4146 | +#endif /* __USE_BSD */ |
| 4147 | + |
| 4148 | +#ifdef ECHO |
| 4149 | +# undef ECHO |
| 4150 | +#endif |
| 4151 | +#ifdef TOSTOP |
| 4152 | +# undef TOSTOP |
| 4153 | +#endif |
| 4154 | +#ifdef NOFLSH |
| 4155 | +# undef NOFLSH |
| 4156 | +#endif |
| 4157 | + |
| 4158 | + |
| 4159 | +typedef unsigned char cc_t; |
| 4160 | +typedef unsigned int speed_t; |
| 4161 | +typedef unsigned int tcflag_t; |
| 4162 | + |
| 4163 | +#define NCCS 20 |
| 4164 | +struct termios |
| 4165 | + { |
| 4166 | + tcflag_t c_iflag; /* input mode flags */ |
| 4167 | + tcflag_t c_oflag; /* output mode flags */ |
| 4168 | + tcflag_t c_cflag; /* control mode flags */ |
| 4169 | + tcflag_t c_lflag; /* local mode flags */ |
| 4170 | + cc_t c_cc[NCCS]; /* control characters */ |
| 4171 | + speed_t c_ispeed; /* input speed */ |
| 4172 | + speed_t c_ospeed; /* output speed */ |
| 4173 | +#define __ispeed c_ispeed |
| 4174 | +#define __ospeed c_ospeed |
| 4175 | +#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 |
| 4176 | +#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 |
| 4177 | + }; |
| 4178 | + |
| 4179 | +/* c_cc characters */ |
| 4180 | +#define VEOF 0 |
| 4181 | +#define VEOL 1 |
| 4182 | +#define VEOL2 2 |
| 4183 | +#define VERASE 3 |
| 4184 | +#define VWERASE 4 |
| 4185 | +#define VKILL 5 |
| 4186 | +#define VREPRINT 6 |
| 4187 | +#ifdef __USE_BSD |
| 4188 | +# define VERASE2 7 |
| 4189 | +#endif |
| 4190 | +#define VINTR 8 |
| 4191 | +#define VQUIT 9 |
| 4192 | +#define VSUSP 10 |
| 4193 | +#ifdef __USE_BSD |
| 4194 | +# define VDSUSP 11 |
| 4195 | +#endif |
| 4196 | +#define VSTART 12 |
| 4197 | +#define VSTOP 13 |
| 4198 | +#define VLNEXT 14 |
| 4199 | +#define VDISCARD 15 |
| 4200 | +#define VMIN 16 |
| 4201 | +#define VTIME 17 |
| 4202 | +#ifdef __USE_BSD |
| 4203 | +# define VSTATUS 18 |
| 4204 | +#endif |
| 4205 | + |
| 4206 | +/* c_iflag bits */ |
| 4207 | +#define IGNBRK 0000001 |
| 4208 | +#define BRKINT 0000002 |
| 4209 | +#define IGNPAR 0000004 |
| 4210 | +#define PARMRK 0000010 |
| 4211 | +#define INPCK 0000020 |
| 4212 | +#define ISTRIP 0000040 |
| 4213 | +#define INLCR 0000100 |
| 4214 | +#define IGNCR 0000200 |
| 4215 | +#define ICRNL 0000400 |
| 4216 | +#define IXON 0001000 |
| 4217 | +#define IXOFF 0002000 |
| 4218 | +#define IXANY 0004000 |
| 4219 | +#define IMAXBEL 0020000 |
| 4220 | + |
| 4221 | +/* c_oflag bits */ |
| 4222 | +#define OPOST (1 << 0) /* Perform output processing. */ |
| 4223 | +#define ONLCR (1 << 1) /* Map NL to CR-NL on output. */ |
| 4224 | +#if defined __USE_MISC || defined __USE_XOPEN |
| 4225 | +# define TAB0 (0 << 2) /* no tab delay and expansion */ |
| 4226 | +# define TAB3 (1 << 2) /* expand tabs to spaces */ |
| 4227 | +# define TABDLY TAB3 /* tab delay mask */ |
| 4228 | +# define OXTABS TAB3 |
| 4229 | +# define XTABS TAB3 |
| 4230 | +#endif |
| 4231 | +#ifdef __USE_BSD |
| 4232 | +# define ONOEOT (1 << 3) /* Discard EOT (^D) on output. */ |
| 4233 | +#endif |
| 4234 | +#define OCRNL (1 << 4) /* map CR to NL on output */ |
| 4235 | +#define ONOCR (1 << 5) /* no CR output at column 0 */ |
| 4236 | +#define ONLRET (1 << 6) /* NL performs CR function */ |
| 4237 | + |
| 4238 | +/* c_cflag bit meaning */ |
| 4239 | +#ifdef __USE_BSD |
| 4240 | +# define CIGNORE (1 << 0) /* Ignore these control flags. */ |
| 4241 | +#endif |
| 4242 | +#define CSIZE (CS5|CS6|CS7|CS8) /* Number of bits per byte (mask). */ |
| 4243 | +#define CS5 (0 << 8) /* 5 bits per byte. */ |
| 4244 | +#define CS6 (1 << 8) /* 6 bits per byte. */ |
| 4245 | +#define CS7 (2 << 8) /* 7 bits per byte. */ |
| 4246 | +#define CS8 (3 << 8) /* 8 bits per byte. */ |
| 4247 | +#define CSTOPB (1 << 10) /* Two stop bits instead of one. */ |
| 4248 | +#define CREAD (1 << 11) /* Enable receiver. */ |
| 4249 | +#define PARENB (1 << 12) /* Parity enable. */ |
| 4250 | +#define PARODD (1 << 13) /* Odd parity instead of even. */ |
| 4251 | +#define HUPCL (1 << 14) /* Hang up on last close. */ |
| 4252 | +#define CLOCAL (1 << 15) /* Ignore modem status lines. */ |
| 4253 | +#ifdef __USE_BSD |
| 4254 | +# define CCTS_OFLOW (1 << 16) /* CTS flow control of output. */ |
| 4255 | +# define CRTS_IFLOW (1 << 17) /* RTS flow control of input. */ |
| 4256 | +# define CRTSCTS (CCTS_OFLOW|CRTS_IFLOW) /* CTS/RTS flow control. */ |
| 4257 | +# define CDTR_IFLOW (1 << 18) /* DTR flow control of input. */ |
| 4258 | +# define CDSR_OFLOW (1 << 19) /* DSR flow control of output. */ |
| 4259 | +# define CCAR_OFLOW (1 << 20) /* DCD flow control of output. */ |
| 4260 | +# define MDMBUF (1 << 20) /* Carrier flow control of output. */ |
| 4261 | +#endif |
| 4262 | + |
| 4263 | +/* c_lflag bits */ |
| 4264 | +#ifdef __USE_BSD |
| 4265 | +# define ECHOKE (1 << 0) /* Visual erase for KILL. */ |
| 4266 | +#endif |
| 4267 | +#define _ECHOE (1 << 1) /* Visual erase for ERASE. */ |
| 4268 | +#define ECHOE _ECHOE |
| 4269 | +#define _ECHOK (1 << 2) /* Echo NL after KILL. */ |
| 4270 | +#define ECHOK _ECHOK |
| 4271 | +#define _ECHO (1 << 3) /* Enable echo. */ |
| 4272 | +#define ECHO _ECHO |
| 4273 | +#define _ECHONL (1 << 4) /* Echo NL even if ECHO is off. */ |
| 4274 | +#define ECHONL _ECHONL |
| 4275 | +#ifdef __USE_BSD |
| 4276 | +# define ECHOPRT (1 << 5) /* Hardcopy visual erase. */ |
| 4277 | +# define ECHOCTL (1 << 6) /* Echo control characters as ^X. */ |
| 4278 | +#endif |
| 4279 | +#define _ISIG (1 << 7) /* Enable signals. */ |
| 4280 | +#define ISIG _ISIG |
| 4281 | +#define _ICANON (1 << 8) /* Do erase and kill processing. */ |
| 4282 | +#define ICANON _ICANON |
| 4283 | +#ifdef __USE_BSD |
| 4284 | +# define ALTWERASE (1 << 9) /* Alternate WERASE algorithm. */ |
| 4285 | +#endif |
| 4286 | +#define _IEXTEN (1 << 10) /* Enable DISCARD and LNEXT. */ |
| 4287 | +#define IEXTEN _IEXTEN |
| 4288 | +#define _EXTPROC (1 << 11) /* External processing. */ |
| 4289 | +#define EXTPROC _EXTPROC |
| 4290 | +#define _TOSTOP (1 << 22) /* Send SIGTTOU for background output. */ |
| 4291 | +#define TOSTOP _TOSTOP |
| 4292 | +#ifdef __USE_BSD |
| 4293 | +# define FLUSHO (1 << 23) /* Output being flushed (state). */ |
| 4294 | +# define NOKERNINFO (1 << 25) /* Disable VSTATUS. */ |
| 4295 | +# define PENDIN (1 << 29) /* Retype pending input (state). */ |
| 4296 | +#endif |
| 4297 | +#define _NOFLSH (1 << 31) /* Disable flush after interrupt. */ |
| 4298 | +#define NOFLSH _NOFLSH |
| 4299 | + |
| 4300 | + /* Input and output baud rates. */ |
| 4301 | +#define B0 0 /* Hang up. */ |
| 4302 | +#define B50 50 /* 50 baud. */ |
| 4303 | +#define B75 75 /* 75 baud. */ |
| 4304 | +#define B110 110 /* 110 baud. */ |
| 4305 | +#define B134 134 /* 134.5 baud. */ |
| 4306 | +#define B150 150 /* 150 baud. */ |
| 4307 | +#define B200 200 /* 200 baud. */ |
| 4308 | +#define B300 300 /* 300 baud. */ |
| 4309 | +#define B600 600 /* 600 baud. */ |
| 4310 | +#define B1200 1200 /* 1200 baud. */ |
| 4311 | +#define B1800 1800 /* 1800 baud. */ |
| 4312 | +#define B2400 2400 /* 2400 baud. */ |
| 4313 | +#define B4800 4800 /* 4800 baud. */ |
| 4314 | +#define B9600 9600 /* 9600 baud. */ |
| 4315 | +#define B19200 19200 /* 19200 baud. */ |
| 4316 | +#define B38400 38400 /* 38400 baud. */ |
| 4317 | +#define B76800 76800 |
| 4318 | +#ifdef __USE_MISC |
| 4319 | +# define EXTA 19200 |
| 4320 | +# define EXTB 38400 |
| 4321 | +#endif |
| 4322 | +#define B7200 7200 |
| 4323 | +#define B14400 14400 |
| 4324 | +#define B28800 28800 |
| 4325 | +#define B57600 57600 |
| 4326 | +#define B115200 115200 |
| 4327 | +#define B230400 230400 |
| 4328 | +#define B460800 460800 |
| 4329 | +#define B500000 500000 |
| 4330 | +#define B576000 576000 |
| 4331 | +#define B921600 921600 |
| 4332 | +#define B1000000 1000000 |
| 4333 | +#define B1152000 1152000 |
| 4334 | +#define B1500000 1500000 |
| 4335 | +#define B2000000 2000000 |
| 4336 | +#define B2500000 2500000 |
| 4337 | +#define B3000000 3000000 |
| 4338 | +#define B3500000 3500000 |
| 4339 | +#define B4000000 4000000 |
| 4340 | +#define __MAX_BAUD B4000000 |
| 4341 | + |
| 4342 | +/* tcflow() and TCXONC use these */ |
| 4343 | +#define TCOOFF 1 |
| 4344 | +#define TCOON 2 |
| 4345 | +#define TCIOFF 3 |
| 4346 | +#define TCION 4 |
| 4347 | + |
| 4348 | +/* tcflush() and TCFLSH use these */ |
| 4349 | +#define TCIFLUSH 1 |
| 4350 | +#define TCOFLUSH 2 |
| 4351 | +#define TCIOFLUSH 3 |
| 4352 | + |
| 4353 | +/* tcsetattr uses these */ |
| 4354 | +#define TCSANOW 0 |
| 4355 | +#define TCSADRAIN 1 |
| 4356 | +#define TCSAFLUSH 2 |
| 4357 | +#ifdef __USE_BSD |
| 4358 | +# define TCSASOFT 0x10 /* Flag: Don't alter hardware state. */ |
| 4359 | +#endif |
| 4360 | + |
| 4361 | --- /dev/null |
| 4362 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/time.h |
| 4363 | @@ -0,0 +1,98 @@ |
| 4364 | +/* System-dependent timing definitions. FreeBSD version. |
| 4365 | + Copyright (C) 1996-1997, 1999, 2000, 2002 Free Software Foundation, Inc. |
| 4366 | + This file is part of the GNU C Library. |
| 4367 | + |
| 4368 | + The GNU C Library is free software; you can redistribute it and/or |
| 4369 | + modify it under the terms of the GNU Lesser General Public |
| 4370 | + License as published by the Free Software Foundation; either |
| 4371 | + version 2.1 of the License, or (at your option) any later version. |
| 4372 | + |
| 4373 | + The GNU C Library is distributed in the hope that it will be useful, |
| 4374 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 4375 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 4376 | + Lesser General Public License for more details. |
| 4377 | + |
| 4378 | + You should have received a copy of the GNU Lesser General Public |
| 4379 | + License along with the GNU C Library; if not, write to the Free |
| 4380 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 4381 | + 02111-1307 USA. */ |
| 4382 | + |
| 4383 | +/* |
| 4384 | + * Never include this file directly; use <time.h> instead. |
| 4385 | + */ |
| 4386 | + |
| 4387 | +#ifndef __need_timeval |
| 4388 | +# ifndef _BITS_TIME_H |
| 4389 | +# define _BITS_TIME_H 1 |
| 4390 | + |
| 4391 | +/* ISO/IEC 9899:1990 7.12.1: <time.h> |
| 4392 | + The macro `CLOCKS_PER_SEC' is the number per second of the value |
| 4393 | + returned by the `clock' function. */ |
| 4394 | +/* CAE XSH, Issue 4, Version 2: <time.h> |
| 4395 | + The value of CLOCKS_PER_SEC is required to be 1 million on all |
| 4396 | + XSI-conformant systems. */ |
| 4397 | +# define CLOCKS_PER_SEC 1000000l |
| 4398 | + |
| 4399 | +# if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K |
| 4400 | +/* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK |
| 4401 | + presents the real value for clock ticks per second for the system. */ |
| 4402 | +# define CLK_TCK 128 |
| 4403 | +# endif |
| 4404 | + |
| 4405 | +# ifdef __USE_POSIX199309 |
| 4406 | +/* Identifier for system-wide realtime clock. */ |
| 4407 | +# define CLOCK_REALTIME 0 |
| 4408 | +/* High-resolution timer from the CPU. */ |
| 4409 | +# define CLOCK_PROCESS_CPUTIME_ID 2 |
| 4410 | +/* Thread-specific CPU-time clock. */ |
| 4411 | +# define CLOCK_THREAD_CPUTIME_ID 3 |
| 4412 | +/* Monotonic system-wide clock. */ |
| 4413 | +# define CLOCK_MONOTONIC 4 |
| 4414 | +/* These are BSD specific clocks. */ |
| 4415 | +# ifdef __USE_BSD |
| 4416 | +# define CLOCK_VIRTUAL 1 |
| 4417 | +# define CLOCK_PROF 2 |
| 4418 | +# define CLOCK_UPTIME 5 /* FreeBSD-specific. */ |
| 4419 | +# define CLOCK_UPTIME_PRECISE 7 /* FreeBSD-specific. */ |
| 4420 | +# define CLOCK_UPTIME_FAST 8 /* FreeBSD-specific. */ |
| 4421 | +# define CLOCK_REALTIME_PRECISE 9 /* FreeBSD-specific. */ |
| 4422 | +# define CLOCK_REALTIME_FAST 10 /* FreeBSD-specific. */ |
| 4423 | +# define CLOCK_MONOTONIC_PRECISE 11 /* FreeBSD-specific. */ |
| 4424 | +# define CLOCK_MONOTONIC_FAST 12 /* FreeBSD-specific. */ |
| 4425 | +# define CLOCK_SECOND 13 /* FreeBSD-specific. */ |
| 4426 | +# endif |
| 4427 | + |
| 4428 | +/* Flag to indicate time is absolute. */ |
| 4429 | +# define TIMER_RELTIME 0 /* relative timer */ |
| 4430 | +# define TIMER_ABSTIME 1 /* absolute timer */ |
| 4431 | +# endif |
| 4432 | + |
| 4433 | + |
| 4434 | +/* Getkerninfo clock information structure */ |
| 4435 | +struct clockinfo |
| 4436 | + { |
| 4437 | + int hz; /* clock frequency */ |
| 4438 | + int tick; /* micro-seconds per hz tick */ |
| 4439 | + int spare; |
| 4440 | + int stathz; /* statistics clock frequency */ |
| 4441 | + int profhz; /* profiling clock frequency */ |
| 4442 | + }; |
| 4443 | + |
| 4444 | +# endif /* bits/time.h */ |
| 4445 | +#endif |
| 4446 | + |
| 4447 | +#ifdef __need_timeval |
| 4448 | +# undef __need_timeval |
| 4449 | +# ifndef _STRUCT_TIMEVAL |
| 4450 | +# define _STRUCT_TIMEVAL 1 |
| 4451 | +# include <bits/types.h> |
| 4452 | + |
| 4453 | +/* A time value that is accurate to the nearest |
| 4454 | + microsecond but also has a range of years. */ |
| 4455 | +struct timeval |
| 4456 | + { |
| 4457 | + __time_t tv_sec; /* Seconds. */ |
| 4458 | + __suseconds_t tv_usec; /* Microseconds. */ |
| 4459 | + }; |
| 4460 | +# endif /* struct timeval */ |
| 4461 | +#endif /* need timeval */ |
| 4462 | --- /dev/null |
| 4463 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/typesizes.h |
| 4464 | @@ -0,0 +1,91 @@ |
| 4465 | +/* bits/typesizes.h -- underlying types for *_t. kFreeBSD version. |
| 4466 | + Copyright (C) 2002, 2003, 2010, 2012 Free Software Foundation, Inc. |
| 4467 | + This file is part of the GNU C Library. |
| 4468 | + |
| 4469 | + The GNU C Library is free software; you can redistribute it and/or |
| 4470 | + modify it under the terms of the GNU Lesser General Public |
| 4471 | + License as published by the Free Software Foundation; either |
| 4472 | + version 2.1 of the License, or (at your option) any later version. |
| 4473 | + |
| 4474 | + The GNU C Library is distributed in the hope that it will be useful, |
| 4475 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 4476 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 4477 | + Lesser General Public License for more details. |
| 4478 | + |
| 4479 | + You should have received a copy of the GNU Lesser General Public |
| 4480 | + License along with the GNU C Library; if not, write to the Free |
| 4481 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 4482 | + 02111-1307 USA. */ |
| 4483 | + |
| 4484 | +#ifndef _BITS_TYPES_H |
| 4485 | +# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead." |
| 4486 | +#endif |
| 4487 | + |
| 4488 | +#ifndef _BITS_TYPESIZES_H |
| 4489 | +#define _BITS_TYPESIZES_H 1 |
| 4490 | + |
| 4491 | +/* See <bits/types.h> for the meaning of these macros. This file exists so |
| 4492 | + that <bits/types.h> need not vary across different GNU platforms. */ |
| 4493 | + |
| 4494 | +#define __DEV_T_TYPE __U32_TYPE |
| 4495 | +#define __UID_T_TYPE __U32_TYPE |
| 4496 | +#define __GID_T_TYPE __U32_TYPE |
| 4497 | +#define __INO_T_TYPE __U32_TYPE |
| 4498 | +#define __INO64_T_TYPE __UQUAD_TYPE |
| 4499 | +#define __MODE_T_TYPE __U16_TYPE |
| 4500 | +#define __NLINK_T_TYPE __U16_TYPE |
| 4501 | +#define __OFF_T_TYPE __SQUAD_TYPE |
| 4502 | +#define __OFF64_T_TYPE __SQUAD_TYPE |
| 4503 | +#define __PID_T_TYPE __S32_TYPE |
| 4504 | +#define __RLIM_T_TYPE __SQUAD_TYPE |
| 4505 | +#define __RLIM64_T_TYPE __SQUAD_TYPE |
| 4506 | +#define __BLKCNT_T_TYPE __SQUAD_TYPE |
| 4507 | +#define __BLKCNT64_T_TYPE __SQUAD_TYPE |
| 4508 | +#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE |
| 4509 | +#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE |
| 4510 | +#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE |
| 4511 | +#define __FSFILCNT64_T_TYPE __UQUAD_TYPE |
| 4512 | +#define __ID_T_TYPE __U32_TYPE |
| 4513 | + |
| 4514 | +#if defined(__arm__) || defined(__powerpc__) |
| 4515 | +#define __CLOCK_T_TYPE __U32_TYPE |
| 4516 | +#elif defined(__i386__) |
| 4517 | +/* clock_t is unsigned in FreeBSD/i386, but it's too late to fix that now... */ |
| 4518 | +#define __CLOCK_T_TYPE __S32_TYPE |
| 4519 | +#else |
| 4520 | +#define __CLOCK_T_TYPE __S32_TYPE |
| 4521 | +#endif |
| 4522 | + |
| 4523 | +/* |
| 4524 | + * This one is a bit tricky. It needs to match the size |
| 4525 | + * in the sys/${arch}/include/_types.h typedefs. |
| 4526 | + * |
| 4527 | + * However, for i386 and amd64 we started with __SLONGWORD_TYPE |
| 4528 | + * and we need to maintain ABI. Even if size is the same, using |
| 4529 | + * a different type may affect C++ ABI (this distinction is |
| 4530 | + * necessary to implement function overload), so it must stay |
| 4531 | + * with __SLONGWORD_TYPE. |
| 4532 | + */ |
| 4533 | +#if defined(__i386__) || defined(__amd64__) |
| 4534 | +#define __TIME_T_TYPE __SLONGWORD_TYPE |
| 4535 | +#elif defined(__powerpc__) && !defined(__LP64__) |
| 4536 | +#define __TIME_T_TYPE __S32_TYPE |
| 4537 | +#else |
| 4538 | +#define __TIME_T_TYPE __S64_TYPE |
| 4539 | +#endif |
| 4540 | +#define __USECONDS_T_TYPE __U32_TYPE |
| 4541 | +#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE |
| 4542 | +#define __DADDR_T_TYPE __SQUAD_TYPE |
| 4543 | +#define __SWBLK_T_TYPE __S32_TYPE |
| 4544 | +#define __KEY_T_TYPE __SLONGWORD_TYPE |
| 4545 | +#define __CLOCKID_T_TYPE __S32_TYPE |
| 4546 | +#define __TIMER_T_TYPE __S32_TYPE |
| 4547 | +#define __BLKSIZE_T_TYPE __U32_TYPE |
| 4548 | +#define __FSID_T_TYPE union { int __val[2]; int val[2]; } |
| 4549 | +#define __SSIZE_T_TYPE __SWORD_TYPE |
| 4550 | + |
| 4551 | +/* Number of descriptors that can fit in an `fd_set'. */ |
| 4552 | +#define __FD_SETSIZE 1024 |
| 4553 | + |
| 4554 | + |
| 4555 | +#endif /* bits/typesizes.h */ |
| 4556 | --- /dev/null |
| 4557 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/uio.h |
| 4558 | @@ -0,0 +1,55 @@ |
| 4559 | +/* Copyright (C) 1996-1997, 2002 Free Software Foundation, Inc. |
| 4560 | + This file is part of the GNU C Library. |
| 4561 | + |
| 4562 | + The GNU C Library is free software; you can redistribute it and/or |
| 4563 | + modify it under the terms of the GNU Lesser General Public |
| 4564 | + License as published by the Free Software Foundation; either |
| 4565 | + version 2.1 of the License, or (at your option) any later version. |
| 4566 | + |
| 4567 | + The GNU C Library is distributed in the hope that it will be useful, |
| 4568 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 4569 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 4570 | + Lesser General Public License for more details. |
| 4571 | + |
| 4572 | + You should have received a copy of the GNU Lesser General Public |
| 4573 | + License along with the GNU C Library; if not, write to the Free |
| 4574 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 4575 | + 02111-1307 USA. */ |
| 4576 | + |
| 4577 | +#if !defined _SYS_UIO_H && !defined _FCNTL_H |
| 4578 | +# error "Never include <bits/uio.h> directly; use <sys/uio.h> instead." |
| 4579 | +#endif |
| 4580 | + |
| 4581 | +#ifndef _BITS_UIO_H |
| 4582 | +#define _BITS_UIO_H 1 |
| 4583 | + |
| 4584 | +#include <sys/types.h> |
| 4585 | + |
| 4586 | + |
| 4587 | +/* `struct iovec' -- Structure describing a section of memory. */ |
| 4588 | + |
| 4589 | +struct iovec |
| 4590 | +{ |
| 4591 | + /* Starting address. */ |
| 4592 | + __ptr_t iov_base; |
| 4593 | + /* Length in bytes. */ |
| 4594 | + size_t iov_len; |
| 4595 | +}; |
| 4596 | + |
| 4597 | +/* Maximum number of 'struct iovec's that can be passed to a readv() or |
| 4598 | + writev() system call. For larger arrays of 'struct iovec', the libc |
| 4599 | + uses a single read() or write() call to guarantee atomicity. */ |
| 4600 | +#define UIO_MAXIOV 1024 |
| 4601 | + |
| 4602 | +#ifdef __USE_BSD |
| 4603 | +enum uio_rw { UIO_READ, UIO_WRITE }; |
| 4604 | + |
| 4605 | +/* Segment flag values. */ |
| 4606 | +enum uio_seg { |
| 4607 | + UIO_USERSPACE, /* from user data space */ |
| 4608 | + UIO_SYSSPACE, /* from system space */ |
| 4609 | + UIO_NOCOPY /* don't copy, already in object */ |
| 4610 | +}; |
| 4611 | +#endif |
| 4612 | + |
| 4613 | +#endif |
| 4614 | --- /dev/null |
| 4615 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/utsname.h |
| 4616 | @@ -0,0 +1,27 @@ |
| 4617 | +/* Copyright (C) 1997, 2002 Free Software Foundation, Inc. |
| 4618 | + This file is part of the GNU C Library. |
| 4619 | + |
| 4620 | + The GNU C Library is free software; you can redistribute it and/or |
| 4621 | + modify it under the terms of the GNU Lesser General Public |
| 4622 | + License as published by the Free Software Foundation; either |
| 4623 | + version 2.1 of the License, or (at your option) any later version. |
| 4624 | + |
| 4625 | + The GNU C Library is distributed in the hope that it will be useful, |
| 4626 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 4627 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 4628 | + Lesser General Public License for more details. |
| 4629 | + |
| 4630 | + You should have received a copy of the GNU Lesser General Public |
| 4631 | + License along with the GNU C Library; if not, write to the Free |
| 4632 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 4633 | + 02111-1307 USA. */ |
| 4634 | + |
| 4635 | +#ifndef _SYS_UTSNAME_H |
| 4636 | +# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead." |
| 4637 | +#endif |
| 4638 | + |
| 4639 | +/* Length of the entries in 'struct utsname' is 32. */ |
| 4640 | +#define _UTSNAME_LENGTH 32 |
| 4641 | + |
| 4642 | +/* But the version entry is longer. */ |
| 4643 | +#define _UTSNAME_VERSION_LENGTH 256 |
| 4644 | --- /dev/null |
| 4645 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/waitflags.h |
| 4646 | @@ -0,0 +1,37 @@ |
| 4647 | +/* Definitions of flag bits for `waitpid' et al. |
| 4648 | + Copyright (C) 1992, 1996-1997, 2000, 2002 Free Software Foundation, Inc. |
| 4649 | + This file is part of the GNU C Library. |
| 4650 | + |
| 4651 | + The GNU C Library is free software; you can redistribute it and/or |
| 4652 | + modify it under the terms of the GNU Lesser General Public |
| 4653 | + License as published by the Free Software Foundation; either |
| 4654 | + version 2.1 of the License, or (at your option) any later version. |
| 4655 | + |
| 4656 | + The GNU C Library is distributed in the hope that it will be useful, |
| 4657 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 4658 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 4659 | + Lesser General Public License for more details. |
| 4660 | + |
| 4661 | + You should have received a copy of the GNU Lesser General Public |
| 4662 | + License along with the GNU C Library; if not, write to the Free |
| 4663 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 4664 | + 02111-1307 USA. */ |
| 4665 | + |
| 4666 | +#if !defined _SYS_WAIT_H && !defined _STDLIB_H |
| 4667 | +# error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead." |
| 4668 | +#endif |
| 4669 | + |
| 4670 | + |
| 4671 | +/* Bits in the third argument to `waitpid'. */ |
| 4672 | +#define WNOHANG 1 /* Don't block waiting. */ |
| 4673 | +#define WUNTRACED 2 /* Report status of stopped children. */ |
| 4674 | + |
| 4675 | +/* Bits in the fourth argument to `waitid'. */ |
| 4676 | +#define WSTOPPED 2 /* Report stopped child (same as WUNTRACED). */ |
| 4677 | +#define WCONTINUED 4 /* Report continued child. */ |
| 4678 | +#define WNOWAIT 8 /* Poll only. Don't delete the proc entry. */ |
| 4679 | + |
| 4680 | +#define __WCLONE 0x80000000 /* Wait for cloned process. */ |
| 4681 | +#ifdef __USE_BSD |
| 4682 | +# define WLINUXCLONE __WCLONE /* FreeBSD name for __WCLONE. */ |
| 4683 | +#endif |
| 4684 | --- /dev/null |
| 4685 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/waitstatus.h |
| 4686 | @@ -0,0 +1,105 @@ |
| 4687 | +/* Definitions of status bits for `wait' et al. |
| 4688 | + Copyright (C) 1992,1994,1996,1997,2000,2004 Free Software Foundation, Inc. |
| 4689 | + This file is part of the GNU C Library. |
| 4690 | + |
| 4691 | + The GNU C Library is free software; you can redistribute it and/or |
| 4692 | + modify it under the terms of the GNU Lesser General Public |
| 4693 | + License as published by the Free Software Foundation; either |
| 4694 | + version 2.1 of the License, or (at your option) any later version. |
| 4695 | + |
| 4696 | + The GNU C Library is distributed in the hope that it will be useful, |
| 4697 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 4698 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 4699 | + Lesser General Public License for more details. |
| 4700 | + |
| 4701 | + You should have received a copy of the GNU Lesser General Public |
| 4702 | + License along with the GNU C Library; if not, write to the Free |
| 4703 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 4704 | + 02111-1307 USA. */ |
| 4705 | + |
| 4706 | +#if !defined _SYS_WAIT_H && !defined _STDLIB_H |
| 4707 | +# error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead." |
| 4708 | +#endif |
| 4709 | + |
| 4710 | + |
| 4711 | +/* If WIFEXITED(STATUS), the low-order 8 bits of the status. */ |
| 4712 | +#define __WEXITSTATUS(status) (((status) & 0xff00) >> 8) |
| 4713 | + |
| 4714 | +/* If WIFSIGNALED(STATUS), the terminating signal. */ |
| 4715 | +#define __WTERMSIG(status) ((status) & 0x7f) |
| 4716 | + |
| 4717 | +/* If WIFSTOPPED(STATUS), the signal that stopped the child. */ |
| 4718 | +#define __WSTOPSIG(status) __WEXITSTATUS(status) |
| 4719 | + |
| 4720 | +/* Nonzero if STATUS indicates normal termination. */ |
| 4721 | +#define __WIFEXITED(status) (__WTERMSIG(status) == 0) |
| 4722 | + |
| 4723 | +/* Nonzero if STATUS indicates termination by a signal. */ |
| 4724 | +#define __WIFSIGNALED(status) \ |
| 4725 | + (((signed char) (((status) & 0x7f) + 1) >> 1) > 0) |
| 4726 | + |
| 4727 | +/* Nonzero if STATUS indicates the child is stopped. */ |
| 4728 | +#define __WIFSTOPPED(status) (((status) & 0x7f) == 0x7f) |
| 4729 | + |
| 4730 | +/* Nonzero if STATUS indicates the child continued after a stop. We only |
| 4731 | + define this if <bits/waitflags.h> provides the WCONTINUED flag bit. */ |
| 4732 | +#ifdef WCONTINUED |
| 4733 | +# define __WIFCONTINUED(status) ((status) == __W_CONTINUED) |
| 4734 | +#endif |
| 4735 | + |
| 4736 | +/* Nonzero if STATUS indicates the child dumped core. */ |
| 4737 | +#define __WCOREDUMP(status) ((status) & __WCOREFLAG) |
| 4738 | + |
| 4739 | +/* Macros for constructing status values. */ |
| 4740 | +#define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) |
| 4741 | +#define __W_STOPCODE(sig) ((sig) << 8 | 0x7f) |
| 4742 | + |
| 4743 | +/* Linux uses 0xffff, BSD uses SIGCONT */ |
| 4744 | +#define __W_CONTINUED 0x13 |
| 4745 | +#define __WCOREFLAG 0x80 |
| 4746 | + |
| 4747 | + |
| 4748 | +#ifdef __USE_BSD |
| 4749 | + |
| 4750 | +# include <endian.h> |
| 4751 | + |
| 4752 | +union wait |
| 4753 | + { |
| 4754 | + int w_status; |
| 4755 | + struct |
| 4756 | + { |
| 4757 | +# if __BYTE_ORDER == __LITTLE_ENDIAN |
| 4758 | + unsigned int __w_termsig:7; /* Terminating signal. */ |
| 4759 | + unsigned int __w_coredump:1; /* Set if dumped core. */ |
| 4760 | + unsigned int __w_retcode:8; /* Return code if exited normally. */ |
| 4761 | + unsigned int:16; |
| 4762 | +# endif /* Little endian. */ |
| 4763 | +# if __BYTE_ORDER == __BIG_ENDIAN |
| 4764 | + unsigned int:16; |
| 4765 | + unsigned int __w_retcode:8; |
| 4766 | + unsigned int __w_coredump:1; |
| 4767 | + unsigned int __w_termsig:7; |
| 4768 | +# endif /* Big endian. */ |
| 4769 | + } __wait_terminated; |
| 4770 | + struct |
| 4771 | + { |
| 4772 | +# if __BYTE_ORDER == __LITTLE_ENDIAN |
| 4773 | + unsigned int __w_stopval:8; /* W_STOPPED if stopped. */ |
| 4774 | + unsigned int __w_stopsig:8; /* Stopping signal. */ |
| 4775 | + unsigned int:16; |
| 4776 | +# endif /* Little endian. */ |
| 4777 | +# if __BYTE_ORDER == __BIG_ENDIAN |
| 4778 | + unsigned int:16; |
| 4779 | + unsigned int __w_stopsig:8; /* Stopping signal. */ |
| 4780 | + unsigned int __w_stopval:8; /* W_STOPPED if stopped. */ |
| 4781 | +# endif /* Big endian. */ |
| 4782 | + } __wait_stopped; |
| 4783 | + }; |
| 4784 | + |
| 4785 | +# define w_termsig __wait_terminated.__w_termsig |
| 4786 | +# define w_coredump __wait_terminated.__w_coredump |
| 4787 | +# define w_retcode __wait_terminated.__w_retcode |
| 4788 | +# define w_stopsig __wait_stopped.__w_stopsig |
| 4789 | +# define w_stopval __wait_stopped.__w_stopval |
| 4790 | + |
| 4791 | +#endif /* Use BSD. */ |
| 4792 | --- /dev/null |
| 4793 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/brk.c |
| 4794 | @@ -0,0 +1,50 @@ |
| 4795 | +/* Copyright (C) 2004, 2010 Free Software Foundation, Inc. |
| 4796 | + This file is part of the GNU C Library. |
| 4797 | + Contributed by Robert Millan |
| 4798 | + |
| 4799 | + The GNU C Library is free software; you can redistribute it and/or |
| 4800 | + modify it under the terms of the GNU Lesser General Public |
| 4801 | + License as published by the Free Software Foundation; either |
| 4802 | + version 2.1 of the License, or (at your option) any later version. |
| 4803 | + |
| 4804 | + The GNU C Library is distributed in the hope that it will be useful, |
| 4805 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 4806 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 4807 | + Lesser General Public License for more details. |
| 4808 | + |
| 4809 | + You should have received a copy of the GNU Lesser General Public |
| 4810 | + License along with the GNU C Library; if not, write to the Free |
| 4811 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 4812 | + 02111-1307 USA. */ |
| 4813 | + |
| 4814 | +#include <errno.h> |
| 4815 | +#include <unistd.h> |
| 4816 | +#include <sysdep.h> |
| 4817 | + |
| 4818 | +extern int __syscall_obreak (void *addr); |
| 4819 | +libc_hidden_proto (__syscall_obreak) |
| 4820 | + |
| 4821 | +extern void _end; |
| 4822 | + |
| 4823 | +/* sbrk.c expects this. */ |
| 4824 | +void *__curbrk = &_end; |
| 4825 | + |
| 4826 | +/* Set the end of the process's data space to ADDR. |
| 4827 | + Return 0 if successful, -1 if not. */ |
| 4828 | +int |
| 4829 | +__brk (addr) |
| 4830 | + void *addr; |
| 4831 | +{ |
| 4832 | + if (addr < &_end) |
| 4833 | + return 0; |
| 4834 | + |
| 4835 | + if (INLINE_SYSCALL (obreak, 1, addr) == -1) |
| 4836 | + { |
| 4837 | + __set_errno (ENOMEM); |
| 4838 | + return -1; |
| 4839 | + } |
| 4840 | + |
| 4841 | + __curbrk = addr; |
| 4842 | + return 0; |
| 4843 | +} |
| 4844 | +weak_alias (__brk, brk) |
| 4845 | --- /dev/null |
| 4846 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/check_fds.c |
| 4847 | @@ -0,0 +1 @@ |
| 4848 | +void __libc_check_standard_fds (void) {;} |
| 4849 | --- /dev/null |
| 4850 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/check_native.c |
| 4851 | @@ -0,0 +1,42 @@ |
| 4852 | +/* Determine whether interfaces use native transport. Dummy version. |
| 4853 | + Copyright (C) 2008 Free Software Foundation, Inc. |
| 4854 | + This file is part of the GNU C Library. |
| 4855 | + |
| 4856 | + The GNU C Library is free software; you can redistribute it and/or |
| 4857 | + modify it under the terms of the GNU Lesser General Public |
| 4858 | + License as published by the Free Software Foundation; either |
| 4859 | + version 2.1 of the License, or (at your option) any later version. |
| 4860 | + |
| 4861 | + The GNU C Library is distributed in the hope that it will be useful, |
| 4862 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 4863 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 4864 | + Lesser General Public License for more details. |
| 4865 | + |
| 4866 | + You should have received a copy of the GNU Lesser General Public |
| 4867 | + License along with the GNU C Library; if not, write to the Free |
| 4868 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 4869 | + 02111-1307 USA. */ |
| 4870 | + |
| 4871 | +#include <assert.h> |
| 4872 | +#include <errno.h> |
| 4873 | +#include <ifaddrs.h> |
| 4874 | +#include <stddef.h> |
| 4875 | +#include <stdint.h> |
| 4876 | +#include <stdlib.h> |
| 4877 | +#include <time.h> |
| 4878 | +#include <unistd.h> |
| 4879 | +#include <net/if.h> |
| 4880 | +#include <net/if_arp.h> |
| 4881 | +#include <sys/ioctl.h> |
| 4882 | + |
| 4883 | +#include <not-cancel.h> |
| 4884 | + |
| 4885 | + |
| 4886 | +void |
| 4887 | +__check_native (uint32_t a1_index, int *a1_native, |
| 4888 | + uint32_t a2_index, int *a2_native) |
| 4889 | +{ |
| 4890 | + |
| 4891 | +#warning __check_native() not yet implemented |
| 4892 | + return; |
| 4893 | +} |
| 4894 | --- /dev/null |
| 4895 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/check_pf.c |
| 4896 | @@ -0,0 +1 @@ |
| 4897 | +#include <inet/check_pf.c> |
| 4898 | --- /dev/null |
| 4899 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/clock_getres.c |
| 4900 | @@ -0,0 +1,42 @@ |
| 4901 | +/* Copyright (C) 2006 Free Software Foundation, Inc. |
| 4902 | + This file is part of the GNU C Library. |
| 4903 | + |
| 4904 | + The GNU C Library is free software; you can redistribute it and/or |
| 4905 | + modify it under the terms of the GNU Lesser General Public |
| 4906 | + License as published by the Free Software Foundation; either |
| 4907 | + version 2.1 of the License, or (at your option) any later version. |
| 4908 | + |
| 4909 | + The GNU C Library is distributed in the hope that it will be useful, |
| 4910 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 4911 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 4912 | + Lesser General Public License for more details. |
| 4913 | + |
| 4914 | + You should have received a copy of the GNU Lesser General Public |
| 4915 | + License along with the GNU C Library; if not, write to the Free |
| 4916 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 4917 | + 02111-1307 USA. */ |
| 4918 | + |
| 4919 | +#include <sysdep.h> |
| 4920 | + |
| 4921 | +int __syscall_clock_getres(clockid_t clock_id, struct timespec *tp); |
| 4922 | +libc_hidden_proto (__syscall_clock_getres) |
| 4923 | + |
| 4924 | +# define SYSDEP_GETRES \ |
| 4925 | + case CLOCK_REALTIME: \ |
| 4926 | + case CLOCK_MONOTONIC: \ |
| 4927 | + case CLOCK_REALTIME_FAST: \ |
| 4928 | + case CLOCK_REALTIME_PRECISE: \ |
| 4929 | + case CLOCK_MONOTONIC_FAST: \ |
| 4930 | + case CLOCK_MONOTONIC_PRECISE: \ |
| 4931 | + case CLOCK_UPTIME: \ |
| 4932 | + case CLOCK_UPTIME_FAST: \ |
| 4933 | + case CLOCK_UPTIME_PRECISE: \ |
| 4934 | + case CLOCK_VIRTUAL: \ |
| 4935 | + case CLOCK_SECOND: \ |
| 4936 | + retval = INLINE_SYSCALL (clock_getres, 2, clock_id, res); \ |
| 4937 | + break |
| 4938 | + |
| 4939 | +/* We handled the REALTIME clock here. */ |
| 4940 | +# define HANDLED_REALTIME 1 |
| 4941 | + |
| 4942 | +#include <sysdeps/posix/clock_getres.c> |
| 4943 | --- /dev/null |
| 4944 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/clock_gettime.c |
| 4945 | @@ -0,0 +1,42 @@ |
| 4946 | +/* Copyright (C) 2006 Free Software Foundation, Inc. |
| 4947 | + This file is part of the GNU C Library. |
| 4948 | + |
| 4949 | + The GNU C Library is free software; you can redistribute it and/or |
| 4950 | + modify it under the terms of the GNU Lesser General Public |
| 4951 | + License as published by the Free Software Foundation; either |
| 4952 | + version 2.1 of the License, or (at your option) any later version. |
| 4953 | + |
| 4954 | + The GNU C Library is distributed in the hope that it will be useful, |
| 4955 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 4956 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 4957 | + Lesser General Public License for more details. |
| 4958 | + |
| 4959 | + You should have received a copy of the GNU Lesser General Public |
| 4960 | + License along with the GNU C Library; if not, write to the Free |
| 4961 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 4962 | + 02111-1307 USA. */ |
| 4963 | + |
| 4964 | +#include <sysdep.h> |
| 4965 | +#include "kernel-posix-cpu-timers.h" |
| 4966 | + |
| 4967 | +int __syscall_clock_gettime(clockid_t clock_id, struct timespec *tp); |
| 4968 | +libc_hidden_proto (__syscall_clock_gettime) |
| 4969 | + |
| 4970 | +# define SYSDEP_GETTIME \ |
| 4971 | + case CLOCK_REALTIME: \ |
| 4972 | + case CLOCK_MONOTONIC: \ |
| 4973 | + case CLOCK_REALTIME_FAST: \ |
| 4974 | + case CLOCK_REALTIME_PRECISE: \ |
| 4975 | + case CLOCK_MONOTONIC_FAST: \ |
| 4976 | + case CLOCK_MONOTONIC_PRECISE: \ |
| 4977 | + case CLOCK_UPTIME: \ |
| 4978 | + case CLOCK_UPTIME_FAST: \ |
| 4979 | + case CLOCK_UPTIME_PRECISE: \ |
| 4980 | + case CLOCK_VIRTUAL: \ |
| 4981 | + case CLOCK_SECOND: \ |
| 4982 | + retval = INLINE_SYSCALL (clock_gettime, 2, clock_id, tp); \ |
| 4983 | + break |
| 4984 | + |
| 4985 | +/* We handled the REALTIME clock here. */ |
| 4986 | +# define HANDLED_REALTIME 1 |
| 4987 | +#include <sysdeps/unix/clock_gettime.c> |
| 4988 | --- /dev/null |
| 4989 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/clock_settime.c |
| 4990 | @@ -0,0 +1,32 @@ |
| 4991 | +/* Copyright (C) 2006 Free Software Foundation, Inc. |
| 4992 | + This file is part of the GNU C Library. |
| 4993 | + |
| 4994 | + The GNU C Library is free software; you can redistribute it and/or |
| 4995 | + modify it under the terms of the GNU Lesser General Public |
| 4996 | + License as published by the Free Software Foundation; either |
| 4997 | + version 2.1 of the License, or (at your option) any later version. |
| 4998 | + |
| 4999 | + The GNU C Library is distributed in the hope that it will be useful, |
| 5000 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 5001 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 5002 | + Lesser General Public License for more details. |
| 5003 | + |
| 5004 | + You should have received a copy of the GNU Lesser General Public |
| 5005 | + License along with the GNU C Library; if not, write to the Free |
| 5006 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 5007 | + 02111-1307 USA. */ |
| 5008 | + |
| 5009 | +#include <sysdep.h> |
| 5010 | +#include "kernel-posix-cpu-timers.h" |
| 5011 | + |
| 5012 | +int __syscall_clock_settime(clockid_t clock_id, const struct timespec *tp); |
| 5013 | +libc_hidden_proto (__syscall_clock_settime) |
| 5014 | + |
| 5015 | +# define SYSDEP_SETTIME \ |
| 5016 | + case CLOCK_REALTIME: \ |
| 5017 | + retval = INLINE_SYSCALL (clock_settime, 2, clock_id, tp); \ |
| 5018 | + break |
| 5019 | +/* We handled the REALTIME clock here. */ |
| 5020 | +# define HANDLED_REALTIME 1 |
| 5021 | + |
| 5022 | +#include <sysdeps/unix/clock_settime.c> |
| 5023 | --- /dev/null |
| 5024 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/clone.c |
| 5025 | @@ -0,0 +1,122 @@ |
| 5026 | +/* Create a thread. |
| 5027 | + Copyright (C) 2002 Free Software Foundation, Inc. |
| 5028 | + This file is part of the GNU C Library. |
| 5029 | + Contributed by Bruno Haible <bruno@clisp.org>, 2002. |
| 5030 | + |
| 5031 | + The GNU C Library is free software; you can redistribute it and/or |
| 5032 | + modify it under the terms of the GNU Lesser General Public |
| 5033 | + License as published by the Free Software Foundation; either |
| 5034 | + version 2.1 of the License, or (at your option) any later version. |
| 5035 | + |
| 5036 | + The GNU C Library is distributed in the hope that it will be useful, |
| 5037 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 5038 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 5039 | + Lesser General Public License for more details. |
| 5040 | + |
| 5041 | + You should have received a copy of the GNU Lesser General Public |
| 5042 | + License along with the GNU C Library; if not, write to the Free |
| 5043 | + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 5044 | + 02111-1307 USA. */ |
| 5045 | + |
| 5046 | +#define __clone __no_broken_clone_decl |
| 5047 | +#include <sched.h> |
| 5048 | +#include <sys/rfork.h> |
| 5049 | +#include <errno.h> |
| 5050 | +#include <signal.h> |
| 5051 | +#include <stddef.h> |
| 5052 | +#include <getosreldate.h> |
| 5053 | +#undef __clone |
| 5054 | + |
| 5055 | +/* __start_thread (flags, child_stack, fn, arg) |
| 5056 | + is roughly equivalent to |
| 5057 | + |
| 5058 | + int retval = __rfork (flags); |
| 5059 | + if (retval == 0) |
| 5060 | + { |
| 5061 | + // Here we are in the child thread. |
| 5062 | + %stackpointer = child_stack; |
| 5063 | + _exit (fn (arg)); |
| 5064 | + } |
| 5065 | + return retval; |
| 5066 | + |
| 5067 | + but it cannot be done in portable C because it must access fn and arg |
| 5068 | + after having replaced the stack pointer. */ |
| 5069 | + |
| 5070 | +extern int __start_thread (int flags, void *child_stack, |
| 5071 | + int (*fn) (void *), void *arg); |
| 5072 | + |
| 5073 | +int __clone (int (*fn) (void *), void *child_stack, int flags, void *arg) |
| 5074 | +{ |
| 5075 | + int rfork_flags = RFPROC; |
| 5076 | + |
| 5077 | + if (fn == NULL || child_stack == NULL) |
| 5078 | + { |
| 5079 | + __set_errno (EINVAL); |
| 5080 | + return -1; |
| 5081 | + } |
| 5082 | + |
| 5083 | + /* This implementation of clone() does not support all Linux flags. */ |
| 5084 | + if (flags & ~(CSIGNAL | CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |
| 5085 | + | CLONE_VFORK | CLONE_SYSVSEM)) |
| 5086 | + { |
| 5087 | + __set_errno (EINVAL); |
| 5088 | + return -1; |
| 5089 | + } |
| 5090 | + |
| 5091 | + if ((flags & CSIGNAL) != SIGCHLD) |
| 5092 | + { |
| 5093 | + if (__kernel_getosreldate() >= 802510) |
| 5094 | + /* we slightly cheat here, */ |
| 5095 | + /* the 9.x snapshot prior to r223966 does not support it too */ |
| 5096 | + { |
| 5097 | + if ((flags & CSIGNAL) & ~RFTSIGMASK) |
| 5098 | + { |
| 5099 | + __set_errno (EINVAL); |
| 5100 | + return -1; |
| 5101 | + } |
| 5102 | + rfork_flags |= (RFTSIGZMB | RFTSIGFLAGS(flags & CSIGNAL)); |
| 5103 | + } |
| 5104 | + else |
| 5105 | + { |
| 5106 | + if ((flags & CSIGNAL) & ~RFTHPNMASK) |
| 5107 | + { |
| 5108 | + __set_errno (EINVAL); |
| 5109 | + return -1; |
| 5110 | + } |
| 5111 | + if ((flags & CSIGNAL) == 0) |
| 5112 | + rfork_flags |= (RFLINUXTHPN | ((SIGCHLD) << RFTHPNSHIFT)); |
| 5113 | + else |
| 5114 | + rfork_flags |= (RFLINUXTHPN | ((flags & CSIGNAL) << RFTHPNSHIFT)); |
| 5115 | + } |
| 5116 | + } |
| 5117 | + if (flags & CLONE_VM) |
| 5118 | + rfork_flags |= RFMEM; |
| 5119 | + |
| 5120 | + if (flags & CLONE_FS) |
| 5121 | + /* Sharing the filesystem related info (umask, cwd, root dir) |
| 5122 | + is not supported by rfork. Ignore this; let's hope programs |
| 5123 | + will set their umask and cwd before spawning threads. */ |
| 5124 | + ; |
| 5125 | + |
| 5126 | + if (flags & CLONE_SYSVSEM) |
| 5127 | + /* Ignore this; it has been introduced into linuxthreads in post 2.4 glibc */ |
| 5128 | + ; |
| 5129 | + |
| 5130 | + if (!(flags & CLONE_FILES)) |
| 5131 | + rfork_flags |= RFFDG; |
| 5132 | + |
| 5133 | + if (flags & CLONE_SIGHAND) |
| 5134 | + { |
| 5135 | + rfork_flags |= RFSIGSHARE; |
| 5136 | + /* Also set the undocumented flag RFTHREAD. It has the effect that when |
| 5137 | + the thread leader exits, all threads belonging to it are killed. */ |
| 5138 | + rfork_flags |= RFTHREAD; |
| 5139 | + } |
| 5140 | + |
| 5141 | + if (flags & CLONE_VFORK) |
| 5142 | + rfork_flags |= RFPPWAIT; |
| 5143 | + |
| 5144 | + return __start_thread (rfork_flags, child_stack, fn, arg); |
| 5145 | +} |
| 5146 | + |
| 5147 | +weak_alias (__clone, clone) |
| 5148 | --- /dev/null |
| 5149 | +++ b/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/configure |
| 5150 | @@ -0,0 +1,353 @@ |
| 5151 | +# This file is generated from configure.in by Autoconf. DO NOT EDIT! |
| 5152 | + # Local configure fragment for sysdeps/unix/bsd/bsd4.4/kfreebsd. |
| 5153 | + |
| 5154 | +case "$machine" in |
| 5155 | + x86_64*) |
| 5156 | + echo "Adding extra sysnames for kfreebsd/x86_64/elf" |
| 5157 | + sysnames="ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/elf $sysnames" |
| 5158 | + ;; |
| 5159 | + mips*) |
| 5160 | + echo "Adding extra sysnames for kfreebsd/mips/elf" |
| 5161 | + sysnames="ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/mips/elf $sysnames" |
| 5162 | + ;; |
| 5163 | +esac |
| 5164 | + |
| 5165 | +# The kFreeBSD headers can be found in |
| 5166 | +# /usr/src/sys/ |
| 5167 | +# Check whether this directory is available. |
| 5168 | +if test -z "$sysheaders" && |
| 5169 | + test "x$cross_compiling" = xno && |
| 5170 | + test -d /usr/src/sys/ ; then |
| 5171 | + sysheaders="/usr/src/sys/" |
| 5172 | + ccheaders=`$CC -print-file-name=include` |
| 5173 | + SYSINCLUDES="-I $sysheaders" |
| 5174 | +fi |
| 5175 | + |
| 5176 | +# Don't bother trying to generate any glue code to be compatible with the |
| 5177 | +# existing system library, because we are the only system library. |
| 5178 | +inhibit_glue=yes |
| 5179 | + |
| 5180 | +if test -n "$sysheaders"; then |
| 5181 | + OLD_CPPFLAGS=$CPPFLAGS |
| 5182 | + CPPFLAGS="$CPPFLAGS $SYSINCLUDES" |
| 5183 | +fi |
| 5184 | + |
| 5185 | + |
| 5186 | +echo "$as_me:$LINENO: checking for egrep" >&5 |
| 5187 | +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 |
| 5188 | +if test "${ac_cv_prog_egrep+set}" = set; then |
| 5189 | + echo $ECHO_N "(cached) $ECHO_C" >&6 |
| 5190 | +else |
| 5191 | + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 |
| 5192 | + then ac_cv_prog_egrep='grep -E' |
| 5193 | + else ac_cv_prog_egrep='egrep' |
| 5194 | + fi |
| 5195 | +fi |
| 5196 | +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 |
| 5197 | +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 |
| 5198 | + EGREP=$ac_cv_prog_egrep |
| 5199 | + |
| 5200 | + |
| 5201 | +echo "$as_me:$LINENO: checking installed kFreeBSD kernel header files" >&5 |
| 5202 | +echo $ECHO_N "checking installed kFreeBSD kernel header files... $ECHO_C" >&6 |
| 5203 | +if test "${libc_cv_kfreebsd600+set}" = set; then |
| 5204 | + echo $ECHO_N "(cached) $ECHO_C" >&6 |
| 5205 | +else |
| 5206 | + cat >conftest.$ac_ext <<_ACEOF |
| 5207 | +/* confdefs.h. */ |
| 5208 | +_ACEOF |
| 5209 | +cat confdefs.h >>conftest.$ac_ext |
| 5210 | +cat >>conftest.$ac_ext <<_ACEOF |
| 5211 | +/* end confdefs.h. */ |
| 5212 | +#include <osreldate.h> |
| 5213 | +#if !defined(__FreeBSD_kernel_version) && defined(__FreeBSD_version) |
| 5214 | +#define __FreeBSD_kernel_version __FreeBSD_version |
| 5215 | +#endif |
| 5216 | +#if !defined __FreeBSD_kernel_version || __FreeBSD_kernel_version < (6 *100000+ 0 *1000+ 0) /* 6.0.0 */ |
| 5217 | +eat flaming death |
| 5218 | +#endif |
| 5219 | +_ACEOF |
| 5220 | +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | |
| 5221 | + $EGREP "eat flaming death" >/dev/null 2>&1; then |
| 5222 | + libc_cv_kfreebsd600='TOO OLD!' |
| 5223 | +else |
| 5224 | + libc_cv_kfreebsd600='6.0.0 or later' |
| 5225 | +fi |
| 5226 | +rm -f conftest* |
| 5227 | + |
| 5228 | +fi |
| 5229 | +echo "$as_me:$LINENO: result: $libc_cv_kfreebsd600" >&5 |
| 5230 | +echo "${ECHO_T}$libc_cv_kfreebsd600" >&6 |
| 5231 | +if test "$libc_cv_kfreebsd600" != '6.0.0 or later'; then |
| 5232 | + { { echo "$as_me:$LINENO: error: GNU libc requires kernel header files from |
| 5233 | +kFreeBSD 6.0.0 or later to be installed before configuring. |
| 5234 | +The kernel header files are found usually in /usr/src/sys/; make sure |
| 5235 | +these directories use files from kFreeBSD 6.0.0 or later. |
| 5236 | +This check uses <osreldate.h>, so |
| 5237 | +make sure that file was built correctly when installing the kernel header |
| 5238 | +files. To use kernel headers not from /usr/src/sys/, use the |
| 5239 | +configure option --with-headers." >&5 |
| 5240 | +echo "$as_me: error: GNU libc requires kernel header files from |
| 5241 | +kFreeBSD 6.0.0 or later to be installed before configuring. |
| 5242 | +The kernel header files are found usually in /usr/src/sys/; make sure |
| 5243 | +these directories use files from kFreeBSD 6.0.0 or later. |
| 5244 | +This check uses <osreldate.h>, so |
| 5245 | +make sure that file was built correctly when installing the kernel header |
| 5246 | +files. To use kernel headers not from /usr/src/sys/, use the |
| 5247 | +configure option --with-headers." >&2;} |
| 5248 | + { (exit 1); exit 1; }; } |
| 5249 | +fi |
| 5250 | + |
| 5251 | +# Check whether --enable-compatible-utmp or --disable-compatible-utmp was given. |
| 5252 | +if test "${enable_compatible_utmp+set}" = set; then |
| 5253 | + enableval="$enable_compatible_utmp" |
| 5254 | + enable_utmp_compat=$enableval |
| 5255 | +else |
| 5256 | + enable_utmp_compat=no |
| 5257 | +fi; |
| 5258 | +if test "$enable_utmp_compat" = no; then |
| 5259 | + utmp_subdir=utmp-utmpx |
| 5260 | +else |
| 5261 | + utmp_subdir=utmp-compat |
| 5262 | +fi |
| 5263 | +sysnames="$sysnames sysdeps/unix/bsd/bsd4.4/kfreebsd/$utmp_subdir" |
| 5264 | + |
| 5265 | +# If the user gave a minimal version number test whether the available |
| 5266 | +# kernel headers are young enough. Additionally we have minimal |
| 5267 | +# kernel versions for some architectures. If a previous configure fragment |
| 5268 | +# set arch_minimum_kernel already, let that override our defaults here. |
| 5269 | +# Note that we presume such a fragment has set libc_cv_gcc_unwind_find_fde |
| 5270 | +# if appropriate too. |
| 5271 | +test -n "$arch_minimum_kernel" || |
| 5272 | +case "$machine" in |
| 5273 | + i386*) |
| 5274 | + libc_cv_gcc_unwind_find_fde=yes |
| 5275 | + arch_minimum_kernel=6.0.0 |
| 5276 | + ;; |
| 5277 | + x86_64*) |
| 5278 | + arch_minimum_kernel=6.0.0 |
| 5279 | + ;; |
| 5280 | + *) |
| 5281 | + arch_minimum_kernel=6.0.0 |
| 5282 | + ;; |
| 5283 | +esac |
| 5284 | +if test -n "$minimum_kernel"; then |
| 5285 | + |
| 5286 | + user_version=$((`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 65536 + \2 \* 256 + \3/'`)) |
| 5287 | + arch_version=$((`echo "$arch_minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 65536 + \2 \* 256 + \3/'`)) |
| 5288 | + |
| 5289 | + if test $user_version -lt $arch_version; then |
| 5290 | + { echo "$as_me:$LINENO: WARNING: minimum kernel version reset to $arch_minimum_kernel" >&5 |
| 5291 | +echo "$as_me: WARNING: minimum kernel version reset to $arch_minimum_kernel" >&2;} |
| 5292 | + minimum_kernel=$arch_minimum_kernel |
| 5293 | + fi |
| 5294 | +else |
| 5295 | + if test $arch_minimum_kernel != '6.0.0'; then |
| 5296 | + minimum_kernel=$arch_minimum_kernel |
| 5297 | + fi |
| 5298 | +fi |
| 5299 | + |
| 5300 | +if test -n "$minimum_kernel"; then |
| 5301 | + echo "$as_me:$LINENO: checking for kernel header at least $minimum_kernel" >&5 |
| 5302 | +echo $ECHO_N "checking for kernel header at least $minimum_kernel... $ECHO_C" >&6 |
| 5303 | + hdrnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 100000 + \2 * 1000 + \3)/'`; |
| 5304 | + decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`; |
| 5305 | + abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`; |
| 5306 | + cat >conftest.$ac_ext <<_ACEOF |
| 5307 | +/* confdefs.h. */ |
| 5308 | +_ACEOF |
| 5309 | +cat confdefs.h >>conftest.$ac_ext |
| 5310 | +cat >>conftest.$ac_ext <<_ACEOF |
| 5311 | +/* end confdefs.h. */ |
| 5312 | +#include <osreldate.h> |
| 5313 | +#if !defined(__FreeBSD_kernel_version) && defined(__FreeBSD_version) |
| 5314 | +#define __FreeBSD_kernel_version __FreeBSD_version |
| 5315 | +#endif |
| 5316 | +#if __FreeBSD_kernel_version < $hdrnum |
| 5317 | +eat flaming death |
| 5318 | +#endif |
| 5319 | +_ACEOF |