diff options
author | 2013-08-13 05:52:02 +0000 | |
---|---|---|
committer | 2013-08-13 05:52:02 +0000 | |
commit | 91a535ff42f6347677741774730dc5ddcf7d5b93 (patch) | |
tree | bf11ae7a89610ba77e8820cdad3ce3fd293bc1f4 /lib | |
parent | Add the TCP socket option TCP_NOPUSH to delay sending the stream. (diff) | |
download | wireguard-openbsd-91a535ff42f6347677741774730dc5ddcf7d5b93.tar.xz wireguard-openbsd-91a535ff42f6347677741774730dc5ddcf7d5b93.zip |
Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.
Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.
DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.
Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@
Diffstat (limited to 'lib')
33 files changed, 59 insertions, 157 deletions
diff --git a/lib/libc/gen/closedir.c b/lib/libc/gen/closedir.c index 48d2775d7ea..86b7de13430 100644 --- a/lib/libc/gen/closedir.c +++ b/lib/libc/gen/closedir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: closedir.c,v 1.8 2007/06/05 18:11:48 kurt Exp $ */ +/* $OpenBSD: closedir.c,v 1.9 2013/08/13 05:52:12 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * Regents of the University of California. All rights reserved. @@ -46,8 +46,6 @@ closedir(DIR *dirp) _MUTEX_LOCK(&dirp->dd_lock); fd = dirp->dd_fd; dirp->dd_fd = -1; - dirp->dd_loc = 0; - free(dirp->dd_td->td_locs); free(dirp->dd_buf); _MUTEX_UNLOCK(&dirp->dd_lock); _MUTEX_DESTROY(&dirp->dd_lock); diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c index 99cda4c1ad4..eb139effaae 100644 --- a/lib/libc/gen/opendir.c +++ b/lib/libc/gen/opendir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: opendir.c,v 1.23 2011/07/18 17:29:49 matthew Exp $ */ +/* $OpenBSD: opendir.c,v 1.24 2013/08/13 05:52:12 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -39,7 +39,7 @@ #include "telldir.h" -static DIR *__fdopendir(int fd, off_t offset); +static DIR *__fdopendir(int fd); /* * Open a directory specified by name. @@ -52,7 +52,7 @@ opendir(const char *name) if ((fd = open(name, O_RDONLY | O_DIRECTORY | O_CLOEXEC)) == -1) return (NULL); - dirp = __fdopendir(fd, 0); + dirp = __fdopendir(fd); if (dirp == NULL) close(fd); return (dirp); @@ -66,7 +66,6 @@ fdopendir(int fd) { DIR *dirp; int flags; - off_t offset; if ((flags = fcntl(fd, F_GETFL)) == -1) return (NULL); @@ -74,9 +73,7 @@ fdopendir(int fd) errno = EBADF; return (NULL); } - if ((offset = lseek(fd, 0, SEEK_CUR)) == -1) - return (NULL); - dirp = __fdopendir(fd, offset); + dirp = __fdopendir(fd); if (dirp != NULL) { /* * POSIX doesn't require fdopendir() to set @@ -88,7 +85,7 @@ fdopendir(int fd) } static DIR * -__fdopendir(int fd, off_t offset) +__fdopendir(int fd) { DIR *dirp; struct stat sb; @@ -100,14 +97,9 @@ __fdopendir(int fd, off_t offset) errno = ENOTDIR; return (NULL); } - if ((dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL) + if ((dirp = malloc(sizeof(DIR))) == NULL) return (NULL); - /* - * Use a buffer that is page aligned. - * Hopefully this can be a big win someday by allowing page trades - * to user space to be done by getdirentries() - */ pageoffset = getpagesize() - 1; dirp->dd_len = ((int)sb.st_blksize + pageoffset) & ~pageoffset; dirp->dd_buf = malloc((size_t)dirp->dd_len); @@ -116,28 +108,10 @@ __fdopendir(int fd, off_t offset) return (NULL); } - dirp->dd_td = (struct _telldir *)((char *)dirp + sizeof(DIR)); - dirp->dd_td->td_locs = NULL; - dirp->dd_td->td_sz = 0; - dirp->dd_td->td_loccnt = 0; - dirp->dd_td->td_last = 0; - - dirp->dd_seek = 0; dirp->dd_loc = 0; dirp->dd_fd = fd; - dirp->dd_unused = 0; dirp->dd_lock = NULL; - - /* - * Set up seek point for rewinddir. - */ - dirp->dd_rewind = telldir(dirp); - - /* - * Store our actual seek offset. Must do this *after* setting - * dd_rewind = telldir() so that rewinddir() works correctly. - */ - dirp->dd_seek = offset; + dirp->dd_curpos = 0; return (dirp); } diff --git a/lib/libc/gen/readdir.c b/lib/libc/gen/readdir.c index eb9216219cb..7fa81dbd38d 100644 --- a/lib/libc/gen/readdir.c +++ b/lib/libc/gen/readdir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readdir.c,v 1.17 2012/03/22 04:11:53 matthew Exp $ */ +/* $OpenBSD: readdir.c,v 1.18 2013/08/13 05:52:12 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -46,8 +46,8 @@ _readdir_unlocked(DIR *dirp, struct dirent **result, int skipdeleted) if (dirp->dd_loc >= dirp->dd_size) dirp->dd_loc = 0; if (dirp->dd_loc == 0) { - dirp->dd_size = getdirentries(dirp->dd_fd, - dirp->dd_buf, dirp->dd_len, &dirp->dd_seek); + dirp->dd_size = getdents(dirp->dd_fd, + (void *)dirp->dd_buf, dirp->dd_len); if (dirp->dd_size == 0) return (0); if (dirp->dd_size < 0) @@ -70,6 +70,7 @@ _readdir_unlocked(DIR *dirp, struct dirent **result, int skipdeleted) */ if (dp->d_ino == 0 && skipdeleted) continue; + dirp->dd_curpos = dp->d_off; *result = dp; return (0); } diff --git a/lib/libc/gen/rewinddir.c b/lib/libc/gen/rewinddir.c index 2ac2554ba51..3844b63efdb 100644 --- a/lib/libc/gen/rewinddir.c +++ b/lib/libc/gen/rewinddir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rewinddir.c,v 1.9 2007/10/12 22:41:42 chl Exp $ */ +/* $OpenBSD: rewinddir.c,v 1.10 2013/08/13 05:52:12 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -38,7 +38,6 @@ void rewinddir(DIR *dirp) { _MUTEX_LOCK(&dirp->dd_lock); - __seekdir(dirp, dirp->dd_rewind); - dirp->dd_rewind = _telldir_unlocked(dirp); + __seekdir(dirp, 0); _MUTEX_UNLOCK(&dirp->dd_lock); } diff --git a/lib/libc/gen/telldir.c b/lib/libc/gen/telldir.c index 5ffdfc1a6a9..186dfa04e33 100644 --- a/lib/libc/gen/telldir.c +++ b/lib/libc/gen/telldir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: telldir.c,v 1.13 2008/05/01 19:49:18 otto Exp $ */ +/* $OpenBSD: telldir.c,v 1.14 2013/08/13 05:52:12 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -45,36 +45,7 @@ int _readdir_unlocked(DIR *, struct dirent **, int); long _telldir_unlocked(DIR *dirp) { - long i; - struct ddloc *lp; - - i = dirp->dd_td->td_last; - lp = &dirp->dd_td->td_locs[i]; - - /* return previous telldir, if there */ - for (; i < dirp->dd_td->td_loccnt; i++, lp++) { - if (lp->loc_seek == dirp->dd_seek && - lp->loc_loc == dirp->dd_loc) { - dirp->dd_td->td_last = i; - return (i); - } - } - - if (dirp->dd_td->td_loccnt == dirp->dd_td->td_sz) { - size_t newsz = dirp->dd_td->td_sz * 2 + 1; - struct ddloc *p; - p = realloc(dirp->dd_td->td_locs, newsz * sizeof(*p)); - if (p == NULL) - return (-1); - dirp->dd_td->td_sz = newsz; - dirp->dd_td->td_locs = p; - lp = &dirp->dd_td->td_locs[i]; - } - dirp->dd_td->td_loccnt++; - lp->loc_seek = dirp->dd_seek; - lp->loc_loc = dirp->dd_loc; - dirp->dd_td->td_last = i; - return (i); + return (dirp->dd_curpos); } long @@ -96,21 +67,5 @@ telldir(DIR *dirp) void __seekdir(DIR *dirp, long loc) { - struct ddloc *lp; - struct dirent *dp; - - if (loc < 0 || loc >= dirp->dd_td->td_loccnt) - return; - lp = &dirp->dd_td->td_locs[loc]; - dirp->dd_td->td_last = loc; - if (lp->loc_loc == dirp->dd_loc && lp->loc_seek == dirp->dd_seek) - return; - (void) lseek(dirp->dd_fd, (off_t)lp->loc_seek, SEEK_SET); - dirp->dd_seek = lp->loc_seek; - dirp->dd_loc = 0; - while (dirp->dd_loc < lp->loc_loc) { - _readdir_unlocked(dirp, &dp, 0); - if (dp == NULL) - break; - } + lseek(dirp->dd_fd, loc, SEEK_SET); } diff --git a/lib/libc/gen/telldir.h b/lib/libc/gen/telldir.h index 7209278a648..ab3fb4b920d 100644 --- a/lib/libc/gen/telldir.h +++ b/lib/libc/gen/telldir.h @@ -1,4 +1,4 @@ -/* $OpenBSD: telldir.h,v 1.5 2012/03/22 04:11:53 matthew Exp $ */ +/* $OpenBSD: telldir.h,v 1.6 2013/08/13 05:52:13 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -36,39 +36,14 @@ #ifndef _TELLDIR_H_ #define _TELLDIR_H_ -/* - * One of these structures is malloced to describe the current directory - * position each time telldir is called. It records the current magic - * cookie returned by getdirentries and the offset within the buffer - * associated with that return value. - */ -struct ddloc { - off_t loc_seek; /* magic cookie returned by getdirentries */ - long loc_loc; /* offset of entry in buffer */ -}; - -/* - * One of these structures is malloced for each DIR to record telldir - * positions. - */ -struct _telldir { - struct ddloc *td_locs; /* locations */ - size_t td_sz; /* size of locations */ - long td_loccnt; /* index of entry for sequential readdir's */ - long td_last; /* last tell/seekdir */ -}; - /* structure describing an open directory. */ struct _dirdesc { int dd_fd; /* file descriptor associated with directory */ long dd_loc; /* offset in current buffer */ - long dd_size; /* amount of data returned by getdirentries */ + long dd_size; /* amount of data returned by getdents() */ char *dd_buf; /* data buffer */ int dd_len; /* size of data buffer */ - off_t dd_seek; /* magic cookie returned by getdirentries */ - off_t dd_rewind; /* magic cookie for rewinding */ - int dd_unused; /* was flags for readdir */ - struct _telldir *dd_td; /* telldir position recording */ + off_t dd_curpos; /* current cookie */ void *dd_lock; /* mutex to protect struct */ }; diff --git a/lib/libc/shlib_version b/lib/libc/shlib_version index 39abb884b02..c793174f6f1 100644 --- a/lib/libc/shlib_version +++ b/lib/libc/shlib_version @@ -1,4 +1,4 @@ -major=69 +major=70 minor=0 # note: If changes were made to include/thread_private.h or if system # calls were added/changed then librthread/shlib_version also be updated. diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index b1257bda135..6e68361b06c 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.113 2013/06/05 04:06:08 guenther Exp $ +# $OpenBSD: Makefile.inc,v 1.114 2013/08/13 05:52:13 guenther Exp $ # $NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $ # @(#)Makefile.inc 8.1 (Berkeley) 6/17/93 @@ -33,7 +33,7 @@ ASM= __get_tcb.o __getcwd.o __semctl.o __set_tcb.o __syscall.o \ fchdir.o fchflags.o fchmod.o fchmodat.o fchown.o \ fchownat.o fcntl.o fhopen.o fhstat.o fhstatfs.o \ flock.o fpathconf.o fstat.o fstatat.o fstatfs.o \ - fsync.o futimens.o futimes.o getdirentries.o getdtablecount.o \ + fsync.o futimens.o futimes.o getdents.o getdtablecount.o \ getegid.o geteuid.o getfh.o getfsstat.o getgid.o \ getgroups.o getitimer.o getpeername.o getpgid.o getpgrp.o \ getpid.o getppid.o getpriority.o getresgid.o getresuid.o \ diff --git a/lib/libcurses/shlib_version b/lib/libcurses/shlib_version index eb2c603aec0..262f3bc13b6 100644 --- a/lib/libcurses/shlib_version +++ b/lib/libcurses/shlib_version @@ -1,2 +1,2 @@ -major=12 -minor=1 +major=13 +minor=0 diff --git a/lib/libedit/shlib_version b/lib/libedit/shlib_version index 890c57389b5..3066b9771e7 100644 --- a/lib/libedit/shlib_version +++ b/lib/libedit/shlib_version @@ -1,2 +1,2 @@ -major=4 -minor=1 +major=5 +minor=0 diff --git a/lib/libevent/shlib_version b/lib/libevent/shlib_version index 3f0196ebf4a..d9961ea9fef 100644 --- a/lib/libevent/shlib_version +++ b/lib/libevent/shlib_version @@ -1,2 +1,2 @@ -major=3 -minor=1 +major=4 +minor=0 diff --git a/lib/libexpat/shlib_version b/lib/libexpat/shlib_version index c10074d52ae..f461c533903 100644 --- a/lib/libexpat/shlib_version +++ b/lib/libexpat/shlib_version @@ -1,2 +1,2 @@ -major=10 +major=11 minor=0 diff --git a/lib/libform/shlib_version b/lib/libform/shlib_version index 3066b9771e7..9c1551636c5 100644 --- a/lib/libform/shlib_version +++ b/lib/libform/shlib_version @@ -1,2 +1,2 @@ -major=5 +major=6 minor=0 diff --git a/lib/libfuse/shlib_version b/lib/libfuse/shlib_version index 97c9f92d6b8..1edea46de91 100644 --- a/lib/libfuse/shlib_version +++ b/lib/libfuse/shlib_version @@ -1,2 +1,2 @@ -major=0 +major=1 minor=0 diff --git a/lib/libkvm/shlib_version b/lib/libkvm/shlib_version index b91c32ce7c8..d85251eba7d 100644 --- a/lib/libkvm/shlib_version +++ b/lib/libkvm/shlib_version @@ -1,2 +1,2 @@ -major=13 -minor=1 +major=14 +minor=0 diff --git a/lib/libm/shlib_version b/lib/libm/shlib_version index d0f0988b418..1c5d96eb2aa 100644 --- a/lib/libm/shlib_version +++ b/lib/libm/shlib_version @@ -1,2 +1,2 @@ -major=8 +major=9 minor=0 diff --git a/lib/libmenu/shlib_version b/lib/libmenu/shlib_version index 3066b9771e7..9c1551636c5 100644 --- a/lib/libmenu/shlib_version +++ b/lib/libmenu/shlib_version @@ -1,2 +1,2 @@ -major=5 +major=6 minor=0 diff --git a/lib/libocurses/shlib_version b/lib/libocurses/shlib_version index 3066b9771e7..9c1551636c5 100644 --- a/lib/libocurses/shlib_version +++ b/lib/libocurses/shlib_version @@ -1,2 +1,2 @@ -major=5 +major=6 minor=0 diff --git a/lib/libossaudio/shlib_version b/lib/libossaudio/shlib_version index 3f0196ebf4a..d9961ea9fef 100644 --- a/lib/libossaudio/shlib_version +++ b/lib/libossaudio/shlib_version @@ -1,2 +1,2 @@ -major=3 -minor=1 +major=4 +minor=0 diff --git a/lib/libpanel/shlib_version b/lib/libpanel/shlib_version index 3066b9771e7..9c1551636c5 100644 --- a/lib/libpanel/shlib_version +++ b/lib/libpanel/shlib_version @@ -1,2 +1,2 @@ -major=5 +major=6 minor=0 diff --git a/lib/libpcap/shlib_version b/lib/libpcap/shlib_version index 5b844bbf422..d0f0988b418 100644 --- a/lib/libpcap/shlib_version +++ b/lib/libpcap/shlib_version @@ -1,2 +1,2 @@ -major=7 +major=8 minor=0 diff --git a/lib/librpcsvc/shlib_version b/lib/librpcsvc/shlib_version index c8860078e50..b52599a164f 100644 --- a/lib/librpcsvc/shlib_version +++ b/lib/librpcsvc/shlib_version @@ -1,2 +1,2 @@ -major=1 -minor=2 +major=2 +minor=0 diff --git a/lib/librthread/shlib_version b/lib/librthread/shlib_version index 8f4855b2ca5..94727e17b3a 100644 --- a/lib/librthread/shlib_version +++ b/lib/librthread/shlib_version @@ -1,2 +1,2 @@ -major=17 -minor=3 +major=18 +minor=0 diff --git a/lib/libskey/shlib_version b/lib/libskey/shlib_version index 900b4048a96..9c1551636c5 100644 --- a/lib/libskey/shlib_version +++ b/lib/libskey/shlib_version @@ -1,2 +1,2 @@ -major=5 -minor=1 +major=6 +minor=0 diff --git a/lib/libsndio/shlib_version b/lib/libsndio/shlib_version index d9961ea9fef..3066b9771e7 100644 --- a/lib/libsndio/shlib_version +++ b/lib/libsndio/shlib_version @@ -1,2 +1,2 @@ -major=4 +major=5 minor=0 diff --git a/lib/libsqlite3/shlib_version b/lib/libsqlite3/shlib_version index 6e8e0102955..cd2b605f972 100644 --- a/lib/libsqlite3/shlib_version +++ b/lib/libsqlite3/shlib_version @@ -1,3 +1,3 @@ -# $OpenBSD: shlib_version,v 1.7 2013/06/09 14:56:30 landry Exp $ -major=23 +# $OpenBSD: shlib_version,v 1.8 2013/08/13 05:52:16 guenther Exp $ +major=24 minor=0 diff --git a/lib/libssl/crypto/shlib_version b/lib/libssl/crypto/shlib_version index 629f8a9fc41..df4de0fc4dc 100644 --- a/lib/libssl/crypto/shlib_version +++ b/lib/libssl/crypto/shlib_version @@ -1,2 +1,2 @@ -major=22 +major=23 minor=0 diff --git a/lib/libssl/shlib_version b/lib/libssl/shlib_version index 0aab0406bf8..a5757c1bcc6 100644 --- a/lib/libssl/shlib_version +++ b/lib/libssl/shlib_version @@ -1,2 +1,2 @@ -major=19 +major=20 minor=0 diff --git a/lib/libssl/ssl/shlib_version b/lib/libssl/ssl/shlib_version index 0aab0406bf8..a5757c1bcc6 100644 --- a/lib/libssl/ssl/shlib_version +++ b/lib/libssl/ssl/shlib_version @@ -1,2 +1,2 @@ -major=19 +major=20 minor=0 diff --git a/lib/libusbhid/shlib_version b/lib/libusbhid/shlib_version index 3066b9771e7..9c1551636c5 100644 --- a/lib/libusbhid/shlib_version +++ b/lib/libusbhid/shlib_version @@ -1,2 +1,2 @@ -major=5 +major=6 minor=0 diff --git a/lib/libutil/shlib_version b/lib/libutil/shlib_version index 18279d15316..56246d02b24 100644 --- a/lib/libutil/shlib_version +++ b/lib/libutil/shlib_version @@ -1,2 +1,2 @@ -major=11 -minor=5 +major=12 +minor=0 diff --git a/lib/libwrap/shlib_version b/lib/libwrap/shlib_version index d9961ea9fef..3066b9771e7 100644 --- a/lib/libwrap/shlib_version +++ b/lib/libwrap/shlib_version @@ -1,2 +1,2 @@ -major=4 +major=5 minor=0 diff --git a/lib/libz/shlib_version b/lib/libz/shlib_version index 890c57389b5..3066b9771e7 100644 --- a/lib/libz/shlib_version +++ b/lib/libz/shlib_version @@ -1,2 +1,2 @@ -major=4 -minor=1 +major=5 +minor=0 |