IFC @ r222256
This commit is contained in:
commit
87c3644c64
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/bhyve/; revision=222259
@ -1132,6 +1132,10 @@ _kgzip= usr.sbin/kgzip
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${MK_BINUTILS} != "no"
|
||||
_binutils= gnu/usr.bin/binutils
|
||||
.endif
|
||||
|
||||
.if ${MK_CLANG} != "no"
|
||||
.if ${CC:T:Mclang} == "clang"
|
||||
_clang= usr.bin/clang
|
||||
@ -1139,12 +1143,16 @@ _clang_libs= lib/clang
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${MK_GCC} != "no"
|
||||
_cc= gnu/usr.bin/cc
|
||||
.endif
|
||||
|
||||
cross-tools:
|
||||
.for _tool in \
|
||||
${_clang_libs} \
|
||||
${_clang} \
|
||||
gnu/usr.bin/binutils \
|
||||
gnu/usr.bin/cc \
|
||||
${_binutils} \
|
||||
${_cc} \
|
||||
usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
|
||||
${_btxld} \
|
||||
${_crunchide} \
|
||||
@ -1205,7 +1213,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libheimntlm} \
|
||||
${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
|
||||
${_kerberos5_lib_libroken} \
|
||||
lib/libbz2 lib/libcom_err lib/libcrypt \
|
||||
lib/libexpat lib/libfetch \
|
||||
lib/libexpat \
|
||||
${_lib_libgssapi} ${_lib_libipx} \
|
||||
lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
|
||||
lib/ncurses/ncurses lib/ncurses/ncursesw \
|
||||
@ -1238,7 +1246,6 @@ _cddl_lib= cddl/lib
|
||||
_secure_lib_libcrypto= secure/lib/libcrypto
|
||||
_secure_lib_libssl= secure/lib/libssl
|
||||
lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
|
||||
lib/libfetch__L: secure/lib/libcrypto__L secure/lib/libssl__L lib/libmd__L
|
||||
.if ${MK_OPENSSH} != "no"
|
||||
_secure_lib_libssh= secure/lib/libssh
|
||||
secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
|
||||
@ -1274,7 +1281,7 @@ _lib_libypclnt= lib/libypclnt
|
||||
.endif
|
||||
|
||||
.if ${MK_OPENSSL} == "no"
|
||||
lib/libfetch__L lib/libradius__L: lib/libmd__L
|
||||
lib/libradius__L: lib/libmd__L
|
||||
.endif
|
||||
|
||||
.for _lib in ${_prereq_libs}
|
||||
@ -1553,7 +1560,8 @@ _xb-build-tools:
|
||||
_xb-cross-tools:
|
||||
.for _tool in \
|
||||
gnu/usr.bin/binutils \
|
||||
gnu/usr.bin/cc
|
||||
gnu/usr.bin/cc \
|
||||
usr.bin/ar
|
||||
${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
|
||||
cd ${.CURDIR}/${_tool}; \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ obj; \
|
||||
@ -1578,7 +1586,8 @@ _xi-cross-tools:
|
||||
@echo "_xi-cross-tools"
|
||||
.for _tool in \
|
||||
gnu/usr.bin/binutils \
|
||||
gnu/usr.bin/cc
|
||||
gnu/usr.bin/cc \
|
||||
usr.bin/ar
|
||||
${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
|
||||
cd ${.CURDIR}/${_tool}; \
|
||||
${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
|
||||
|
@ -75,7 +75,7 @@ DEVIATIONS
|
||||
2) Since the behavior of `u' (undo) within a `g' (global) command list is
|
||||
not specified by POSIX, it follows the behavior of the SunOS ed:
|
||||
undo forces a global command list to be executed only once, rather than
|
||||
for each line matching a global pattern. In addtion, each instance of
|
||||
for each line matching a global pattern. In addition, each instance of
|
||||
`u' within a global command undoes all previous commands (including
|
||||
undo's) in the command list. This seems the best way, since the
|
||||
alternatives are either too complicated to implement or too confusing
|
||||
@ -83,7 +83,7 @@ DEVIATIONS
|
||||
|
||||
The global/undo combination is useful for masking errors that
|
||||
would otherwise cause a script to fail. For instance, an ed script
|
||||
to remove any occurences of either `censor1' or `censor2' might be
|
||||
to remove any occurrences of either `censor1' or `censor2' might be
|
||||
written as:
|
||||
ed - file <<EOF
|
||||
1g/.*/u\
|
||||
|
@ -204,7 +204,7 @@ ar_open(const char *name)
|
||||
/*
|
||||
* set default blksz on read. APPNDs writes rdblksz on the last volume
|
||||
* On all new archive volumes, we shift to wrblksz (if the user
|
||||
* specified one, otherwize we will continue to use rdblksz). We
|
||||
* specified one, otherwise we will continue to use rdblksz). We
|
||||
* must to set blocksize based on what kind of device the archive is
|
||||
* stored.
|
||||
*/
|
||||
@ -381,7 +381,7 @@ ar_close(void)
|
||||
|
||||
/*
|
||||
* If we have not determined the format yet, we just say how many bytes
|
||||
* we have skipped over looking for a header to id. there is no way we
|
||||
* we have skipped over looking for a header to id. There is no way we
|
||||
* could have written anything yet.
|
||||
*/
|
||||
if (frmt == NULL) {
|
||||
@ -595,7 +595,7 @@ ar_read(char *buf, int cnt)
|
||||
* Return:
|
||||
* Number of bytes written. 0 indicates end of volume reached and with no
|
||||
* flaws (as best that can be detected). A -1 indicates an unrecoverable
|
||||
* error in the archive occured.
|
||||
* error in the archive occurred.
|
||||
*/
|
||||
|
||||
int
|
||||
@ -679,7 +679,7 @@ ar_write(char *buf, int bsz)
|
||||
* if this is a block aligned archive format, we may have a bad archive
|
||||
* if the format wants the header to start at a BLKMULT boundary. While
|
||||
* we can deal with the mis-aligned data, it violates spec and other
|
||||
* archive readers will likely fail. if the format is not block
|
||||
* archive readers will likely fail. If the format is not block
|
||||
* aligned, the user may be lucky (and the archive is ok).
|
||||
*/
|
||||
if (res >= 0) {
|
||||
@ -794,7 +794,7 @@ ar_rdsync(void)
|
||||
|
||||
/*
|
||||
* ar_fow()
|
||||
* Move the I/O position within the archive foward the specified number of
|
||||
* Move the I/O position within the archive forward the specified number of
|
||||
* bytes as supported by the device. If we cannot move the requested
|
||||
* number of bytes, return the actual number of bytes moved in skipped.
|
||||
* Return:
|
||||
@ -813,7 +813,7 @@ ar_fow(off_t sksz, off_t *skipped)
|
||||
return(0);
|
||||
|
||||
/*
|
||||
* we cannot move foward at EOF or error
|
||||
* we cannot move forward at EOF or error
|
||||
*/
|
||||
if (lstrval <= 0)
|
||||
return(lstrval);
|
||||
@ -822,7 +822,7 @@ ar_fow(off_t sksz, off_t *skipped)
|
||||
* Safer to read forward on devices where it is hard to find the end of
|
||||
* the media without reading to it. With tapes we cannot be sure of the
|
||||
* number of physical blocks to skip (we do not know physical block
|
||||
* size at this point), so we must only read foward on tapes!
|
||||
* size at this point), so we must only read forward on tapes!
|
||||
*/
|
||||
if (artyp != ISREG)
|
||||
return(0);
|
||||
@ -907,7 +907,7 @@ ar_rev(off_t sksz)
|
||||
|
||||
/*
|
||||
* we may try to go backwards past the start when the archive
|
||||
* is only a single record. If this hapens and we are on a
|
||||
* is only a single record. If this happens and we are on a
|
||||
* multi volume archive, we need to go to the end of the
|
||||
* previous volume and continue our movement backwards from
|
||||
* there.
|
||||
@ -1046,7 +1046,7 @@ get_phys(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* read foward to the file mark, then back up in front of the filemark
|
||||
* read forward to the file mark, then back up in front of the filemark
|
||||
* (this is a bit paranoid, but should be safe to do).
|
||||
*/
|
||||
while ((res = read(arfd, scbuf, sizeof(scbuf))) > 0)
|
||||
|
@ -854,7 +854,7 @@ copy(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Non standard -Y and -Z flag. When the exisiting file is
|
||||
* Non standard -Y and -Z flag. When the existing file is
|
||||
* same age or newer skip
|
||||
*/
|
||||
if ((Yflag || Zflag) && ((lstat(arcn->name, &sb) == 0))) {
|
||||
@ -1096,7 +1096,7 @@ next_head(ARCHD *arcn)
|
||||
}
|
||||
|
||||
/*
|
||||
* ok got a valid header, check for trailer if format encodes it in the
|
||||
* ok got a valid header, check for trailer if format encodes it in
|
||||
* the header.
|
||||
*/
|
||||
if (frmt->inhead && ((*frmt->trail_cpio)(arcn) == 0)) {
|
||||
|
@ -145,7 +145,7 @@ rd_start(void)
|
||||
}
|
||||
if (wrblksz % BLKMULT) {
|
||||
paxwarn(1, "Write block size %d is not a %d byte multiple",
|
||||
wrblksz, BLKMULT);
|
||||
wrblksz, BLKMULT);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
@ -182,13 +182,13 @@ cp_start(void)
|
||||
* the start of the header of the first file added to the archive. The
|
||||
* format specific end read function tells us how many bytes to move
|
||||
* backwards in the archive to be positioned BEFORE the trailer. Two
|
||||
* different postions have to be adjusted, the O.S. file offset (e.g. the
|
||||
* different positions have to be adjusted, the O.S. file offset (e.g. the
|
||||
* position of the tape head) and the write point within the data we have
|
||||
* stored in the read (soon to become write) buffer. We may have to move
|
||||
* back several records (the number depends on the size of the archive
|
||||
* record and the size of the format trailer) to read up the record where
|
||||
* the first byte of the trailer is recorded. Trailers may span (and
|
||||
* overlap) record boundries.
|
||||
* overlap) record boundaries.
|
||||
* We first calculate which record has the first byte of the trailer. We
|
||||
* move the OS file offset back to the start of this record and read it
|
||||
* up. We set the buffer write pointer to be at this byte (the byte where
|
||||
@ -196,10 +196,10 @@ cp_start(void)
|
||||
* start of this record so a flush of this buffer will replace the record
|
||||
* in the archive.
|
||||
* A major problem is rewriting this last record. For archives stored
|
||||
* on disk files, this is trival. However, many devices are really picky
|
||||
* on disk files, this is trivial. However, many devices are really picky
|
||||
* about the conditions under which they will allow a write to occur.
|
||||
* Often devices restrict the conditions where writes can be made writes,
|
||||
* so it may not be feasable to append archives stored on all types of
|
||||
* so it may not be feasible to append archives stored on all types of
|
||||
* devices.
|
||||
* Return:
|
||||
* 0 for success, -1 for failure
|
||||
@ -365,7 +365,7 @@ rd_sync(void)
|
||||
* pback()
|
||||
* push the data used during the archive id phase back into the I/O
|
||||
* buffer. This is required as we cannot be sure that the header does NOT
|
||||
* overlap a block boundry (as in the case we are trying to recover a
|
||||
* overlap a block boundary (as in the case we are trying to recover a
|
||||
* flawed archived). This was not designed to be used for any other
|
||||
* purpose. (What software engineering, HA!)
|
||||
* WARNING: do not even THINK of pback greater than BLKMULT, unless the
|
||||
@ -382,7 +382,7 @@ pback(char *pt, int cnt)
|
||||
|
||||
/*
|
||||
* rd_skip()
|
||||
* skip foward in the archive during an archive read. Used to get quickly
|
||||
* skip forward in the archive during an archive read. Used to get quickly
|
||||
* past file data and padding for files the user did NOT select.
|
||||
* Return:
|
||||
* 0 if ok, -1 failure, and 1 when EOF on the archive volume was detected.
|
||||
@ -396,7 +396,7 @@ rd_skip(off_t skcnt)
|
||||
off_t skipped = 0;
|
||||
|
||||
/*
|
||||
* consume what data we have in the buffer. If we have to move foward
|
||||
* consume what data we have in the buffer. If we have to move forward
|
||||
* whole records, we call the low level skip function to see if we can
|
||||
* move within the archive without doing the expensive reads on data we
|
||||
* do not want.
|
||||
@ -453,7 +453,7 @@ rd_skip(off_t skcnt)
|
||||
* wr_fin()
|
||||
* flush out any data (and pad if required) the last block. We always pad
|
||||
* with zero (even though we do not have to). Padding with 0 makes it a
|
||||
* lot easier to recover if the archive is damaged. zero paddding SHOULD
|
||||
* lot easier to recover if the archive is damaged. zero padding SHOULD
|
||||
* BE a requirement....
|
||||
*/
|
||||
|
||||
@ -530,7 +530,7 @@ rd_wrbuf(char *in, int cpcnt)
|
||||
/*
|
||||
* read error, return what we got (or the error if
|
||||
* no data was copied). The caller must know that an
|
||||
* error occured and has the best knowledge what to
|
||||
* error occurred and has the best knowledge what to
|
||||
* do with it
|
||||
*/
|
||||
if ((res = cpcnt - incnt) > 0)
|
||||
@ -584,7 +584,7 @@ wr_skip(off_t skcnt)
|
||||
|
||||
/*
|
||||
* wr_rdfile()
|
||||
* fill write buffer with the contents of a file. We are passed an open
|
||||
* fill write buffer with the contents of a file. We are passed an open
|
||||
* file descriptor to the file and the archive structure that describes the
|
||||
* file we are storing. The variable "left" is modified to contain the
|
||||
* number of bytes of the file we were NOT able to write to the archive.
|
||||
@ -671,7 +671,7 @@ rd_wrfile(ARCHD *arcn, int ofd, off_t *left)
|
||||
int isem = 1;
|
||||
int rem;
|
||||
int sz = MINFBSZ;
|
||||
struct stat sb;
|
||||
struct stat sb;
|
||||
u_long crc = 0L;
|
||||
|
||||
/*
|
||||
@ -884,7 +884,7 @@ buf_flush(int bufcnt)
|
||||
|
||||
/*
|
||||
* if we have reached the user specified byte count for each archive
|
||||
* volume, prompt for the next volume. (The non-standrad -R flag).
|
||||
* volume, prompt for the next volume. (The non-standard -R flag).
|
||||
* NOTE: If the wrlimit is smaller than wrcnt, we will always write
|
||||
* at least one record. We always round limit UP to next blocksize.
|
||||
*/
|
||||
@ -944,7 +944,7 @@ buf_flush(int bufcnt)
|
||||
} else if (cnt > 0) {
|
||||
/*
|
||||
* Oh drat we got a partial write!
|
||||
* if format doesnt care about alignment let it go,
|
||||
* if format doesn't care about alignment let it go,
|
||||
* we warned the user in ar_write().... but this means
|
||||
* the last record on this volume violates pax spec....
|
||||
*/
|
||||
|
@ -627,7 +627,7 @@ vcpio_rd(ARCHD *arcn, char *buf)
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
* skip padding. header + filename is aligned to 4 byte boundries
|
||||
* skip padding. header + filename is aligned to 4 byte boundaries
|
||||
*/
|
||||
if (rd_skip((off_t)(VCPIO_PAD(sizeof(HD_VCPIO) + nsz))) < 0)
|
||||
return(-1);
|
||||
@ -942,7 +942,7 @@ bcpio_rd(ARCHD *arcn, char *buf)
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
* header + file name are aligned to 2 byte boundries, skip if needed
|
||||
* header + file name are aligned to 2 byte boundaries, skip if needed
|
||||
*/
|
||||
if (rd_skip((off_t)(BCPIO_PAD(sizeof(HD_BCPIO) + nsz))) < 0)
|
||||
return(-1);
|
||||
@ -989,8 +989,8 @@ bcpio_endrd(void)
|
||||
* bcpio_wr()
|
||||
* copy the data in the ARCHD to buffer in old binary cpio format
|
||||
* There is a real chance of field overflow with this critter. So we
|
||||
* always check the conversion is ok. nobody in his their right mind
|
||||
* should write an achive in this format...
|
||||
* always check that the conversion is ok. nobody in their right mind
|
||||
* should write an archive in this format...
|
||||
* Return
|
||||
* 0 if file has data to be written after the header, 1 if file has NO
|
||||
* data to write after the header, -1 if archive write failed
|
||||
|
@ -84,9 +84,9 @@ file_creat(ARCHD *arcn)
|
||||
* works. We have to take special handling when the file does exist. To
|
||||
* detect this, we use O_EXCL. For example when trying to create a
|
||||
* file and a character device or fifo exists with the same name, we
|
||||
* can accidently open the device by mistake (or block waiting to open)
|
||||
* If we find that the open has failed, then figure spend the effort to
|
||||
* figure out why. This strategy was found to have better average
|
||||
* can accidentally open the device by mistake (or block waiting to
|
||||
* open). If we find that the open has failed, then spend the effort
|
||||
* to figure out why. This strategy was found to have better average
|
||||
* performance in common use than checking the file (and the path)
|
||||
* first with lstat.
|
||||
*/
|
||||
@ -559,7 +559,7 @@ chk_path( char *name, uid_t st_uid, gid_t st_gid)
|
||||
|
||||
for(;;) {
|
||||
/*
|
||||
* work foward from the first / and check each part of the path
|
||||
* work forward from the first / and check each part of the path
|
||||
*/
|
||||
spt = strchr(spt, '/');
|
||||
if (spt == NULL)
|
||||
@ -600,7 +600,7 @@ chk_path( char *name, uid_t st_uid, gid_t st_gid)
|
||||
(void)set_ids(name, st_uid, st_gid);
|
||||
|
||||
/*
|
||||
* make sure the user doen't have some strange umask that
|
||||
* make sure the user doesn't have some strange umask that
|
||||
* causes this newly created directory to be unusable. We fix
|
||||
* the modes and restore them back to the creation default at
|
||||
* the end of pax
|
||||
@ -716,11 +716,11 @@ set_pmode(char *fnm, mode_t mode)
|
||||
* uses lseek whenever it detects the input data is all 0 within that
|
||||
* file block. In more detail, the strategy is as follows:
|
||||
* While the input is all zero keep doing an lseek. Keep track of when we
|
||||
* pass over file block boundries. Only write when we hit a non zero
|
||||
* pass over file block boundaries. Only write when we hit a non zero
|
||||
* input. once we have written a file block, we continue to write it to
|
||||
* the end (we stop looking at the input). When we reach the start of the
|
||||
* next file block, start checking for zero blocks again. Working on file
|
||||
* block boundries significantly reduces the overhead when copying files
|
||||
* block boundaries significantly reduces the overhead when copying files
|
||||
* that are NOT very sparse. This overhead (when compared to a write) is
|
||||
* almost below the measurement resolution on many systems. Without it,
|
||||
* files with holes cannot be safely copied. It does has a side effect as
|
||||
@ -923,7 +923,7 @@ set_crc(ARCHD *arcn, int fd)
|
||||
|
||||
/*
|
||||
* safety check. we want to avoid archiving files that are active as
|
||||
* they can create inconsistant archive copies.
|
||||
* they can create inconsistent archive copies.
|
||||
*/
|
||||
if (cpcnt != arcn->sb.st_size)
|
||||
paxwarn(1, "File changed size %s", arcn->org_name);
|
||||
|
@ -101,8 +101,8 @@ ftree_start(void)
|
||||
/*
|
||||
* optional user flags that effect file traversal
|
||||
* -H command line symlink follow only (half follow)
|
||||
* -L follow sylinks (logical)
|
||||
* -P do not follow sylinks (physical). This is the default.
|
||||
* -L follow symlinks (logical)
|
||||
* -P do not follow symlinks (physical). This is the default.
|
||||
* -X do not cross over mount points
|
||||
* -t preserve access times on files read.
|
||||
* -n select only the first member of a file tree when a match is found
|
||||
|
@ -887,7 +887,7 @@ tar_options(int argc, char **argv)
|
||||
sawpat = 1;
|
||||
}
|
||||
/*
|
||||
* if patterns were added, we are doing chdir()
|
||||
* if patterns were added, we are doing chdir()
|
||||
* on a file-by-file basis, else, just one
|
||||
* global chdir (if any) after opening input.
|
||||
*/
|
||||
|
@ -397,7 +397,7 @@ pat_sel(ARCHD *arcn)
|
||||
/*
|
||||
* should never happen....
|
||||
*/
|
||||
paxwarn(1, "Pattern list inconsistant");
|
||||
paxwarn(1, "Pattern list inconsistent");
|
||||
return(-1);
|
||||
}
|
||||
*ppt = pt->fow;
|
||||
|
@ -372,7 +372,7 @@ gen_init(void)
|
||||
/*
|
||||
* signal handling to reset stored directory times and modes. Since
|
||||
* we deal with broken pipes via failed writes we ignore it. We also
|
||||
* deal with any file size limit thorugh failed writes. Cpu time
|
||||
* deal with any file size limit thorough failed writes. Cpu time
|
||||
* limits are caught and a cleanup is forced.
|
||||
*/
|
||||
if ((sigemptyset(&s_mask) < 0) || (sigaddset(&s_mask, SIGTERM) < 0) ||
|
||||
|
@ -376,7 +376,7 @@ trng_add(char *str)
|
||||
}
|
||||
|
||||
/*
|
||||
* by default we only will check file mtime, but usee can specify
|
||||
* by default we only will check file mtime, but the user can specify
|
||||
* mtime, ctime (inode change time) or both.
|
||||
*/
|
||||
if ((flgpt == NULL) || (*flgpt == '\0'))
|
||||
|
@ -209,7 +209,7 @@ chk_lnk(ARCHD *arcn)
|
||||
* purg_lnk
|
||||
* remove reference for a file that we may have added to the data base as
|
||||
* a potential source for hard links. We ended up not using the file, so
|
||||
* we do not want to accidently point another file at it later on.
|
||||
* we do not want to accidentally point another file at it later on.
|
||||
*/
|
||||
|
||||
void
|
||||
@ -306,14 +306,14 @@ lnk_end(void)
|
||||
* An append with an -u must read the archive and store the modification time
|
||||
* for every file on that archive before starting the write phase. It is clear
|
||||
* that this is one HUGE database. To save memory space, the actual file names
|
||||
* are stored in a scatch file and indexed by an in memory hash table. The
|
||||
* are stored in a scratch file and indexed by an in memory hash table. The
|
||||
* hash table is indexed by hashing the file path. The nodes in the table store
|
||||
* the length of the filename and the lseek offset within the scratch file
|
||||
* where the actual name is stored. Since there are never any deletions to this
|
||||
* table, fragmentation of the scratch file is never an issue. Lookups seem to
|
||||
* not exhibit any locality at all (files in the database are rarely
|
||||
* looked up more than once...). So caching is just a waste of memory. The
|
||||
* only limitation is the amount of scatch file space available to store the
|
||||
* only limitation is the amount of scratch file space available to store the
|
||||
* path names.
|
||||
*/
|
||||
|
||||
|
@ -291,7 +291,7 @@ tar_chksm(char *blk, int len)
|
||||
/*
|
||||
* tar_id()
|
||||
* determine if a block given to us is a valid tar header (and not a USTAR
|
||||
* header). We have to be on the lookout for those pesky blocks of all
|
||||
* header). We have to be on the lookout for those pesky blocks of all
|
||||
* zero's.
|
||||
* Return:
|
||||
* 0 if a tar header, -1 otherwise
|
||||
|
@ -301,7 +301,7 @@ the include file
|
||||
.It Dv "P_PPWAIT" Ta No "0x00010 Parent is waiting for child to exec/exit"
|
||||
.It Dv "P_PROFIL" Ta No "0x00020 Has started profiling"
|
||||
.It Dv "P_STOPPROF" Ta No "0x00040 Has thread in requesting to stop prof"
|
||||
.It Dv "P_HASTHREADS" Ta No "0x00080 Has had threads (no cleanup shortcuts)"
|
||||
.It Dv "P_HADTHREADS" Ta No "0x00080 Has had threads (no cleanup shortcuts)"
|
||||
.It Dv "P_SUGID" Ta No "0x00100 Had set id privileges since last exec"
|
||||
.It Dv "P_SYSTEM" Ta No "0x00200 System proc: no sigs, stats or swapping"
|
||||
.It Dv "P_SINGLE_EXIT" Ta No "0x00400 Threads suspending should exit, not wait"
|
||||
@ -549,7 +549,7 @@ wait channel (as an address)
|
||||
total blocks written (alias
|
||||
.Cm oublock )
|
||||
.It Cm paddr
|
||||
swap address
|
||||
process pointer
|
||||
.It Cm pagein
|
||||
pageins (same as majflt)
|
||||
.It Cm pgid
|
||||
|
@ -219,7 +219,7 @@ main(int argc, char *argv[])
|
||||
case 'A':
|
||||
/*
|
||||
* Exactly the same as `-ax'. This has been
|
||||
* added for compatability with SUSv3, but for
|
||||
* added for compatibility with SUSv3, but for
|
||||
* now it will not be described in the man page.
|
||||
*/
|
||||
nselectors++;
|
||||
|
25
bin/sh/cd.c
25
bin/sh/cd.c
@ -84,12 +84,16 @@ cdcmd(int argc, char **argv)
|
||||
const char *path;
|
||||
char *p;
|
||||
struct stat statb;
|
||||
int ch, phys, print = 0;
|
||||
int ch, phys, print = 0, getcwderr = 0;
|
||||
int rc;
|
||||
|
||||
optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
|
||||
phys = Pflag;
|
||||
while ((ch = getopt(argc, argv, "LP")) != -1) {
|
||||
while ((ch = getopt(argc, argv, "eLP")) != -1) {
|
||||
switch (ch) {
|
||||
case 'e':
|
||||
getcwderr = 1;
|
||||
break;
|
||||
case 'L':
|
||||
phys = 0;
|
||||
break;
|
||||
@ -131,8 +135,9 @@ cdcmd(int argc, char **argv)
|
||||
else
|
||||
print = strcmp(p, dest);
|
||||
}
|
||||
if (docd(p, print, phys) >= 0)
|
||||
return 0;
|
||||
rc = docd(p, print, phys);
|
||||
if (rc >= 0)
|
||||
return getcwderr ? rc : 0;
|
||||
}
|
||||
}
|
||||
error("can't cd to %s", dest);
|
||||
@ -148,17 +153,18 @@ cdcmd(int argc, char **argv)
|
||||
static int
|
||||
docd(char *dest, int print, int phys)
|
||||
{
|
||||
int rc;
|
||||
|
||||
TRACE(("docd(\"%s\", %d, %d) called\n", dest, print, phys));
|
||||
|
||||
/* If logical cd fails, fall back to physical. */
|
||||
if ((phys || cdlogical(dest) < 0) && cdphysical(dest) < 0)
|
||||
if ((phys || (rc = cdlogical(dest)) < 0) && (rc = cdphysical(dest)) < 0)
|
||||
return (-1);
|
||||
|
||||
if (print && iflag && curdir)
|
||||
out1fmt("%s\n", curdir);
|
||||
|
||||
return 0;
|
||||
return (rc);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -216,6 +222,7 @@ static int
|
||||
cdphysical(char *dest)
|
||||
{
|
||||
char *p;
|
||||
int rc = 0;
|
||||
|
||||
INTOFF;
|
||||
if (chdir(dest) < 0) {
|
||||
@ -223,11 +230,13 @@ cdphysical(char *dest)
|
||||
return (-1);
|
||||
}
|
||||
p = findcwd(NULL);
|
||||
if (p == NULL)
|
||||
if (p == NULL) {
|
||||
warning("warning: failed to get name of current directory");
|
||||
rc = 1;
|
||||
}
|
||||
updatepwd(p);
|
||||
INTON;
|
||||
return (0);
|
||||
return (rc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -552,7 +552,8 @@ evalpipe(union node *n)
|
||||
if (prevfd >= 0)
|
||||
close(prevfd);
|
||||
prevfd = pip[0];
|
||||
close(pip[1]);
|
||||
if (pip[1] != -1)
|
||||
close(pip[1]);
|
||||
}
|
||||
INTON;
|
||||
if (n->npipe.backgnd == 0) {
|
||||
@ -713,15 +714,9 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd)
|
||||
oexitstatus = exitstatus;
|
||||
exitstatus = 0;
|
||||
for (argp = cmd->ncmd.args ; argp ; argp = argp->narg.next) {
|
||||
char *p = argp->narg.text;
|
||||
if (varflag && is_name(*p)) {
|
||||
do {
|
||||
p++;
|
||||
} while (is_in_name(*p));
|
||||
if (*p == '=') {
|
||||
expandarg(argp, &varlist, EXP_VARTILDE);
|
||||
continue;
|
||||
}
|
||||
if (varflag && isassignment(argp->narg.text)) {
|
||||
expandarg(argp, &varlist, EXP_VARTILDE);
|
||||
continue;
|
||||
}
|
||||
expandarg(argp, &arglist, EXP_FULL | EXP_TILDE);
|
||||
varflag = 0;
|
||||
|
@ -281,7 +281,6 @@ readcmdfile(const char *name)
|
||||
static char *
|
||||
find_dot_file(char *basename)
|
||||
{
|
||||
static char localname[FILENAME_MAX+1];
|
||||
char *fullname;
|
||||
const char *path = pathval();
|
||||
struct stat statb;
|
||||
@ -291,10 +290,14 @@ find_dot_file(char *basename)
|
||||
return basename;
|
||||
|
||||
while ((fullname = padvance(&path, basename)) != NULL) {
|
||||
strcpy(localname, fullname);
|
||||
if ((stat(fullname, &statb) == 0) && S_ISREG(statb.st_mode)) {
|
||||
/*
|
||||
* Don't bother freeing here, since it will
|
||||
* be freed by the caller.
|
||||
*/
|
||||
return fullname;
|
||||
}
|
||||
stunalloc(fullname);
|
||||
if ((stat(fullname, &statb) == 0) && S_ISREG(statb.st_mode))
|
||||
return localname;
|
||||
}
|
||||
return basename;
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ ulimitcmd(int argc __unused, char **argv __unused)
|
||||
"(-%c) ", l->option);
|
||||
out1fmt("%-18s %18s ", l->name, optbuf);
|
||||
if (val == RLIM_INFINITY)
|
||||
out1fmt("unlimited\n");
|
||||
out1str("unlimited\n");
|
||||
else
|
||||
{
|
||||
val /= l->factor;
|
||||
@ -491,7 +491,7 @@ ulimitcmd(int argc __unused, char **argv __unused)
|
||||
val = limit.rlim_max;
|
||||
|
||||
if (val == RLIM_INFINITY)
|
||||
out1fmt("unlimited\n");
|
||||
out1str("unlimited\n");
|
||||
else
|
||||
{
|
||||
val /= l->factor;
|
||||
|
@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
|
||||
/*
|
||||
* A text structure is basicly just a string that grows as more characters
|
||||
* A text structure is basically just a string that grows as more characters
|
||||
* are added onto the end of it. It is implemented as a linked list of
|
||||
* blocks of characters. The routines addstr and addchar append a string
|
||||
* or a single character, respectively, to a text structure. Writetext
|
||||
|
@ -50,7 +50,6 @@ TPIPE 0 "|"
|
||||
TLP 0 "("
|
||||
TRP 1 ")"
|
||||
TENDCASE 1 ";;"
|
||||
TENDBQUOTE 1 "`"
|
||||
TREDIR 0 redirection
|
||||
TWORD 0 word
|
||||
TIF 0 "if"
|
||||
|
@ -619,6 +619,7 @@ simplecmd(union node **rpp, union node *redir)
|
||||
union node **orig_rpp = rpp;
|
||||
union node *n = NULL;
|
||||
int special;
|
||||
int savecheckkwd;
|
||||
|
||||
/* If we don't have any redirections already, then we must reset */
|
||||
/* rpp to be the address of the local redir variable. */
|
||||
@ -634,7 +635,10 @@ simplecmd(union node **rpp, union node *redir)
|
||||
*/
|
||||
orig_rpp = rpp;
|
||||
|
||||
savecheckkwd = CHKALIAS;
|
||||
|
||||
for (;;) {
|
||||
checkkwd = savecheckkwd;
|
||||
if (readtoken() == TWORD) {
|
||||
n = (union node *)stalloc(sizeof (struct narg));
|
||||
n->type = NARG;
|
||||
@ -642,6 +646,8 @@ simplecmd(union node **rpp, union node *redir)
|
||||
n->narg.backquote = backquotelist;
|
||||
*app = n;
|
||||
app = &n->narg.next;
|
||||
if (savecheckkwd != 0 && !isassignment(wordtext))
|
||||
savecheckkwd = 0;
|
||||
} else if (lasttoken == TREDIR) {
|
||||
*rpp = n = redirnode;
|
||||
rpp = &n->nfile.next;
|
||||
@ -1513,10 +1519,12 @@ checkend: {
|
||||
|
||||
p = line;
|
||||
for (q = eofmark + 1 ; *q && *p == *q ; p++, q++);
|
||||
if (*p == '\n' && *q == '\0') {
|
||||
if ((*p == '\0' || *p == '\n') && *q == '\0') {
|
||||
c = PEOF;
|
||||
plinno++;
|
||||
needprompt = doprompt;
|
||||
if (*p == '\n') {
|
||||
plinno++;
|
||||
needprompt = doprompt;
|
||||
}
|
||||
} else {
|
||||
pushstring(line, strlen(line), NULL);
|
||||
}
|
||||
@ -1857,6 +1865,22 @@ goodname(const char *name)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
isassignment(const char *p)
|
||||
{
|
||||
if (!is_name(*p))
|
||||
return 0;
|
||||
p++;
|
||||
for (;;) {
|
||||
if (*p == '=')
|
||||
return 1;
|
||||
else if (!is_in_name(*p))
|
||||
return 0;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called when an unexpected token is read during the parse. The argument
|
||||
* is the token that is expected, or -1 if more than one type of token can
|
||||
|
@ -80,4 +80,5 @@ extern const char *const parsekwd[];
|
||||
union node *parsecmd(int);
|
||||
void fixredir(union node *, const char *, int);
|
||||
int goodname(const char *);
|
||||
int isassignment(const char *);
|
||||
char *getprompt(void *);
|
||||
|
17
bin/sh/sh.1
17
bin/sh/sh.1
@ -32,7 +32,7 @@
|
||||
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd May 8, 2011
|
||||
.Dd May 21, 2011
|
||||
.Dt SH 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -506,8 +506,8 @@ The following are keywords:
|
||||
An alias is a name and corresponding value set using the
|
||||
.Ic alias
|
||||
built-in command.
|
||||
Whenever a keyword may occur (see above),
|
||||
and after checking for keywords, the shell
|
||||
Wherever the command word of a simple command may occur,
|
||||
and after checking for keywords if a keyword may occur, the shell
|
||||
checks the word to see if it matches an alias.
|
||||
If it does, it replaces it in the input stream with its value.
|
||||
For example, if there is an alias called
|
||||
@ -1729,7 +1729,7 @@ Execute the specified built-in command,
|
||||
.Ar cmd .
|
||||
This is useful when the user wishes to override a shell function
|
||||
with the same name as a built-in command.
|
||||
.It Ic cd Oo Fl L | P Oc Op Ar directory
|
||||
.It Ic cd Oo Fl L | P Oc Oo Fl e Oc Op Ar directory
|
||||
Switch to the specified
|
||||
.Ar directory ,
|
||||
or to the directory specified in the
|
||||
@ -1778,6 +1778,15 @@ option is specified,
|
||||
.Pa ..
|
||||
is handled logically.
|
||||
This is the default.
|
||||
.Pp
|
||||
The
|
||||
.Fl e
|
||||
option causes
|
||||
.Ic cd
|
||||
to return exit status 1 if the full pathname of the new directory
|
||||
cannot be determined reliably or at all.
|
||||
Normally this is not considered an error,
|
||||
although a warning is printed.
|
||||
.It Ic chdir
|
||||
A synonym for the
|
||||
.Ic cd
|
||||
|
11
bin/sh/var.c
11
bin/sh/var.c
@ -681,14 +681,13 @@ exportcmd(int argc, char **argv)
|
||||
out1str(cmdname);
|
||||
out1c(' ');
|
||||
}
|
||||
p = strchr(vp->text, '=');
|
||||
if (values && !(vp->flags & VUNSET)) {
|
||||
p++;
|
||||
outbin(vp->text, p - vp->text,
|
||||
out1);
|
||||
out1qstr(p);
|
||||
outbin(vp->text,
|
||||
vp->name_len + 1, out1);
|
||||
out1qstr(vp->text +
|
||||
vp->name_len + 1);
|
||||
} else
|
||||
outbin(vp->text, p - vp->text,
|
||||
outbin(vp->text, vp->name_len,
|
||||
out1);
|
||||
out1c('\n');
|
||||
}
|
||||
|
@ -1542,7 +1542,8 @@ copy_object (bfd *ibfd, bfd *obfd)
|
||||
/* Umm, not sure what to do in this case. */
|
||||
debuglink_vma = 0x1000;
|
||||
|
||||
bfd_set_section_vma (obfd, gnu_debuglink_section, debuglink_vma);
|
||||
(void) bfd_set_section_vma (obfd, gnu_debuglink_section,
|
||||
debuglink_vma);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9701,7 +9701,7 @@ process_archive (char *file_name, FILE *file)
|
||||
}
|
||||
|
||||
if ((longnames_size & 1) != 0)
|
||||
getc (file);
|
||||
(void) getc (file);
|
||||
|
||||
got = fread (&arhdr, 1, sizeof arhdr, file);
|
||||
if (got != sizeof arhdr)
|
||||
|
@ -593,7 +593,7 @@ print_strings (const char *filename, FILE *stream, file_off address,
|
||||
case 8:
|
||||
#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
|
||||
if (sizeof (start) > sizeof (long))
|
||||
printf ("%7Lo ", (unsigned long long) start);
|
||||
printf ("%7llo ", (unsigned long long) start);
|
||||
else
|
||||
#else
|
||||
# if !BFD_HOST_64BIT_LONG
|
||||
@ -608,7 +608,7 @@ print_strings (const char *filename, FILE *stream, file_off address,
|
||||
case 10:
|
||||
#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
|
||||
if (sizeof (start) > sizeof (long))
|
||||
printf ("%7Ld ", (unsigned long long) start);
|
||||
printf ("%7lld ", (unsigned long long) start);
|
||||
else
|
||||
#else
|
||||
# if !BFD_HOST_64BIT_LONG
|
||||
@ -623,7 +623,7 @@ print_strings (const char *filename, FILE *stream, file_off address,
|
||||
case 16:
|
||||
#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
|
||||
if (sizeof (start) > sizeof (long))
|
||||
printf ("%7Lx ", (unsigned long long) start);
|
||||
printf ("%7llx ", (unsigned long long) start);
|
||||
else
|
||||
#else
|
||||
# if !BFD_HOST_64BIT_LONG
|
||||
|
@ -30,7 +30,7 @@ extern char *input_line_pointer; /* -> char we are parsing now. */
|
||||
|
||||
#ifdef PERMIT_WHITESPACE
|
||||
#define SKIP_WHITESPACE() \
|
||||
((*input_line_pointer == ' ') ? ++input_line_pointer : 0)
|
||||
do { if (*input_line_pointer == ' ') ++input_line_pointer; } while (0)
|
||||
#else
|
||||
#define SKIP_WHITESPACE() know(*input_line_pointer != ' ' )
|
||||
#endif
|
||||
|
@ -345,7 +345,7 @@ record_alignment (/* Segment to which alignment pertains. */
|
||||
return;
|
||||
|
||||
if ((unsigned int) align > bfd_get_section_alignment (stdoutput, seg))
|
||||
bfd_set_section_alignment (stdoutput, seg, align);
|
||||
(void) bfd_set_section_alignment (stdoutput, seg, align);
|
||||
}
|
||||
|
||||
int
|
||||
@ -2247,7 +2247,7 @@ relax_segment (struct frag *segment_frag_root, segT segment, int pass)
|
||||
|
||||
newf = frag_alloc (ob);
|
||||
obstack_blank_fast (ob, fragP->fr_var);
|
||||
obstack_finish (ob);
|
||||
(void) obstack_finish (ob);
|
||||
memcpy (newf, fragP, SIZEOF_STRUCT_FRAG);
|
||||
memcpy (newf->fr_literal,
|
||||
fragP->fr_literal + fragP->fr_fix,
|
||||
|
@ -4274,9 +4274,10 @@ lang_size_sections_1
|
||||
" section %s\n"), os->name);
|
||||
|
||||
input = os->children.head->input_section.section;
|
||||
bfd_set_section_vma (os->bfd_section->owner,
|
||||
os->bfd_section,
|
||||
bfd_section_vma (input->owner, input));
|
||||
(void) bfd_set_section_vma (os->bfd_section->owner,
|
||||
os->bfd_section,
|
||||
bfd_section_vma (input->owner,
|
||||
input));
|
||||
os->bfd_section->size = input->size;
|
||||
break;
|
||||
}
|
||||
@ -4361,7 +4362,7 @@ lang_size_sections_1
|
||||
os->name, (unsigned long) (newdot - savedot));
|
||||
}
|
||||
|
||||
bfd_set_section_vma (0, os->bfd_section, newdot);
|
||||
(void) bfd_set_section_vma (0, os->bfd_section, newdot);
|
||||
|
||||
os->bfd_section->output_offset = 0;
|
||||
}
|
||||
|
@ -12442,7 +12442,7 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
|
||||
REG_N_DEATHS (REGNO (XEXP (note, 0)))++;
|
||||
|
||||
REG_NOTES (place2) = gen_rtx_fmt_ee (GET_CODE (note),
|
||||
REG_NOTE_KIND (note),
|
||||
GET_MODE (note),
|
||||
XEXP (note, 0),
|
||||
REG_NOTES (place2));
|
||||
}
|
||||
|
@ -3210,7 +3210,7 @@ try_split (rtx pat, rtx trial, int last)
|
||||
{
|
||||
if (CALL_P (insn))
|
||||
REG_NOTES (insn)
|
||||
= gen_rtx_EXPR_LIST (REG_NOTE_KIND (note),
|
||||
= gen_rtx_EXPR_LIST (GET_MODE (note),
|
||||
XEXP (note, 0),
|
||||
REG_NOTES (insn));
|
||||
insn = PREV_INSN (insn);
|
||||
@ -3223,7 +3223,7 @@ try_split (rtx pat, rtx trial, int last)
|
||||
{
|
||||
if (JUMP_P (insn))
|
||||
REG_NOTES (insn)
|
||||
= gen_rtx_EXPR_LIST (REG_NOTE_KIND (note),
|
||||
= gen_rtx_EXPR_LIST (GET_MODE (note),
|
||||
XEXP (note, 0),
|
||||
REG_NOTES (insn));
|
||||
insn = PREV_INSN (insn);
|
||||
@ -4589,7 +4589,8 @@ set_unique_reg_note (rtx insn, enum reg_note kind, rtx datum)
|
||||
return note;
|
||||
}
|
||||
|
||||
REG_NOTES (insn) = gen_rtx_EXPR_LIST (kind, datum, REG_NOTES (insn));
|
||||
REG_NOTES (insn) = gen_rtx_EXPR_LIST ((enum machine_mode) kind, datum,
|
||||
REG_NOTES (insn));
|
||||
return REG_NOTES (insn);
|
||||
}
|
||||
|
||||
@ -5344,12 +5345,12 @@ emit_copy_of_insn_after (rtx insn, rtx after)
|
||||
{
|
||||
if (GET_CODE (link) == EXPR_LIST)
|
||||
REG_NOTES (new)
|
||||
= copy_insn_1 (gen_rtx_EXPR_LIST (REG_NOTE_KIND (link),
|
||||
= copy_insn_1 (gen_rtx_EXPR_LIST (GET_MODE (link),
|
||||
XEXP (link, 0),
|
||||
REG_NOTES (new)));
|
||||
else
|
||||
REG_NOTES (new)
|
||||
= copy_insn_1 (gen_rtx_INSN_LIST (REG_NOTE_KIND (link),
|
||||
= copy_insn_1 (gen_rtx_INSN_LIST (GET_MODE (link),
|
||||
XEXP (link, 0),
|
||||
REG_NOTES (new)));
|
||||
}
|
||||
|
@ -4008,22 +4008,19 @@ stack_protect_epilogue (void)
|
||||
|
||||
/* Allow the target to compare Y with X without leaking either into
|
||||
a register. */
|
||||
switch (HAVE_stack_protect_test != 0)
|
||||
if (HAVE_stack_protect_test != 0)
|
||||
{
|
||||
case 1:
|
||||
tmp = gen_stack_protect_test (x, y, label);
|
||||
if (tmp)
|
||||
{
|
||||
emit_insn (tmp);
|
||||
break;
|
||||
goto done;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
|
||||
default:
|
||||
emit_cmp_and_jump_insns (x, y, EQ, NULL_RTX, ptr_mode, 1, label);
|
||||
break;
|
||||
}
|
||||
|
||||
emit_cmp_and_jump_insns (x, y, EQ, NULL_RTX, ptr_mode, 1, label);
|
||||
done:
|
||||
|
||||
/* The noreturn predictor has been moved to the tree level. The rtl-level
|
||||
predictors estimate this branch about 20%, which isn't enough to get
|
||||
things moved out of line. Since this is the only extant case of adding
|
||||
|
@ -1652,7 +1652,7 @@ simplify_cond (rtx exp, int insn_code, int insn_index)
|
||||
rtx ret;
|
||||
|
||||
/* This lets us free all storage allocated below, if appropriate. */
|
||||
obstack_finish (rtl_obstack);
|
||||
(void) obstack_finish (rtl_obstack);
|
||||
|
||||
memcpy (tests, XVEC (exp, 0)->elem, len * sizeof (rtx));
|
||||
|
||||
|
@ -1099,7 +1099,7 @@ create_node (size_t size)
|
||||
|
||||
obstack_blank (&irp, size);
|
||||
result = obstack_base (&irp);
|
||||
obstack_finish (&irp);
|
||||
(void) obstack_finish (&irp);
|
||||
/* Default values of members are NULL and zero. */
|
||||
memset (result, 0, size);
|
||||
return result;
|
||||
@ -1170,7 +1170,7 @@ next_sep_el (const char **pstr, int sep, int par_flag)
|
||||
}
|
||||
obstack_1grow (&irp, '\0');
|
||||
out_str = obstack_base (&irp);
|
||||
obstack_finish (&irp);
|
||||
(void) obstack_finish (&irp);
|
||||
|
||||
*pstr = p;
|
||||
if (**pstr == sep)
|
||||
@ -1221,7 +1221,7 @@ get_str_vect (const char *str, int *els_num, int sep, int paren_p)
|
||||
return NULL;
|
||||
obstack_blank (&irp, sizeof (char *) * (*els_num + 1));
|
||||
vect = (char **) obstack_base (&irp);
|
||||
obstack_finish (&irp);
|
||||
(void) obstack_finish (&irp);
|
||||
pstr = &str;
|
||||
for (i = 0; i < *els_num; i++)
|
||||
vect [i] = next_sep_el (pstr, sep, paren_p);
|
||||
@ -3343,7 +3343,7 @@ alloc_empty_reserv_sets (void)
|
||||
|
||||
obstack_blank (&irp, els_in_reservs * sizeof (set_el_t));
|
||||
result = (reserv_sets_t) obstack_base (&irp);
|
||||
obstack_finish (&irp);
|
||||
(void) obstack_finish (&irp);
|
||||
memset (result, 0, els_in_reservs * sizeof (set_el_t));
|
||||
return result;
|
||||
}
|
||||
@ -4117,10 +4117,10 @@ initiate_excl_sets (void)
|
||||
|
||||
obstack_blank (&irp, els_in_cycle_reserv * sizeof (set_el_t));
|
||||
excl_set = (reserv_sets_t) obstack_base (&irp);
|
||||
obstack_finish (&irp);
|
||||
(void) obstack_finish (&irp);
|
||||
obstack_blank (&irp, description->units_num * sizeof (reserv_sets_t));
|
||||
unit_excl_set_table = (reserv_sets_t *) obstack_base (&irp);
|
||||
obstack_finish (&irp);
|
||||
(void) obstack_finish (&irp);
|
||||
/* Evaluate unit exclusion sets. */
|
||||
for (i = 0; i < description->decls_num; i++)
|
||||
{
|
||||
@ -4129,7 +4129,7 @@ initiate_excl_sets (void)
|
||||
{
|
||||
obstack_blank (&irp, els_in_cycle_reserv * sizeof (set_el_t));
|
||||
unit_excl_set = (reserv_sets_t) obstack_base (&irp);
|
||||
obstack_finish (&irp);
|
||||
(void) obstack_finish (&irp);
|
||||
memset (unit_excl_set, 0, els_in_cycle_reserv * sizeof (set_el_t));
|
||||
for (el = DECL_UNIT (decl)->excl_list;
|
||||
el != NULL;
|
||||
@ -4224,16 +4224,16 @@ initiate_presence_absence_pattern_sets (void)
|
||||
|
||||
obstack_blank (&irp, description->units_num * sizeof (pattern_reserv_t));
|
||||
unit_presence_set_table = (pattern_reserv_t *) obstack_base (&irp);
|
||||
obstack_finish (&irp);
|
||||
(void) obstack_finish (&irp);
|
||||
obstack_blank (&irp, description->units_num * sizeof (pattern_reserv_t));
|
||||
unit_final_presence_set_table = (pattern_reserv_t *) obstack_base (&irp);
|
||||
obstack_finish (&irp);
|
||||
(void) obstack_finish (&irp);
|
||||
obstack_blank (&irp, description->units_num * sizeof (pattern_reserv_t));
|
||||
unit_absence_set_table = (pattern_reserv_t *) obstack_base (&irp);
|
||||
obstack_finish (&irp);
|
||||
(void) obstack_finish (&irp);
|
||||
obstack_blank (&irp, description->units_num * sizeof (pattern_reserv_t));
|
||||
unit_final_absence_set_table = (pattern_reserv_t *) obstack_base (&irp);
|
||||
obstack_finish (&irp);
|
||||
(void) obstack_finish (&irp);
|
||||
/* Evaluate unit presence/absence sets. */
|
||||
for (i = 0; i < description->decls_num; i++)
|
||||
{
|
||||
@ -4935,7 +4935,7 @@ store_alt_unit_usage (regexp_t regexp, regexp_t unit, int cycle,
|
||||
|
||||
obstack_blank (&unit_usages, sizeof (struct unit_usage));
|
||||
unit_usage_ptr = (struct unit_usage *) obstack_base (&unit_usages);
|
||||
obstack_finish (&unit_usages);
|
||||
(void) obstack_finish (&unit_usages);
|
||||
unit_usage_ptr->unit_decl = unit_decl;
|
||||
index = cycle * REGEXP_ONEOF (regexp)->regexps_num + alt_num;
|
||||
unit_usage_ptr->next = VEC_index (unit_usage_t, cycle_alt_unit_usages, index);
|
||||
@ -8975,7 +8975,7 @@ initiate_automaton_gen (int argc, char **argv)
|
||||
strlen (STANDARD_OUTPUT_DESCRIPTION_FILE_SUFFIX) + 1);
|
||||
obstack_1grow (&irp, '\0');
|
||||
output_description_file_name = obstack_base (&irp);
|
||||
obstack_finish (&irp);
|
||||
(void) obstack_finish (&irp);
|
||||
}
|
||||
|
||||
/* The following function checks existence at least one arc marked by
|
||||
|
@ -590,7 +590,7 @@ macro_input (char *buffer, unsigned size)
|
||||
void
|
||||
yyerror (const char *s)
|
||||
{
|
||||
error_at_line (&lexer_line, s);
|
||||
error_at_line (&lexer_line, "%s", s);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -787,7 +787,7 @@ calc_wider_mode (void)
|
||||
|
||||
#define tagged_printf(FMT, ARG, TAG) do { \
|
||||
int count_; \
|
||||
printf (" " FMT ",%n", ARG, &count_); \
|
||||
count_ = printf (" " FMT ",", ARG); \
|
||||
printf ("%*s/* %s */\n", 27 - count_, "", TAG); \
|
||||
} while (0)
|
||||
|
||||
@ -822,7 +822,7 @@ enum machine_mode\n{");
|
||||
for (m = modes[c]; m; m = m->next)
|
||||
{
|
||||
int count_;
|
||||
printf (" %smode,%n", m->name, &count_);
|
||||
count_ = printf (" %smode,", m->name);
|
||||
printf ("%*s/* %s:%d */\n", 27 - count_, "",
|
||||
trim_filename (m->file), m->line);
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ static tree maybe_lookup_decl_in_outer_ctx (tree, omp_context *);
|
||||
/* Find an OpenMP clause of type KIND within CLAUSES. */
|
||||
|
||||
static tree
|
||||
find_omp_clause (tree clauses, enum tree_code kind)
|
||||
find_omp_clause (tree clauses, enum omp_clause_code kind)
|
||||
{
|
||||
for (; clauses ; clauses = OMP_CLAUSE_CHAIN (clauses))
|
||||
if (OMP_CLAUSE_CODE (clauses) == kind)
|
||||
|
@ -2854,7 +2854,7 @@ bsi_insert_before (block_stmt_iterator *i, tree t, enum bsi_iterator_update m)
|
||||
{
|
||||
set_bb_for_stmt (t, i->bb);
|
||||
update_modified_stmts (t);
|
||||
tsi_link_before (&i->tsi, t, m);
|
||||
tsi_link_before (&i->tsi, t, (enum tsi_iterator_update) m);
|
||||
}
|
||||
|
||||
|
||||
@ -2867,7 +2867,7 @@ bsi_insert_after (block_stmt_iterator *i, tree t, enum bsi_iterator_update m)
|
||||
{
|
||||
set_bb_for_stmt (t, i->bb);
|
||||
update_modified_stmts (t);
|
||||
tsi_link_after (&i->tsi, t, m);
|
||||
tsi_link_after (&i->tsi, t, (enum tsi_iterator_update) m);
|
||||
}
|
||||
|
||||
|
||||
|
@ -487,7 +487,7 @@ vect_pattern_recog_1 (
|
||||
}
|
||||
else
|
||||
{
|
||||
enum tree_code vec_mode;
|
||||
enum machine_mode vec_mode;
|
||||
enum insn_code icode;
|
||||
optab optab;
|
||||
|
||||
|
@ -149,7 +149,7 @@ char *realloc ();
|
||||
# include <string.h>
|
||||
# ifndef bzero
|
||||
# ifndef _LIBC
|
||||
# define bzero(s, n) (memset (s, '\0', n), (s))
|
||||
# define bzero(s, n) ((void) (memset (s, '\0', n), (s)))
|
||||
# else
|
||||
# define bzero(s, n) __bzero (s, n)
|
||||
# endif
|
||||
|
@ -246,7 +246,7 @@ Gen_Perf::change (List_Node *prior, List_Node *curr)
|
||||
{
|
||||
if (option[DEBUG])
|
||||
{
|
||||
fprintf (stderr, " by changing asso_value['%c'] (char #%d) to %d\n",
|
||||
fprintf (stderr, " by changing asso_value['%c'] (char #%zd) to %d\n",
|
||||
*p, p - union_set + 1, asso_values[(unsigned char)(*p)]);
|
||||
fflush (stderr);
|
||||
}
|
||||
|
@ -497,8 +497,8 @@ Key_List::merge (List_Node *list1, List_Node *list2)
|
||||
*resultp = list1;
|
||||
break;
|
||||
}
|
||||
if (occurrence_sort && list1->occurrence < list2->occurrence
|
||||
|| hash_sort && list1->hash_value > list2->hash_value)
|
||||
if ((occurrence_sort && list1->occurrence < list2->occurrence)
|
||||
|| (hash_sort && list1->hash_value > list2->hash_value))
|
||||
{
|
||||
*resultp = list2;
|
||||
resultp = &list2->next; list2 = list1; list1 = *resultp;
|
||||
@ -1035,17 +1035,16 @@ Key_List::output_hash_function (void)
|
||||
if (option[CPLUSPLUS])
|
||||
printf ("%s::", option.get_class_name ());
|
||||
printf ("%s ", option.get_hash_name ());
|
||||
printf (option[KRC] ?
|
||||
"(str, len)\n"
|
||||
" register char *str;\n"
|
||||
" register unsigned int len;\n" :
|
||||
option[C] ?
|
||||
"(str, len)\n"
|
||||
" register const char *str;\n"
|
||||
" register unsigned int len;\n" :
|
||||
option[ANSIC] | option[CPLUSPLUS] ?
|
||||
"(register const char *str, register unsigned int len)\n" :
|
||||
"");
|
||||
if (option[KRC] || option[C] || option [ANSIC] || option[CPLUSPLUS])
|
||||
printf (option[KRC] ?
|
||||
"(str, len)\n"
|
||||
" register char *str;\n"
|
||||
" register unsigned int len;\n" :
|
||||
option[C] ?
|
||||
"(str, len)\n"
|
||||
" register const char *str;\n"
|
||||
" register unsigned int len;\n" :
|
||||
"(register const char *str, register unsigned int len)\n");
|
||||
|
||||
/* Note that when the hash function is called, it has already been verified
|
||||
that min_key_len <= len <= max_key_len. */
|
||||
@ -1442,7 +1441,7 @@ Key_List::output_lookup_array (void)
|
||||
|
||||
if (option[DEBUG])
|
||||
fprintf (stderr,
|
||||
"dup_ptr[%d]: hash_value = %d, index = %d, count = %d\n",
|
||||
"dup_ptr[%zd]: hash_value = %d, index = %d, count = %d\n",
|
||||
dup_ptr - duplicates,
|
||||
dup_ptr->hash_value, dup_ptr->index, dup_ptr->count);
|
||||
|
||||
@ -1986,17 +1985,16 @@ Key_List::output_lookup_function (void)
|
||||
if (option[CPLUSPLUS])
|
||||
printf ("%s::", option.get_class_name ());
|
||||
printf ("%s ", option.get_function_name ());
|
||||
printf (option[KRC] ?
|
||||
"(str, len)\n"
|
||||
" register char *str;\n"
|
||||
" register unsigned int len;\n" :
|
||||
option[C] ?
|
||||
"(str, len)\n"
|
||||
" register const char *str;\n"
|
||||
" register unsigned int len;\n" :
|
||||
option[ANSIC] | option[CPLUSPLUS] ?
|
||||
"(register const char *str, register unsigned int len)\n" :
|
||||
"");
|
||||
if (option[KRC] || option[C] || option[ANSIC] || option[CPLUSPLUS])
|
||||
printf (option[KRC] ?
|
||||
"(str, len)\n"
|
||||
" register char *str;\n"
|
||||
" register unsigned int len;\n" :
|
||||
option[C] ?
|
||||
"(str, len)\n"
|
||||
" register const char *str;\n"
|
||||
" register unsigned int len;\n" :
|
||||
"(register const char *str, register unsigned int len)\n");
|
||||
|
||||
/* Output the function's body. */
|
||||
printf ("{\n");
|
||||
|
@ -237,7 +237,7 @@ Options::print_options (void)
|
||||
{
|
||||
putchar (*arg);
|
||||
arg++;
|
||||
if (*arg >= 'A' && *arg <= 'Z' || *arg >= 'a' && *arg <= 'z')
|
||||
if ((*arg >= 'A' && *arg <= 'Z') || (*arg >= 'a' && *arg <= 'z'))
|
||||
{
|
||||
putchar (*arg);
|
||||
arg++;
|
||||
|
@ -1587,7 +1587,7 @@ void header_desc::write_headings (FILE *f, int force)
|
||||
|
||||
buffer += as_string(h);
|
||||
buffer += '\0';
|
||||
fprintf(f, buffer.contents());
|
||||
fputs(buffer.contents(), f);
|
||||
} else
|
||||
fputs(g->text_string, f);
|
||||
h++;
|
||||
|
@ -995,7 +995,7 @@ next_command(void)
|
||||
inline bool
|
||||
odd(const int n)
|
||||
{
|
||||
return (n & 1 == 1) ? true : false;
|
||||
return ((n & 1) == 1) ? true : false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -611,14 +611,16 @@ int state_set::is_in(int_value_state i)
|
||||
return (intset & (1 << (int)i)) != 0;
|
||||
}
|
||||
|
||||
// Note: this used to have a bug s.t. it always tested for bit 0 (benl 18/5/11)
|
||||
int state_set::is_in(units_value_state u)
|
||||
{
|
||||
return (unitsset & (1 << (int)u) != 0);
|
||||
return (unitsset & (1 << (int)u)) != 0;
|
||||
}
|
||||
|
||||
// Note: this used to have a bug s.t. it always tested for bit 0 (benl 18/5/11)
|
||||
int state_set::is_in(string_value_state s)
|
||||
{
|
||||
return (stringset & (1 << (int)s) != 0);
|
||||
return (stringset & (1 << (int)s)) != 0;
|
||||
}
|
||||
|
||||
void state_set::add(units_value_state, int n)
|
||||
|
@ -2157,7 +2157,7 @@ void glyph_node::debug_node()
|
||||
if (c)
|
||||
fprintf(stderr, "%c", c);
|
||||
else
|
||||
fprintf(stderr, ci->nm.contents());
|
||||
fputs(ci->nm.contents(), stderr);
|
||||
if (push_state)
|
||||
fprintf(stderr, " <push_state>");
|
||||
if (state)
|
||||
|
@ -870,9 +870,9 @@ output_charset(const int tfm_type)
|
||||
else if (!all_flag)
|
||||
continue;
|
||||
else if (tfm_type == MSL)
|
||||
printf(hp_msl_to_ucode_name(charcode));
|
||||
fputs(hp_msl_to_ucode_name(charcode), stdout);
|
||||
else
|
||||
printf(unicode_to_ucode_name(charcode));
|
||||
fputs(unicode_to_ucode_name(charcode), stdout);
|
||||
|
||||
printf("\t%d,%d",
|
||||
scale(char_table[i].width), scale(char_table[i].ascent));
|
||||
|
@ -49,6 +49,7 @@ RCSID("$Id: slc-gram.y 20767 2007-06-01 11:24:52Z lha $");
|
||||
#include "slc.h"
|
||||
extern FILE *yyin;
|
||||
extern struct assignment *assignment;
|
||||
extern int yyparse(void);
|
||||
%}
|
||||
|
||||
%union {
|
||||
|
@ -23,7 +23,7 @@ resync_precmd="$stop_precmd"
|
||||
resync_cmd="ipfilter_resync"
|
||||
status_precmd="$stop_precmd"
|
||||
status_cmd="ipfilter_status"
|
||||
extra_commands="reload resync status"
|
||||
extra_commands="reload resync"
|
||||
required_modules="ipl:ipfilter"
|
||||
|
||||
ipfilter_start()
|
||||
|
@ -19,7 +19,7 @@ check_cmd="pf_check"
|
||||
reload_cmd="pf_reload"
|
||||
resync_cmd="pf_resync"
|
||||
status_cmd="pf_status"
|
||||
extra_commands="check reload resync status"
|
||||
extra_commands="check reload resync"
|
||||
required_files="$pf_rules"
|
||||
required_modules="pf"
|
||||
|
||||
|
@ -10494,13 +10494,13 @@ Anti-trust laws should be approached with exactly that attitude.
|
||||
Antonio Antonio
|
||||
Was tired of living alonio
|
||||
He thought he would woo Antonio Antonio
|
||||
Miss Lucamy Lu, Rode of on his polo ponio
|
||||
Miss Lucamy Lu, Rode off on his polo ponio
|
||||
Miss Lucamy Lucy Molonio. And found the maid
|
||||
In a bowery shade,
|
||||
Sitting and knitting alonio.
|
||||
Antonio Antonio
|
||||
Said if you will be my ownio
|
||||
I'll love tou true Oh nonio Antonio
|
||||
I'll love you true Oh nonio Antonio
|
||||
And buy for you You're far too bleak and bonio
|
||||
An icery creamry conio. And all that I wish
|
||||
You singular fish
|
||||
@ -10509,7 +10509,7 @@ Antonio Antonio
|
||||
Uttered a dismal moanio
|
||||
And went off and hid
|
||||
Or I'm told that he did
|
||||
In the Antartical Zonio.
|
||||
In the Antarctical Zonio.
|
||||
%
|
||||
Antonym, n.:
|
||||
The opposite of the word you're trying to think of.
|
||||
@ -20232,7 +20232,7 @@ Good-bye. I am leaving because I am bored.
|
||||
Goodbye, cool world.
|
||||
%
|
||||
Goose pimples rose all over me, my hair stood on end, my eyes filled with
|
||||
tears of love and gratitude for this greatest of all conquerers of human
|
||||
tears of love and gratitude for this greatest of all conquerors of human
|
||||
misery and shame, and my breath came in little gasps. If I had not known
|
||||
that the Leader would have scorned such adulation, I might have fallen to
|
||||
my knees in unashamed worship, but instead I drew myself to attention, raised
|
||||
@ -25099,7 +25099,7 @@ intellectual
|
||||
enlightenment
|
||||
%
|
||||
IBM:
|
||||
[Internation Business Machines Corp.] Also known as Itty Bitty
|
||||
[International Business Machines Corp.] Also known as Itty Bitty
|
||||
Machines or The Lawyer's Friend. The dominant force in computer
|
||||
marketing, having supplied worldwide some 75% of all known hardware
|
||||
and 10% of all software. To protect itself from the litigious envy
|
||||
|
@ -7722,7 +7722,7 @@ I wooed a stewed nude in Bermuda,
|
||||
I was lewd, but my God! she was lewder.
|
||||
She said it was crude
|
||||
To be wooed in the nude--
|
||||
I persued her, subdued her, and screwed her!
|
||||
I pursued her, subdued her, and screwed her!
|
||||
%
|
||||
I would like to say, Mister Bunce,
|
||||
I'm a great connoisseur of hot cunts.
|
||||
@ -9044,7 +9044,7 @@ raped, his house burned, and all his cattle rustled. When he told his
|
||||
distant neighbors about the tragedy, a few of them reported that the only
|
||||
stranger they had seen in the area for weeks was a tall desperado wearing a
|
||||
black hat and a red neckerchief.
|
||||
The cowboy saddled his fastest horse and set out to find the villian.
|
||||
The cowboy saddled his fastest horse and set out to find the villain.
|
||||
He searched for months but couldn't catch up with the culprit; in town after
|
||||
dusty town he was told that a man fitting the description had been there but
|
||||
had just departed; usually after some heinous crime.
|
||||
|
@ -1121,7 +1121,6 @@ pees
|
||||
penis
|
||||
pere
|
||||
Perelman
|
||||
persued
|
||||
pestes
|
||||
Peteer
|
||||
Pettigrew
|
||||
@ -1600,7 +1599,6 @@ vibrators
|
||||
vici
|
||||
Vida
|
||||
vidi
|
||||
villian
|
||||
virginem
|
||||
Visme
|
||||
viziti
|
||||
|
@ -139,7 +139,6 @@ Anouilh
|
||||
ANRS
|
||||
Ansley
|
||||
answerback
|
||||
Antartic
|
||||
Anthony's
|
||||
Antonym
|
||||
Antrim
|
||||
@ -375,7 +374,6 @@ Bertolt
|
||||
Besicovitch
|
||||
Beslove
|
||||
Betazoid
|
||||
bethumped
|
||||
Bette
|
||||
Bevan
|
||||
BEW
|
||||
@ -468,7 +466,6 @@ booing
|
||||
bookaholic
|
||||
Booker's
|
||||
boola
|
||||
Boorchi
|
||||
Boorstin
|
||||
bootable
|
||||
Boothe
|
||||
@ -576,7 +573,6 @@ Bulwer
|
||||
bumperless
|
||||
Bumstead
|
||||
Bungei
|
||||
BURBULATION
|
||||
Buren
|
||||
Burggoven
|
||||
burgled
|
||||
@ -623,7 +619,6 @@ Callahan
|
||||
Callahan's
|
||||
Callimachus
|
||||
Camden
|
||||
Camelia
|
||||
Cameron
|
||||
Camillo
|
||||
Campbell
|
||||
@ -771,7 +766,6 @@ Churchill's
|
||||
Churchy
|
||||
Chuzzlewit
|
||||
CI
|
||||
Cianci
|
||||
Ciardi
|
||||
cinched
|
||||
cinema's
|
||||
@ -806,7 +800,6 @@ Cochran
|
||||
cockamamie
|
||||
Cocteau
|
||||
Cody
|
||||
Cody's
|
||||
Coevolution
|
||||
cogito
|
||||
Cohen's
|
||||
@ -826,7 +819,6 @@ Comebacks
|
||||
Commedia
|
||||
Commie
|
||||
CommUNIXque
|
||||
compuberty
|
||||
computatis
|
||||
Computerdom
|
||||
computerites
|
||||
@ -1077,8 +1069,6 @@ DJ
|
||||
DMPK
|
||||
Dobb's
|
||||
Dobbs
|
||||
doberman
|
||||
doberperson
|
||||
Dobie
|
||||
Doc
|
||||
Docquier
|
||||
@ -1203,7 +1193,6 @@ EINS
|
||||
Einstein's
|
||||
Eisley
|
||||
Elbert
|
||||
ELBONICS
|
||||
Eldridge
|
||||
electrocommunications
|
||||
Electrocution
|
||||
@ -1264,7 +1253,6 @@ Eschenbach
|
||||
Escher
|
||||
esperantisto
|
||||
Esplandian
|
||||
Esser
|
||||
est
|
||||
estas
|
||||
Estes
|
||||
@ -1293,7 +1281,6 @@ exhalation
|
||||
exhibitionists
|
||||
EXP
|
||||
expatriated
|
||||
extemporanea
|
||||
extracurricular
|
||||
Exupery
|
||||
Exxon's
|
||||
@ -1301,7 +1288,6 @@ eyestalks
|
||||
Eyquem
|
||||
Ezrin
|
||||
FAA
|
||||
FACISM
|
||||
Factorials
|
||||
Fadiman
|
||||
Fafhrd
|
||||
@ -1340,7 +1326,6 @@ Fellgett's
|
||||
Felton
|
||||
feminism's
|
||||
Femme
|
||||
FENDERBERG
|
||||
Fenelon
|
||||
Fenster
|
||||
Ferber
|
||||
@ -1369,7 +1354,6 @@ fikcio
|
||||
fiks
|
||||
filees
|
||||
filename
|
||||
Filgoer's
|
||||
filigrees
|
||||
Filkharmonics
|
||||
Fillmore
|
||||
@ -1398,7 +1382,6 @@ flamewars
|
||||
Flandry
|
||||
Flannagan's
|
||||
Flannery
|
||||
FLANNISTER
|
||||
Flappity
|
||||
flatfoot
|
||||
flatteries
|
||||
@ -1410,7 +1393,6 @@ Flon's
|
||||
floppity
|
||||
Florio
|
||||
floss
|
||||
flouride
|
||||
Flugg's
|
||||
Flummery
|
||||
flutterby
|
||||
@ -1557,7 +1539,6 @@ Geminis
|
||||
Genderplex
|
||||
Genesereth
|
||||
Genghis
|
||||
genlock
|
||||
genocide
|
||||
Genter
|
||||
Geritol
|
||||
@ -1605,7 +1586,6 @@ Giuseppe
|
||||
Glanvill
|
||||
Glaser
|
||||
gleekzorp
|
||||
GLEEMITES
|
||||
Glegg
|
||||
gleknow
|
||||
Glib's
|
||||
@ -2013,7 +1993,6 @@ if's
|
||||
ifthen
|
||||
Igmmlptk
|
||||
Ignatowski
|
||||
ignisecond
|
||||
ihuxw
|
||||
IIc
|
||||
III's
|
||||
@ -2498,7 +2477,6 @@ Lovin
|
||||
Lowells
|
||||
Lowery's
|
||||
Lowes
|
||||
Lownes
|
||||
LP
|
||||
LPA
|
||||
LSD
|
||||
@ -2534,7 +2512,6 @@ Ma's
|
||||
Mabbitt
|
||||
Mabley
|
||||
Macaroons
|
||||
MacBeth
|
||||
Maccius
|
||||
MacDowell
|
||||
MacDuff
|
||||
@ -2621,7 +2598,6 @@ Matz's
|
||||
Maud
|
||||
Maud'Dib
|
||||
Maugham
|
||||
Maughm
|
||||
Maupin
|
||||
Maureens
|
||||
Maurois
|
||||
@ -2630,7 +2606,6 @@ Maxey
|
||||
Maxson
|
||||
May's
|
||||
Mayorga
|
||||
Mårten
|
||||
MBAs
|
||||
MBH
|
||||
MC
|
||||
@ -2687,7 +2662,6 @@ Mendelson
|
||||
mendicants
|
||||
Mengot
|
||||
Menninger
|
||||
Mensa
|
||||
Menschen
|
||||
Meow
|
||||
meowing
|
||||
@ -2715,7 +2689,6 @@ Mickos
|
||||
microchips
|
||||
Microcomputing
|
||||
micrometric
|
||||
Microsystem's
|
||||
Microsystems
|
||||
MicroVAXes
|
||||
midgets
|
||||
@ -2730,7 +2703,6 @@ milk's
|
||||
Milkbone
|
||||
Millay
|
||||
Milligan
|
||||
millihelen
|
||||
Millikan
|
||||
Millikan's
|
||||
millions
|
||||
@ -2763,7 +2735,6 @@ Mitford
|
||||
Mitgong
|
||||
mittengrabben
|
||||
mitts
|
||||
mittsquinter
|
||||
MITZIE
|
||||
Mix's
|
||||
Miyamoto
|
||||
@ -2779,7 +2750,6 @@ modifaiing
|
||||
Modula
|
||||
Moebius
|
||||
Mohandas
|
||||
Mohandis
|
||||
mohmen
|
||||
Moishe
|
||||
Molander
|
||||
@ -2803,7 +2773,6 @@ Moolah
|
||||
moonshiner's
|
||||
Moore's
|
||||
mopeds
|
||||
mophobia
|
||||
Moping
|
||||
moralists
|
||||
Mordecai
|
||||
@ -2832,7 +2801,6 @@ Mt
|
||||
MTA
|
||||
Muad'dib
|
||||
muckest
|
||||
mucklucks
|
||||
Mudgeeraba
|
||||
Mudhead
|
||||
mudslide
|
||||
@ -2888,7 +2856,6 @@ nanohenry
|
||||
nanometers
|
||||
Nansen
|
||||
Napoleon's
|
||||
narcolepulacyi
|
||||
Narnia
|
||||
Nasium's
|
||||
Naso
|
||||
@ -2909,7 +2876,6 @@ Neantical
|
||||
Nebuchadnezzar
|
||||
Nebuchadnezzar's
|
||||
necesas
|
||||
necessitious
|
||||
NecroSoft
|
||||
Nehru
|
||||
Neil's
|
||||
@ -2940,7 +2906,6 @@ NF
|
||||
NFL
|
||||
Ngdanga
|
||||
Niagra
|
||||
Niccoli
|
||||
Nicklaus
|
||||
Nicol
|
||||
Nicolaides
|
||||
@ -3165,7 +3130,6 @@ Pearsall
|
||||
PECCATOPHOBIA
|
||||
Pecor's
|
||||
Pedaeration
|
||||
pediddel
|
||||
Peers's
|
||||
Pegler
|
||||
pelted
|
||||
@ -3192,7 +3156,6 @@ Personifiers
|
||||
Petaluma
|
||||
Petersons
|
||||
Petr
|
||||
petribar
|
||||
Petronius
|
||||
Pfeiffer
|
||||
Pfffttt
|
||||
@ -3204,7 +3167,6 @@ Philips
|
||||
philogyny
|
||||
phoney
|
||||
Phooey
|
||||
phosflink
|
||||
Picadilly
|
||||
Pickard
|
||||
Pickle's
|
||||
@ -3246,7 +3208,6 @@ Pocataligo
|
||||
Pocatello
|
||||
Podunk
|
||||
Pohl's
|
||||
Poincair
|
||||
Poincare's
|
||||
pointy
|
||||
Polanski
|
||||
@ -3347,7 +3308,6 @@ Pumpernickel
|
||||
punchline
|
||||
punning
|
||||
PUPs
|
||||
PURPITATION
|
||||
Purshottam
|
||||
PUSHes
|
||||
pushy
|
||||
@ -3551,7 +3511,6 @@ Saberhagen
|
||||
Sacher's
|
||||
Sadat
|
||||
Saddam
|
||||
sadoequinecrophilia
|
||||
Saens
|
||||
Safford
|
||||
Safire's
|
||||
@ -3605,7 +3564,6 @@ Schickele
|
||||
Schieffer
|
||||
schisms
|
||||
schizophrenics
|
||||
schlattwhapper
|
||||
schlichte
|
||||
schluerfen
|
||||
Schmendrick
|
||||
@ -3631,7 +3589,6 @@ Scintillae
|
||||
Scott's
|
||||
Scoville
|
||||
SCRBL
|
||||
SCRIBLINE
|
||||
Scrubb
|
||||
scullery
|
||||
scurries
|
||||
@ -3784,7 +3741,6 @@ somebody'd
|
||||
something's
|
||||
Sondheim
|
||||
Sooooo
|
||||
Soren
|
||||
Sorhed
|
||||
sort've
|
||||
sorta
|
||||
@ -3799,7 +3755,6 @@ SP
|
||||
Spacemen
|
||||
Spaceport
|
||||
spacewar
|
||||
SPAGMUMPS
|
||||
spake
|
||||
Spam
|
||||
spank
|
||||
@ -3824,7 +3779,6 @@ springenwerk
|
||||
Springsteen
|
||||
sprites
|
||||
SPSW
|
||||
SQUATCHO
|
||||
squaws
|
||||
squealers
|
||||
squrooneg
|
||||
@ -3980,7 +3934,6 @@ teepers
|
||||
telematic
|
||||
telepath
|
||||
teleportation
|
||||
TELEPRESSION
|
||||
telepsychology
|
||||
tempfile
|
||||
tendrils
|
||||
@ -4028,7 +3981,6 @@ tinpot
|
||||
Tirith
|
||||
tis
|
||||
Tiselius
|
||||
Titas
|
||||
tites
|
||||
TLC
|
||||
TM
|
||||
@ -4060,7 +4012,6 @@ toun
|
||||
Tourbillon
|
||||
Toven
|
||||
trans
|
||||
transcendant
|
||||
transmogrifiers
|
||||
trapezes
|
||||
Traub
|
||||
@ -4121,7 +4072,6 @@ TYDFS
|
||||
tyg
|
||||
typefaces
|
||||
Tyroon
|
||||
tzu
|
||||
Ubi
|
||||
UDA
|
||||
Udall's
|
||||
@ -4152,7 +4102,6 @@ Unseld
|
||||
untechnician
|
||||
unvoist
|
||||
Updike
|
||||
upharsen
|
||||
uponst
|
||||
Urey
|
||||
Urho
|
||||
|
@ -45,7 +45,6 @@ misc
|
||||
natserv
|
||||
ncal
|
||||
netcat
|
||||
netscape
|
||||
netstat
|
||||
newfile
|
||||
NICs
|
||||
|
@ -3,7 +3,7 @@
|
||||
%% Copyright David Gerrold, 1984-2000, all rights reserved,
|
||||
%% used with permission of the author.
|
||||
%%
|
||||
%%© This is the copyright line.
|
||||
%%© This is the copyright line.
|
||||
%%Eighty-nine is the year we assign.
|
||||
%% These verses are caroled
|
||||
%% by one David Gerrold.
|
||||
|
@ -260,7 +260,7 @@ And white footgear intended for tennis.
|
||||
%
|
||||
A dulcet-voiced callgirl named Shedd,
|
||||
Who's cultured, well-spoken, well-bred,
|
||||
Had achieved some reknown
|
||||
Had achieved some renown
|
||||
For her tone going down--
|
||||
There's a nice civil tongue in her head.
|
||||
%
|
||||
@ -307,7 +307,7 @@ Had sex with a virgin named Grace.
|
||||
By bleeding all over his face.
|
||||
%
|
||||
A gay young prince from Morocco
|
||||
Made love in a manner rococco.
|
||||
Made love in a manner rococo.
|
||||
He painted his penis
|
||||
To resemble a Venus
|
||||
And flavored his semen with cocoa.
|
||||
|
@ -283,6 +283,7 @@ McTavish
|
||||
meanie
|
||||
meanies
|
||||
meany
|
||||
Mensa
|
||||
mentis
|
||||
midgets
|
||||
minimis
|
||||
@ -353,11 +354,9 @@ quimmy
|
||||
quints
|
||||
ravished
|
||||
Reims
|
||||
reknown
|
||||
Resounded
|
||||
retriebrve
|
||||
Rhyll
|
||||
rococco
|
||||
rogered
|
||||
Salinas
|
||||
Sandem
|
||||
|
@ -14,7 +14,6 @@ Corbomite
|
||||
Corby
|
||||
Daystrom
|
||||
Deela
|
||||
Dehaver
|
||||
Elaan
|
||||
Eleen
|
||||
Eneg
|
||||
|
@ -180,7 +180,7 @@ manicurist
|
||||
matic
|
||||
meatball
|
||||
meltdown
|
||||
naugahide
|
||||
naugahyde
|
||||
obstetrician
|
||||
poindexter
|
||||
pre
|
||||
|
@ -161,20 +161,20 @@ static const struct morsetab iso8859_1tab[] = {
|
||||
|
||||
static const struct morsetab iso8859_7tab[] = {
|
||||
/*
|
||||
* The greek alphabet; you'll need an 8859-7 font in order
|
||||
* The Greek alphabet; you'll need an ISO8859-7 font in order
|
||||
* to see the actual characters.
|
||||
* This table does not implement:
|
||||
* - the special sequences for the seven diphthongs,
|
||||
* - the punctuation differences.
|
||||
* Implementing these features would introduce too many
|
||||
* special-cases in the program's main loop.
|
||||
* The diphtong sequences are:
|
||||
* The diphthong sequences are:
|
||||
* alpha iota .-.-
|
||||
* alpha upsilon ..--
|
||||
* epsilon upsilon ---.
|
||||
* eta upsilon ...-
|
||||
* omikron iota ---..
|
||||
* omikron upsilon ..-
|
||||
* omicron iota ---..
|
||||
* omicron upsilon ..-
|
||||
* upsilon iota .---
|
||||
* The different punctuation symbols are:
|
||||
* ; ..-.-
|
||||
@ -193,10 +193,10 @@ static const struct morsetab iso8859_7tab[] = {
|
||||
{'è', "-.-."}, /* theta */
|
||||
{'é', ".."}, /* iota */
|
||||
{'ß', ".."}, /* iota with acute */
|
||||
{'ú', ".."}, /* iota with diairesis */
|
||||
{'À', ".."}, /* iota with acute and diairesis */
|
||||
{'ú', ".."}, /* iota with diaeresis */
|
||||
{'À', ".."}, /* iota with acute and diaeresis */
|
||||
{'ê', "-.-"}, /* kappa */
|
||||
{'ë', ".-.."}, /* lamda */
|
||||
{'ë', ".-.."}, /* lambda */
|
||||
{'ì', "--"}, /* mu */
|
||||
{'í', "-."}, /* nu */
|
||||
{'î', "-..-"}, /* xi */
|
||||
@ -209,8 +209,8 @@ static const struct morsetab iso8859_7tab[] = {
|
||||
{'ô', "-"}, /* tau */
|
||||
{'õ', "-.--"}, /* upsilon */
|
||||
{'ý', "-.--"}, /* upsilon with acute */
|
||||
{'û', "-.--"}, /* upsilon and diairesis */
|
||||
{'à', "-.--"}, /* upsilon with acute and diairesis */
|
||||
{'û', "-.--"}, /* upsilon and diaeresis */
|
||||
{'à', "-.--"}, /* upsilon with acute and diaeresis */
|
||||
{'ö', "..-."}, /* phi */
|
||||
{'÷', "----"}, /* chi */
|
||||
{'ø', "--.-"}, /* psi */
|
||||
@ -222,29 +222,29 @@ static const struct morsetab iso8859_7tab[] = {
|
||||
|
||||
static const struct morsetab koi8rtab[] = {
|
||||
/*
|
||||
* the cyrillic alphabet; you'll need a KOI8R font in order
|
||||
* The Cyrillic alphabet; you'll need a KOI8-R font in order
|
||||
* to see the actual characters
|
||||
*/
|
||||
{'Á', ".-"}, /* a */
|
||||
{'Á', ".-"}, /* a */
|
||||
{'Â', "-..."}, /* be */
|
||||
{'×', ".--"}, /* ve */
|
||||
{'Ç', "--."}, /* ge */
|
||||
{'Ä', "-.."}, /* de */
|
||||
{'Å', "."}, /* ye */
|
||||
{'£', "."}, /* yo, the same as ye */
|
||||
{'Å', "."}, /* ye */
|
||||
{'£', "."}, /* yo, the same as ye */
|
||||
{'Ö', "...-"}, /* she */
|
||||
{'Ú', "--.."}, /* ze */
|
||||
{'É', ".."}, /* i */
|
||||
{'É', ".."}, /* i */
|
||||
{'Ê', ".---"}, /* i kratkoye */
|
||||
{'Ë', "-.-"}, /* ka */
|
||||
{'Ì', ".-.."}, /* el */
|
||||
{'Í', "--"}, /* em */
|
||||
{'Î', "-."}, /* en */
|
||||
{'Í', "--"}, /* em */
|
||||
{'Î', "-."}, /* en */
|
||||
{'Ï', "---"}, /* o */
|
||||
{'Ð', ".--."}, /* pe */
|
||||
{'Ò', ".-."}, /* er */
|
||||
{'Ó', "..."}, /* es */
|
||||
{'Ô', "-"}, /* te */
|
||||
{'Ô', "-"}, /* te */
|
||||
{'Õ', "..-"}, /* u */
|
||||
{'Æ', "..-."}, /* ef */
|
||||
{'È', "...."}, /* kha */
|
||||
@ -305,9 +305,9 @@ main(int argc, char **argv)
|
||||
|
||||
while ((ch = getopt(argc, argv, GETOPTOPTS)) != -1)
|
||||
switch ((char) ch) {
|
||||
case 'c':
|
||||
cpm = atoi(optarg);
|
||||
break;
|
||||
case 'c':
|
||||
cpm = atoi(optarg);
|
||||
break;
|
||||
case 'd':
|
||||
device = optarg;
|
||||
break;
|
||||
|
@ -47,12 +47,14 @@ _texinfo= texinfo
|
||||
_rcs= rcs
|
||||
.endif
|
||||
|
||||
.if ${MK_TOOLCHAIN} != "no"
|
||||
.if ${MK_BINUTILS} != "no"
|
||||
_binutils= binutils
|
||||
.endif
|
||||
.if ${MK_GCC} != "no"
|
||||
_cc= cc
|
||||
.endif
|
||||
.if ${MK_GDB} != "no"
|
||||
_gdb= gdb
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -89,7 +89,6 @@ SUBDIR= ${SUBDIR_ORDERED} \
|
||||
libopie \
|
||||
libpam \
|
||||
libpcap \
|
||||
${_libpkg} \
|
||||
${_libpmc} \
|
||||
${_libproc} \
|
||||
libprocstat \
|
||||
@ -217,10 +216,6 @@ _libmp= libmp
|
||||
_libpmc= libpmc
|
||||
.endif
|
||||
|
||||
.if ${MK_PKGTOOLS} != "no"
|
||||
_libpkg= libpkg
|
||||
.endif
|
||||
|
||||
.if ${MK_SENDMAIL} != "no"
|
||||
_libmilter= libmilter
|
||||
_libsm= libsm
|
||||
|
@ -15,7 +15,7 @@ CFLAGS+= -O1
|
||||
|
||||
TARGET_ARCH?= ${MACHINE_ARCH}
|
||||
# XXX: 8.0, to keep __FreeBSD_cc_version happy
|
||||
CFLAGS+=-DLLVM_HOSTTRIPLE=\"${TARGET_ARCH}-undermydesk-freebsd9.0\"
|
||||
CFLAGS+=-DLLVM_HOSTTRIPLE=\"${TARGET_ARCH:C/amd64/x86_64/}-unknown-freebsd9.0\"
|
||||
|
||||
.ifndef LLVM_REQUIRES_EH
|
||||
CXXFLAGS+=-fno-exceptions
|
||||
|
@ -37,7 +37,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd November 29, 2005
|
||||
.Dd May 17, 2011
|
||||
.Dt MQ_SETATTR 2
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -50,7 +50,7 @@
|
||||
.Ft int
|
||||
.Fo mq_setattr
|
||||
.Fa "mqd_t mqdes"
|
||||
.Fa "struct mq_attr *restrict mqstat"
|
||||
.Fa "const struct mq_attr *restrict mqstat"
|
||||
.Fa "struct mq_attr *restrict omqstat"
|
||||
.Fc
|
||||
.Sh DESCRIPTION
|
||||
|
@ -1,47 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
LIB= pkg
|
||||
|
||||
SHLIBDIR?= /usr/lib
|
||||
SHLIB_MAJOR= 0
|
||||
|
||||
SRCS= deps.c \
|
||||
exec.c \
|
||||
file.c \
|
||||
global.c \
|
||||
match.c \
|
||||
msg.c \
|
||||
pen.c \
|
||||
pkgwrap.c \
|
||||
plist.c \
|
||||
str.c \
|
||||
url.c \
|
||||
version.c
|
||||
INCS= pkg.h
|
||||
|
||||
CFLAGS+= -DYES_I_KNOW_THE_API_IS_RUBBISH_AND_IS_DOOMED_TO_CHANGE
|
||||
|
||||
DPADD= ${LIBFETCH} ${LIBMD} ${LIBUTIL}
|
||||
LDADD= -lfetch -lmd -lutil
|
||||
|
||||
.if ${MK_OPENSSL} != "no"
|
||||
DPADD+= ${LIBSSL} ${LIBCRYPTO}
|
||||
LDADD+= -lssl -lcrypto
|
||||
.endif
|
||||
|
||||
WARNS?= 3
|
||||
|
||||
DATE!= grep LIBPKG_VERSION ${.CURDIR}/pkg.h | sed 's|.*[ ]||'
|
||||
|
||||
distfile: clean
|
||||
@(cd ${.CURDIR}/..; \
|
||||
cp -r libpkg libpkg-${DATE}; \
|
||||
tar -czf libpkg/libpkg-${DATE}.tar.gz \
|
||||
--exclude .#* --exclude *~ --exclude CVS \
|
||||
--exclude .svn --exclude libpkg-*.tar.gz \
|
||||
libpkg-${DATE}; \
|
||||
rm -rf libpkg-${DATE})
|
||||
|
||||
.include <bsd.lib.mk>
|
@ -1,90 +0,0 @@
|
||||
/*
|
||||
* FreeBSD install - a package for the installation and maintenance
|
||||
* of non-core utilities.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* Maxim Sobolev
|
||||
* 8 September 2002
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "pkg.h"
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
extern char **environ;
|
||||
|
||||
void
|
||||
pkg_wrap(long curver, char **argv)
|
||||
{
|
||||
FILE* f;
|
||||
char ver[9]; /* Format is: 'YYYYMMDD\0' */
|
||||
char buffer[FILENAME_MAX+10]; /* Format is: 'YYYYMMDD <path>' */
|
||||
char cmd[FILENAME_MAX+5]; /* Format is: '<path> -PPq' */
|
||||
char *path, *cp;
|
||||
long ptver, lpver;
|
||||
|
||||
if (getenv("PKG_NOWRAP") != NULL)
|
||||
goto nowrap;
|
||||
|
||||
setenv("PKG_NOWRAP", "1", 1);
|
||||
|
||||
/* Get alternative location for package tools. */
|
||||
if ((f = fopen(PKG_WRAPCONF_FNAME, "r")) == NULL) {
|
||||
goto nowrap;
|
||||
} else {
|
||||
if (get_string(buffer, FILENAME_MAX+9, f) == NULL) {
|
||||
goto nowrap;
|
||||
} else {
|
||||
if ((path = strrchr(buffer, ' ')) == NULL) {
|
||||
goto nowrap;
|
||||
} else {
|
||||
*path++ = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((cp = strrchr(argv[0], '/')) == NULL) {
|
||||
cp = argv[0];
|
||||
} else {
|
||||
cp++;
|
||||
}
|
||||
|
||||
/* Get version of the other pkg_install and libpkg */
|
||||
snprintf(cmd, FILENAME_MAX+10, "%s/%s -PPq", path, cp);
|
||||
if ((f = popen(cmd, "r")) == NULL) {
|
||||
perror("popen()");
|
||||
goto nowrap;
|
||||
} else {
|
||||
if (get_string(ver, 9, f) == NULL)
|
||||
goto nowrap;
|
||||
else
|
||||
ptver = strtol(ver, NULL, 10);
|
||||
if (get_string(ver, 9, f) == NULL)
|
||||
goto nowrap;
|
||||
else
|
||||
lpver = strtol(ver, NULL, 10);
|
||||
pclose(f);
|
||||
}
|
||||
|
||||
if ((lpver >= LIBPKG_VERSION) && (ptver > curver)) {
|
||||
snprintf(cmd, FILENAME_MAX, "%s/%s", path, cp);
|
||||
execve(cmd, argv, environ);
|
||||
}
|
||||
|
||||
nowrap:
|
||||
unsetenv("PKG_NOWRAP");
|
||||
}
|
@ -12,6 +12,9 @@ SRCS= cd9660.c \
|
||||
smbfs.c \
|
||||
udf.c
|
||||
|
||||
VERSION_DEF= ${.CURDIR}/Versions.def
|
||||
SYMBOL_MAPS= ${.CURDIR}/Symbol.map
|
||||
|
||||
INCS= libprocstat.h
|
||||
CFLAGS+= -I. -I${.CURDIR} -D_KVM_VNODE
|
||||
SHLIB_MAJOR= 1
|
||||
|
16
lib/libprocstat/Symbol.map
Normal file
16
lib/libprocstat/Symbol.map
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
FBSD_1.2 {
|
||||
procstat_close;
|
||||
procstat_freefiles;
|
||||
procstat_freeprocs;
|
||||
procstat_get_pipe_info;
|
||||
procstat_get_pts_info;
|
||||
procstat_get_socket_info;
|
||||
procstat_get_vnode_info;
|
||||
procstat_getfiles;
|
||||
procstat_getprocs;
|
||||
procstat_open_kvm;
|
||||
procstat_open_sysctl;
|
||||
};
|
5
lib/libprocstat/Versions.def
Normal file
5
lib/libprocstat/Versions.def
Normal file
@ -0,0 +1,5 @@
|
||||
# $FreeBSD$
|
||||
|
||||
# This version was first added to 9.0-current.
|
||||
FBSD_1.2 {
|
||||
};
|
@ -132,6 +132,7 @@ procstat_close(struct procstat *procstat)
|
||||
assert(procstat);
|
||||
if (procstat->type == PROCSTAT_KVM)
|
||||
kvm_close(procstat->kd);
|
||||
free(procstat);
|
||||
}
|
||||
|
||||
struct procstat *
|
||||
@ -253,7 +254,7 @@ procstat_getfiles(struct procstat *procstat, struct kinfo_proc *kp, int mmapped)
|
||||
if (procstat->type == PROCSTAT_SYSCTL)
|
||||
return (procstat_getfiles_sysctl(procstat, kp, mmapped));
|
||||
else if (procstat->type == PROCSTAT_KVM)
|
||||
return (procstat_getfiles_kvm(procstat, kp, mmapped));
|
||||
return (procstat_getfiles_kvm(procstat, kp, mmapped));
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -1,8 +1,13 @@
|
||||
# $FreeBSD$
|
||||
|
||||
LIB= sbuf
|
||||
SHLIBDIR?= /lib
|
||||
SRCS= subr_sbuf.c
|
||||
LIB= sbuf
|
||||
SHLIBDIR?= /lib
|
||||
SRCS= subr_sbuf.c
|
||||
|
||||
SHLIB_MAJOR = 6
|
||||
|
||||
SYMBOL_MAPS= ${.CURDIR}/Symbol.map
|
||||
VERSION_DEF= ${.CURDIR}/Version.def
|
||||
|
||||
.PATH: ${.CURDIR}/../../sys/kern
|
||||
|
||||
|
24
lib/libsbuf/Symbol.map
Normal file
24
lib/libsbuf/Symbol.map
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
FBSD_1.2 {
|
||||
sbuf_new;
|
||||
sbuf_clear;
|
||||
sbuf_setpos;
|
||||
sbuf_bcat;
|
||||
sbuf_bcpy;
|
||||
sbuf_cat;
|
||||
sbuf_cpy;
|
||||
sbuf_printf;
|
||||
sbuf_vprintf;
|
||||
sbuf_putc;
|
||||
sbuf_set_drain;
|
||||
sbuf_trim;
|
||||
sbuf_error;
|
||||
sbuf_finish;
|
||||
sbuf_data;
|
||||
sbuf_len;
|
||||
sbuf_done;
|
||||
sbuf_delete;
|
||||
};
|
4
lib/libsbuf/Version.def
Normal file
4
lib/libsbuf/Version.def
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
|
||||
FBSD_1.2 {
|
||||
};
|
@ -25,11 +25,11 @@ PORTSDIR?= /usr/ports
|
||||
DOCDIR?= /usr/doc
|
||||
RELNOTES_LANG?= en_US.ISO8859-1
|
||||
|
||||
TARGET_ARCH?= ${MACHINE_ARCH}
|
||||
.if ${TARGET_ARCH} == ${MACHINE_ARCH}
|
||||
TARGET?= ${MACHINE}
|
||||
.if ${TARGET} == ${MACHINE}
|
||||
TARGET_ARCH?= ${MACHINE_ARCH}
|
||||
.else
|
||||
TARGET?= ${TARGET_ARCH}
|
||||
TARGET_ARCH?= ${TARGET}
|
||||
.endif
|
||||
IMAKE= ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
|
||||
DISTDIR= ${.OBJDIR}/dist
|
||||
@ -169,7 +169,9 @@ ftp: packagesystem
|
||||
mkdir ftp
|
||||
cp *.txz MANIFEST ftp
|
||||
|
||||
release: obj ${RELEASE_TARGETS}
|
||||
release:
|
||||
${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
|
||||
${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS}
|
||||
|
||||
clean:
|
||||
chflags -R noschg ${.OBJDIR}
|
||||
|
@ -63,7 +63,6 @@ if [ -d $2/usr/doc ]; then
|
||||
fi
|
||||
|
||||
chroot $2 make -C /usr/src $MAKE_FLAGS buildworld buildkernel
|
||||
chroot $2 make -C /usr/src/release obj
|
||||
chroot $2 make -C /usr/src/release release
|
||||
chroot $2 make -C /usr/src/release install DESTDIR=/R
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2000,2001,2002 Søren Schmidt <sos@FreeBSD.org>
|
||||
.\" Copyright (c) 2000,2001,2002 Søren Schmidt <sos@FreeBSD.org>
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2000 - 2006 Søren Schmidt <sos@FreeBSD.org>
|
||||
* Copyright (c) 2000 - 2006 Søren Schmidt <sos@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -253,13 +253,7 @@ find_provider(struct ggeom *gp, off_t minsector)
|
||||
bestsector = 0;
|
||||
LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
|
||||
s = find_provcfg(pp, "start");
|
||||
if (s == NULL) {
|
||||
s = find_provcfg(pp, "offset");
|
||||
sector =
|
||||
(off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
|
||||
} else
|
||||
sector = (off_t)strtoimax(s, NULL, 0);
|
||||
|
||||
sector = (off_t)strtoimax(s, NULL, 0);
|
||||
if (sector < minsector)
|
||||
continue;
|
||||
if (bestpp != NULL && sector >= bestsector)
|
||||
@ -379,18 +373,9 @@ gpart_autofill_resize(struct gctl_req *req)
|
||||
errx(EXIT_FAILURE, "invalid partition index");
|
||||
|
||||
s = find_provcfg(pp, "start");
|
||||
if (s == NULL) {
|
||||
s = find_provcfg(pp, "offset");
|
||||
start = (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
|
||||
} else
|
||||
start = (off_t)strtoimax(s, NULL, 0);
|
||||
start = (off_t)strtoimax(s, NULL, 0);
|
||||
s = find_provcfg(pp, "end");
|
||||
if (s == NULL) {
|
||||
s = find_provcfg(pp, "length");
|
||||
lba = start +
|
||||
(off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
|
||||
} else
|
||||
lba = (off_t)strtoimax(s, NULL, 0) + 1;
|
||||
lba = (off_t)strtoimax(s, NULL, 0) + 1;
|
||||
|
||||
if (lba > last) {
|
||||
geom_deletetree(&mesh);
|
||||
@ -402,12 +387,7 @@ gpart_autofill_resize(struct gctl_req *req)
|
||||
new_size = ALIGNDOWN(last - start + 1, alignment);
|
||||
else {
|
||||
s = find_provcfg(pp, "start");
|
||||
if (s == NULL) {
|
||||
s = find_provcfg(pp, "offset");
|
||||
new_lba =
|
||||
(off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
|
||||
} else
|
||||
new_lba = (off_t)strtoimax(s, NULL, 0);
|
||||
new_lba = (off_t)strtoimax(s, NULL, 0);
|
||||
/*
|
||||
* Is there any free space between current and
|
||||
* next providers?
|
||||
@ -436,7 +416,7 @@ gpart_autofill(struct gctl_req *req)
|
||||
struct gprovider *pp;
|
||||
off_t first, last, a_first;
|
||||
off_t size, start, a_lba;
|
||||
off_t lba, len, alignment;
|
||||
off_t lba, len, alignment, offset;
|
||||
uintmax_t grade;
|
||||
const char *s;
|
||||
int error, has_size, has_start, has_alignment;
|
||||
@ -487,8 +467,6 @@ gpart_autofill(struct gctl_req *req)
|
||||
error = g_parse_lba(s, pp->lg_sectorsize, &size);
|
||||
if (error)
|
||||
errc(EXIT_FAILURE, error, "Invalid size param");
|
||||
if (size > alignment)
|
||||
size = ALIGNDOWN(size, alignment);
|
||||
}
|
||||
|
||||
s = gctl_get_ascii(req, "start");
|
||||
@ -498,27 +476,29 @@ gpart_autofill(struct gctl_req *req)
|
||||
error = g_parse_lba(s, pp->lg_sectorsize, &start);
|
||||
if (error)
|
||||
errc(EXIT_FAILURE, error, "Invalid start param");
|
||||
start = ALIGNUP(start, alignment);
|
||||
}
|
||||
|
||||
/* No autofill necessary. */
|
||||
if (has_size && has_start && !has_alignment)
|
||||
goto done;
|
||||
|
||||
/* Adjust parameters to offset value for better alignment */
|
||||
s = find_provcfg(pp, "offset");
|
||||
offset = (s == NULL) ? 0:
|
||||
(off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
|
||||
start = ALIGNUP(start + offset, alignment);
|
||||
if (size + offset > alignment)
|
||||
size = ALIGNDOWN(size + offset, alignment);
|
||||
|
||||
first = (off_t)strtoimax(find_geomcfg(gp, "first"), NULL, 0);
|
||||
last = (off_t)strtoimax(find_geomcfg(gp, "last"), NULL, 0);
|
||||
grade = ~0ULL;
|
||||
a_first = ALIGNUP(first, alignment);
|
||||
last = ALIGNDOWN(last, alignment);
|
||||
a_first = ALIGNUP(first + offset, alignment);
|
||||
last = ALIGNDOWN(last + offset, alignment);
|
||||
while ((pp = find_provider(gp, first)) != NULL) {
|
||||
s = find_provcfg(pp, "start");
|
||||
if (s == NULL) {
|
||||
s = find_provcfg(pp, "offset");
|
||||
lba = (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
|
||||
} else
|
||||
lba = (off_t)strtoimax(s, NULL, 0);
|
||||
|
||||
a_lba = ALIGNDOWN(lba, alignment);
|
||||
lba = (off_t)strtoimax(s, NULL, 0);
|
||||
a_lba = ALIGNDOWN(lba + offset, alignment);
|
||||
if (first < a_lba && a_first < a_lba) {
|
||||
/* Free space [first, lba> */
|
||||
len = a_lba - a_first;
|
||||
@ -543,13 +523,8 @@ gpart_autofill(struct gctl_req *req)
|
||||
}
|
||||
|
||||
s = find_provcfg(pp, "end");
|
||||
if (s == NULL) {
|
||||
s = find_provcfg(pp, "length");
|
||||
first = lba +
|
||||
(off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize;
|
||||
} else
|
||||
first = (off_t)strtoimax(s, NULL, 0) + 1;
|
||||
a_first = ALIGNUP(first, alignment);
|
||||
first = (off_t)strtoimax(s, NULL, 0) + 1;
|
||||
a_first = ALIGNUP(first + offset, alignment);
|
||||
}
|
||||
if (a_first <= last) {
|
||||
/* Free space [first-last] */
|
||||
@ -573,12 +548,11 @@ gpart_autofill(struct gctl_req *req)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (grade == ~0ULL) {
|
||||
geom_deletetree(&mesh);
|
||||
return (ENOSPC);
|
||||
}
|
||||
|
||||
start -= offset; /* Return back to real offset */
|
||||
done:
|
||||
snprintf(ssize, sizeof(ssize), "%jd", (intmax_t)size);
|
||||
gctl_change_param(req, "size", -1, ssize);
|
||||
@ -625,21 +599,12 @@ gpart_show_geom(struct ggeom *gp, const char *element, int show_providers)
|
||||
|
||||
while ((pp = find_provider(gp, first)) != NULL) {
|
||||
s = find_provcfg(pp, "start");
|
||||
if (s == NULL) {
|
||||
s = find_provcfg(pp, "offset");
|
||||
sector = (off_t)strtoimax(s, NULL, 0) / secsz;
|
||||
} else
|
||||
sector = (off_t)strtoimax(s, NULL, 0);
|
||||
sector = (off_t)strtoimax(s, NULL, 0);
|
||||
|
||||
s = find_provcfg(pp, "end");
|
||||
if (s == NULL) {
|
||||
s = find_provcfg(pp, "length");
|
||||
length = (off_t)strtoimax(s, NULL, 0) / secsz;
|
||||
end = sector + length - 1;
|
||||
} else {
|
||||
end = (off_t)strtoimax(s, NULL, 0);
|
||||
length = end - sector + 1;
|
||||
}
|
||||
end = (off_t)strtoimax(s, NULL, 0);
|
||||
length = end - sector + 1;
|
||||
|
||||
s = find_provcfg(pp, "index");
|
||||
idx = atoi(s);
|
||||
if (first < sector) {
|
||||
@ -782,20 +747,12 @@ gpart_backup(struct gctl_req *req, unsigned int fl __unused)
|
||||
printf("%s %s\n", scheme, s);
|
||||
LIST_FOREACH(pp, &gp->lg_provider, lg_provider) {
|
||||
s = find_provcfg(pp, "start");
|
||||
if (s == NULL) {
|
||||
s = find_provcfg(pp, "offset");
|
||||
sector = (off_t)strtoimax(s, NULL, 0) / secsz;
|
||||
} else
|
||||
sector = (off_t)strtoimax(s, NULL, 0);
|
||||
sector = (off_t)strtoimax(s, NULL, 0);
|
||||
|
||||
s = find_provcfg(pp, "end");
|
||||
if (s == NULL) {
|
||||
s = find_provcfg(pp, "length");
|
||||
length = (off_t)strtoimax(s, NULL, 0) / secsz;
|
||||
} else {
|
||||
end = (off_t)strtoimax(s, NULL, 0);
|
||||
length = end - sector + 1;
|
||||
}
|
||||
end = (off_t)strtoimax(s, NULL, 0);
|
||||
length = end - sector + 1;
|
||||
|
||||
s = find_provcfg(pp, "label");
|
||||
printf("%-*s %*s %*jd %*jd %s %s\n",
|
||||
windex, find_provcfg(pp, "index"),
|
||||
|
@ -341,6 +341,17 @@ control_status(struct nv *nv)
|
||||
printf(" dirty: %ju (%NB)\n",
|
||||
(uintmax_t)nv_get_uint64(nv, "dirty%u", ii),
|
||||
(intmax_t)nv_get_uint64(nv, "dirty%u", ii));
|
||||
printf(" statistics:\n");
|
||||
printf(" reads: %ju\n",
|
||||
(uint64_t)nv_get_uint64(nv, "stat_read%u", ii));
|
||||
printf(" writes: %ju\n",
|
||||
(uint64_t)nv_get_uint64(nv, "stat_write%u", ii));
|
||||
printf(" deletes: %ju\n",
|
||||
(uint64_t)nv_get_uint64(nv, "stat_delete%u", ii));
|
||||
printf(" flushes: %ju\n",
|
||||
(uint64_t)nv_get_uint64(nv, "stat_flush%u", ii));
|
||||
printf(" activemap updates: %ju\n",
|
||||
(uint64_t)nv_get_uint64(nv, "stat_activemap_update%u", ii));
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ SRCS+= metadata.c
|
||||
SRCS+= nv.c
|
||||
SRCS+= secondary.c
|
||||
SRCS+= parse.y pjdlog.c primary.c
|
||||
SRCS+= proto.c proto_common.c proto_socketpair.c proto_tcp4.c proto_uds.c
|
||||
SRCS+= proto.c proto_common.c proto_socketpair.c proto_tcp.c proto_uds.c
|
||||
SRCS+= rangelock.c
|
||||
SRCS+= subr.c
|
||||
SRCS+= token.l
|
||||
@ -20,7 +20,7 @@ SRCS+= y.tab.h
|
||||
MAN= hastd.8 hast.conf.5
|
||||
|
||||
NO_WFORMAT=
|
||||
CFLAGS+=-DPROTO_TCP4_DEFAULT_PORT=8457
|
||||
CFLAGS+=-DPROTO_TCP_DEFAULT_PORT=8457
|
||||
CFLAGS+=-I${.CURDIR}
|
||||
CFLAGS+=-DINET
|
||||
.if ${MK_INET6_SUPPORT} != "no"
|
||||
|
@ -199,6 +199,16 @@ control_status_worker(struct hast_resource *res, struct nv *nvout,
|
||||
"extentsize%u", no);
|
||||
nv_add_uint32(nvout, nv_get_uint32(cnvin, "keepdirty"),
|
||||
"keepdirty%u", no);
|
||||
nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_read"),
|
||||
"stat_read%u", no);
|
||||
nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_write"),
|
||||
"stat_write%u", no);
|
||||
nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_delete"),
|
||||
"stat_delete%u", no);
|
||||
nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_flush"),
|
||||
"stat_flush%u", no);
|
||||
nv_add_uint64(nvout, nv_get_uint64(cnvin, "stat_activemap_update"),
|
||||
"stat_activemap_update%u", no);
|
||||
end:
|
||||
if (cnvin != NULL)
|
||||
nv_free(cnvin);
|
||||
@ -446,6 +456,13 @@ ctrl_thread(void *arg)
|
||||
nv_add_uint32(nvout, (uint32_t)0, "keepdirty");
|
||||
nv_add_uint64(nvout, (uint64_t)0, "dirty");
|
||||
}
|
||||
nv_add_uint64(nvout, res->hr_stat_read, "stat_read");
|
||||
nv_add_uint64(nvout, res->hr_stat_write, "stat_write");
|
||||
nv_add_uint64(nvout, res->hr_stat_delete,
|
||||
"stat_delete");
|
||||
nv_add_uint64(nvout, res->hr_stat_flush, "stat_flush");
|
||||
nv_add_uint64(nvout, res->hr_stat_activemap_update,
|
||||
"stat_activemap_update");
|
||||
nv_add_int16(nvout, 0, "error");
|
||||
break;
|
||||
case CONTROL_RELOAD:
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd April 2, 2011
|
||||
.Dd May 20, 2011
|
||||
.Dt HAST.CONF 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -159,8 +159,14 @@ tcp4://0.0.0.0
|
||||
tcp4://0.0.0.0:8457
|
||||
.Ed
|
||||
.Pp
|
||||
The default value is
|
||||
.Pa tcp4://0.0.0.0:8457 .
|
||||
Multiple listen addresses can be specified.
|
||||
By default
|
||||
.Nm hastd
|
||||
listens on
|
||||
.Pa tcp4://0.0.0.0:8457
|
||||
and
|
||||
.Pa tcp6://[::]:8457
|
||||
if kernel supports IPv4 and IPv6 respectively.
|
||||
.It Ic replication Aq mode
|
||||
.Pp
|
||||
Replication mode should be one of the following:
|
||||
@ -364,26 +370,35 @@ daemon.
|
||||
.Sh EXAMPLES
|
||||
The example configuration file can look as follows:
|
||||
.Bd -literal -offset indent
|
||||
listen tcp://0.0.0.0
|
||||
|
||||
on hasta {
|
||||
listen tcp://2001:db8::1/64
|
||||
}
|
||||
on hastb {
|
||||
listen tcp://2001:db8::2/64
|
||||
}
|
||||
|
||||
resource shared {
|
||||
local /dev/da0
|
||||
|
||||
on hasta {
|
||||
remote tcp4://10.0.0.2
|
||||
remote tcp://10.0.0.2
|
||||
}
|
||||
on hastb {
|
||||
remote tcp4://10.0.0.1
|
||||
remote tcp://10.0.0.1
|
||||
}
|
||||
}
|
||||
resource tank {
|
||||
on hasta {
|
||||
local /dev/mirror/tanka
|
||||
source tcp4://10.0.0.1
|
||||
remote tcp4://10.0.0.2
|
||||
source tcp://10.0.0.1
|
||||
remote tcp://10.0.0.2
|
||||
}
|
||||
on hastb {
|
||||
local /dev/mirror/tankb
|
||||
source tcp4://10.0.0.2
|
||||
remote tcp4://10.0.0.1
|
||||
source tcp://10.0.0.2
|
||||
remote tcp://10.0.0.1
|
||||
}
|
||||
}
|
||||
.Ed
|
||||
|
@ -82,12 +82,13 @@
|
||||
#define HIO_FLUSH 4
|
||||
#define HIO_KEEPALIVE 5
|
||||
|
||||
#define HAST_USER "hast"
|
||||
#define HAST_TIMEOUT 20
|
||||
#define HAST_CONFIG "/etc/hast.conf"
|
||||
#define HAST_CONTROL "/var/run/hastctl"
|
||||
#define HASTD_LISTEN "tcp4://0.0.0.0:8457"
|
||||
#define HASTD_PIDFILE "/var/run/hastd.pid"
|
||||
#define HAST_USER "hast"
|
||||
#define HAST_TIMEOUT 20
|
||||
#define HAST_CONFIG "/etc/hast.conf"
|
||||
#define HAST_CONTROL "/var/run/hastctl"
|
||||
#define HASTD_LISTEN_TCP4 "tcp4://0.0.0.0:8457"
|
||||
#define HASTD_LISTEN_TCP6 "tcp6://[::]:8457"
|
||||
#define HASTD_PIDFILE "/var/run/hastd.pid"
|
||||
|
||||
/* Default extent size. */
|
||||
#define HAST_EXTENTSIZE 2097152
|
||||
@ -100,6 +101,14 @@
|
||||
/* Number of seconds to sleep between reconnect retries or keepalive packets. */
|
||||
#define HAST_KEEPALIVE 10
|
||||
|
||||
struct hastd_listen {
|
||||
/* Address to listen on. */
|
||||
char hl_addr[HAST_ADDRSIZE];
|
||||
/* Protocol-specific data. */
|
||||
struct proto_conn *hl_conn;
|
||||
TAILQ_ENTRY(hastd_listen) hl_next;
|
||||
};
|
||||
|
||||
struct hastd_config {
|
||||
/* Address to communicate with hastctl(8). */
|
||||
char hc_controladdr[HAST_ADDRSIZE];
|
||||
@ -107,10 +116,8 @@ struct hastd_config {
|
||||
struct proto_conn *hc_controlconn;
|
||||
/* Incoming control connection. */
|
||||
struct proto_conn *hc_controlin;
|
||||
/* Address to listen on. */
|
||||
char hc_listenaddr[HAST_ADDRSIZE];
|
||||
/* Protocol-specific data. */
|
||||
struct proto_conn *hc_listenconn;
|
||||
/* List of addresses to listen on. */
|
||||
TAILQ_HEAD(, hastd_listen) hc_listen;
|
||||
/* List of resources. */
|
||||
TAILQ_HEAD(, hast_resource) hc_resources;
|
||||
};
|
||||
@ -211,6 +218,17 @@ struct hast_resource {
|
||||
/* Locked used to synchronize access to hr_amp. */
|
||||
pthread_mutex_t hr_amp_lock;
|
||||
|
||||
/* Number of BIO_READ requests. */
|
||||
uint64_t hr_stat_read;
|
||||
/* Number of BIO_WRITE requests. */
|
||||
uint64_t hr_stat_write;
|
||||
/* Number of BIO_DELETE requests. */
|
||||
uint64_t hr_stat_delete;
|
||||
/* Number of BIO_FLUSH requests. */
|
||||
uint64_t hr_stat_flush;
|
||||
/* Number of activemap updates. */
|
||||
uint64_t hr_stat_activemap_update;
|
||||
|
||||
/* Next resource. */
|
||||
TAILQ_ENTRY(hast_resource) hr_next;
|
||||
};
|
||||
|
@ -98,6 +98,7 @@ void
|
||||
descriptors_cleanup(struct hast_resource *res)
|
||||
{
|
||||
struct hast_resource *tres;
|
||||
struct hastd_listen *lst;
|
||||
|
||||
TAILQ_FOREACH(tres, &cfg->hc_resources, hr_next) {
|
||||
if (tres == res) {
|
||||
@ -120,7 +121,10 @@ descriptors_cleanup(struct hast_resource *res)
|
||||
if (cfg->hc_controlin != NULL)
|
||||
proto_close(cfg->hc_controlin);
|
||||
proto_close(cfg->hc_controlconn);
|
||||
proto_close(cfg->hc_listenconn);
|
||||
TAILQ_FOREACH(lst, &cfg->hc_listen, hl_next) {
|
||||
if (lst->hl_conn != NULL)
|
||||
proto_close(lst->hl_conn);
|
||||
}
|
||||
(void)pidfile_close(pfh);
|
||||
hook_fini();
|
||||
pjdlog_fini();
|
||||
@ -462,6 +466,8 @@ hastd_reload(void)
|
||||
{
|
||||
struct hastd_config *newcfg;
|
||||
struct hast_resource *nres, *cres, *tres;
|
||||
struct hastd_listen *nlst, *clst;
|
||||
unsigned int nlisten;
|
||||
uint8_t role;
|
||||
|
||||
pjdlog_info("Reloading configuration...");
|
||||
@ -483,19 +489,37 @@ hastd_reload(void)
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Check if listen address has changed.
|
||||
* Check if any listen address has changed.
|
||||
*/
|
||||
if (strcmp(cfg->hc_listenaddr, newcfg->hc_listenaddr) != 0) {
|
||||
if (proto_server(newcfg->hc_listenaddr,
|
||||
&newcfg->hc_listenconn) < 0) {
|
||||
pjdlog_errno(LOG_ERR, "Unable to listen on address %s",
|
||||
newcfg->hc_listenaddr);
|
||||
goto failed;
|
||||
nlisten = 0;
|
||||
TAILQ_FOREACH(nlst, &newcfg->hc_listen, hl_next) {
|
||||
TAILQ_FOREACH(clst, &cfg->hc_listen, hl_next) {
|
||||
if (strcmp(nlst->hl_addr, clst->hl_addr) == 0)
|
||||
break;
|
||||
}
|
||||
if (clst != NULL && clst->hl_conn != NULL) {
|
||||
pjdlog_info("Keep listening on address %s.",
|
||||
nlst->hl_addr);
|
||||
nlst->hl_conn = clst->hl_conn;
|
||||
nlisten++;
|
||||
} else if (proto_server(nlst->hl_addr, &nlst->hl_conn) == 0) {
|
||||
pjdlog_info("Listening on new address %s.",
|
||||
nlst->hl_addr);
|
||||
nlisten++;
|
||||
} else {
|
||||
pjdlog_errno(LOG_WARNING,
|
||||
"Unable to listen on address %s", nlst->hl_addr);
|
||||
}
|
||||
}
|
||||
if (nlisten == 0) {
|
||||
pjdlog_error("No addresses to listen on.");
|
||||
goto failed;
|
||||
}
|
||||
|
||||
/* No failures from now on. */
|
||||
|
||||
/*
|
||||
* Only when both control and listen sockets are successfully
|
||||
* initialized switch them to new configuration.
|
||||
* Switch to new control socket.
|
||||
*/
|
||||
if (newcfg->hc_controlconn != NULL) {
|
||||
pjdlog_info("Control socket changed from %s to %s.",
|
||||
@ -506,15 +530,23 @@ hastd_reload(void)
|
||||
strlcpy(cfg->hc_controladdr, newcfg->hc_controladdr,
|
||||
sizeof(cfg->hc_controladdr));
|
||||
}
|
||||
if (newcfg->hc_listenconn != NULL) {
|
||||
pjdlog_info("Listen socket changed from %s to %s.",
|
||||
cfg->hc_listenaddr, newcfg->hc_listenaddr);
|
||||
proto_close(cfg->hc_listenconn);
|
||||
cfg->hc_listenconn = newcfg->hc_listenconn;
|
||||
newcfg->hc_listenconn = NULL;
|
||||
strlcpy(cfg->hc_listenaddr, newcfg->hc_listenaddr,
|
||||
sizeof(cfg->hc_listenaddr));
|
||||
/*
|
||||
* Switch to new listen addresses. Close all that were removed.
|
||||
*/
|
||||
while ((clst = TAILQ_FIRST(&cfg->hc_listen)) != NULL) {
|
||||
TAILQ_FOREACH(nlst, &newcfg->hc_listen, hl_next) {
|
||||
if (strcmp(nlst->hl_addr, clst->hl_addr) == 0)
|
||||
break;
|
||||
}
|
||||
if (nlst == NULL && clst->hl_conn != NULL) {
|
||||
proto_close(clst->hl_conn);
|
||||
pjdlog_info("No longer listening on address %s.",
|
||||
clst->hl_addr);
|
||||
}
|
||||
TAILQ_REMOVE(&cfg->hc_listen, clst, hl_next);
|
||||
free(clst);
|
||||
}
|
||||
TAILQ_CONCAT(&cfg->hc_listen, &newcfg->hc_listen, hl_next);
|
||||
|
||||
/*
|
||||
* Stop and remove resources that were removed from the configuration.
|
||||
@ -607,8 +639,20 @@ hastd_reload(void)
|
||||
if (newcfg != NULL) {
|
||||
if (newcfg->hc_controlconn != NULL)
|
||||
proto_close(newcfg->hc_controlconn);
|
||||
if (newcfg->hc_listenconn != NULL)
|
||||
proto_close(newcfg->hc_listenconn);
|
||||
while ((nlst = TAILQ_FIRST(&newcfg->hc_listen)) != NULL) {
|
||||
if (nlst->hl_conn != NULL) {
|
||||
TAILQ_FOREACH(clst, &cfg->hc_listen, hl_next) {
|
||||
if (strcmp(nlst->hl_addr,
|
||||
clst->hl_addr) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (clst == NULL || clst->hl_conn == NULL)
|
||||
proto_close(nlst->hl_conn);
|
||||
}
|
||||
TAILQ_REMOVE(&newcfg->hc_listen, nlst, hl_next);
|
||||
free(nlst);
|
||||
}
|
||||
yy_config_free(newcfg);
|
||||
}
|
||||
pjdlog_warning("Configuration not reloaded.");
|
||||
@ -634,7 +678,7 @@ terminate_workers(void)
|
||||
}
|
||||
|
||||
static void
|
||||
listen_accept(void)
|
||||
listen_accept(struct hastd_listen *lst)
|
||||
{
|
||||
struct hast_resource *res;
|
||||
struct proto_conn *conn;
|
||||
@ -646,10 +690,10 @@ listen_accept(void)
|
||||
pid_t pid;
|
||||
int status;
|
||||
|
||||
proto_local_address(cfg->hc_listenconn, laddr, sizeof(laddr));
|
||||
proto_local_address(lst->hl_conn, laddr, sizeof(laddr));
|
||||
pjdlog_debug(1, "Accepting connection to %s.", laddr);
|
||||
|
||||
if (proto_accept(cfg->hc_listenconn, &conn) < 0) {
|
||||
if (proto_accept(lst->hl_conn, &conn) < 0) {
|
||||
pjdlog_errno(LOG_ERR, "Unable to accept connection %s", laddr);
|
||||
return;
|
||||
}
|
||||
@ -943,6 +987,7 @@ static void
|
||||
main_loop(void)
|
||||
{
|
||||
struct hast_resource *res;
|
||||
struct hastd_listen *lst;
|
||||
struct timeval seltimeout;
|
||||
int fd, maxfd, ret;
|
||||
time_t lastcheck, now;
|
||||
@ -952,9 +997,6 @@ main_loop(void)
|
||||
seltimeout.tv_sec = REPORT_INTERVAL;
|
||||
seltimeout.tv_usec = 0;
|
||||
|
||||
pjdlog_info("Started successfully, running protocol version %d.",
|
||||
HAST_PROTO_VERSION);
|
||||
|
||||
for (;;) {
|
||||
check_signals();
|
||||
|
||||
@ -963,10 +1005,14 @@ main_loop(void)
|
||||
maxfd = fd = proto_descriptor(cfg->hc_controlconn);
|
||||
PJDLOG_ASSERT(fd >= 0);
|
||||
FD_SET(fd, &rfds);
|
||||
fd = proto_descriptor(cfg->hc_listenconn);
|
||||
PJDLOG_ASSERT(fd >= 0);
|
||||
FD_SET(fd, &rfds);
|
||||
maxfd = fd > maxfd ? fd : maxfd;
|
||||
TAILQ_FOREACH(lst, &cfg->hc_listen, hl_next) {
|
||||
if (lst->hl_conn == NULL)
|
||||
continue;
|
||||
fd = proto_descriptor(lst->hl_conn);
|
||||
PJDLOG_ASSERT(fd >= 0);
|
||||
FD_SET(fd, &rfds);
|
||||
maxfd = fd > maxfd ? fd : maxfd;
|
||||
}
|
||||
TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) {
|
||||
if (res->hr_event == NULL)
|
||||
continue;
|
||||
@ -1014,8 +1060,12 @@ main_loop(void)
|
||||
|
||||
if (FD_ISSET(proto_descriptor(cfg->hc_controlconn), &rfds))
|
||||
control_handle(cfg);
|
||||
if (FD_ISSET(proto_descriptor(cfg->hc_listenconn), &rfds))
|
||||
listen_accept();
|
||||
TAILQ_FOREACH(lst, &cfg->hc_listen, hl_next) {
|
||||
if (lst->hl_conn == NULL)
|
||||
continue;
|
||||
if (FD_ISSET(proto_descriptor(lst->hl_conn), &rfds))
|
||||
listen_accept(lst);
|
||||
}
|
||||
TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) {
|
||||
if (res->hr_event == NULL)
|
||||
continue;
|
||||
@ -1053,6 +1103,7 @@ dummy_sighandler(int sig __unused)
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct hastd_listen *lst;
|
||||
const char *pidfile;
|
||||
pid_t otherpid;
|
||||
bool foreground;
|
||||
@ -1136,10 +1187,12 @@ main(int argc, char *argv[])
|
||||
cfg->hc_controladdr);
|
||||
}
|
||||
/* Listen for remote connections. */
|
||||
if (proto_server(cfg->hc_listenaddr, &cfg->hc_listenconn) < 0) {
|
||||
KEEP_ERRNO((void)pidfile_remove(pfh));
|
||||
pjdlog_exit(EX_OSERR, "Unable to listen on address %s",
|
||||
cfg->hc_listenaddr);
|
||||
TAILQ_FOREACH(lst, &cfg->hc_listen, hl_next) {
|
||||
if (proto_server(lst->hl_addr, &lst->hl_conn) < 0) {
|
||||
KEEP_ERRNO((void)pidfile_remove(pfh));
|
||||
pjdlog_exit(EX_OSERR, "Unable to listen on address %s",
|
||||
lst->hl_addr);
|
||||
}
|
||||
}
|
||||
|
||||
if (!foreground) {
|
||||
@ -1158,6 +1211,14 @@ main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
pjdlog_info("Started successfully, running protocol version %d.",
|
||||
HAST_PROTO_VERSION);
|
||||
|
||||
pjdlog_debug(1, "Listening on control address %s.",
|
||||
cfg->hc_controladdr);
|
||||
TAILQ_FOREACH(lst, &cfg->hc_listen, hl_next)
|
||||
pjdlog_info("Listening on address %s.", lst->hl_addr);
|
||||
|
||||
hook_init();
|
||||
|
||||
main_loop();
|
||||
|
@ -33,12 +33,14 @@
|
||||
|
||||
#include <sys/param.h> /* MAXHOSTNAMELEN */
|
||||
#include <sys/queue.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sysexits.h>
|
||||
@ -59,7 +61,9 @@ static struct hast_resource *curres;
|
||||
static bool mynode, hadmynode;
|
||||
|
||||
static char depth0_control[HAST_ADDRSIZE];
|
||||
static char depth0_listen[HAST_ADDRSIZE];
|
||||
static char depth0_listen_tcp4[HAST_ADDRSIZE];
|
||||
static char depth0_listen_tcp6[HAST_ADDRSIZE];
|
||||
static TAILQ_HEAD(, hastd_listen) depth0_listen;
|
||||
static int depth0_replication;
|
||||
static int depth0_checksum;
|
||||
static int depth0_compression;
|
||||
@ -114,6 +118,19 @@ isitme(const char *name)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static bool
|
||||
family_supported(int family)
|
||||
{
|
||||
int sock;
|
||||
|
||||
sock = socket(family, SOCK_STREAM, 0);
|
||||
if (sock == -1 && errno == EPROTONOSUPPORT)
|
||||
return (false);
|
||||
if (sock >= 0)
|
||||
(void)close(sock);
|
||||
return (true);
|
||||
}
|
||||
|
||||
static int
|
||||
node_names(char **namesp)
|
||||
{
|
||||
@ -175,7 +192,11 @@ yy_config_parse(const char *config, bool exitonerror)
|
||||
depth0_checksum = HAST_CHECKSUM_NONE;
|
||||
depth0_compression = HAST_COMPRESSION_HOLE;
|
||||
strlcpy(depth0_control, HAST_CONTROL, sizeof(depth0_control));
|
||||
strlcpy(depth0_listen, HASTD_LISTEN, sizeof(depth0_listen));
|
||||
TAILQ_INIT(&depth0_listen);
|
||||
strlcpy(depth0_listen_tcp4, HASTD_LISTEN_TCP4,
|
||||
sizeof(depth0_listen_tcp4));
|
||||
strlcpy(depth0_listen_tcp6, HASTD_LISTEN_TCP6,
|
||||
sizeof(depth0_listen_tcp6));
|
||||
depth0_exec[0] = '\0';
|
||||
|
||||
lconfig = calloc(1, sizeof(*lconfig));
|
||||
@ -186,6 +207,7 @@ yy_config_parse(const char *config, bool exitonerror)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
TAILQ_INIT(&lconfig->hc_listen);
|
||||
TAILQ_INIT(&lconfig->hc_resources);
|
||||
|
||||
yyin = fopen(config, "r");
|
||||
@ -214,9 +236,50 @@ yy_config_parse(const char *config, bool exitonerror)
|
||||
strlcpy(lconfig->hc_controladdr, depth0_control,
|
||||
sizeof(lconfig->hc_controladdr));
|
||||
}
|
||||
if (lconfig->hc_listenaddr[0] == '\0') {
|
||||
strlcpy(lconfig->hc_listenaddr, depth0_listen,
|
||||
sizeof(lconfig->hc_listenaddr));
|
||||
if (!TAILQ_EMPTY(&depth0_listen))
|
||||
TAILQ_CONCAT(&lconfig->hc_listen, &depth0_listen, hl_next);
|
||||
if (TAILQ_EMPTY(&lconfig->hc_listen)) {
|
||||
struct hastd_listen *lst;
|
||||
|
||||
if (family_supported(AF_INET)) {
|
||||
lst = calloc(1, sizeof(*lst));
|
||||
if (lst == NULL) {
|
||||
pjdlog_error("Unable to allocate memory for listen address.");
|
||||
yy_config_free(lconfig);
|
||||
if (exitonerror)
|
||||
exit(EX_TEMPFAIL);
|
||||
return (NULL);
|
||||
}
|
||||
(void)strlcpy(lst->hl_addr, depth0_listen_tcp4,
|
||||
sizeof(lst->hl_addr));
|
||||
TAILQ_INSERT_TAIL(&lconfig->hc_listen, lst, hl_next);
|
||||
} else {
|
||||
pjdlog_debug(1,
|
||||
"No IPv4 support in the kernel, not listening on IPv4 address.");
|
||||
}
|
||||
if (family_supported(AF_INET6)) {
|
||||
lst = calloc(1, sizeof(*lst));
|
||||
if (lst == NULL) {
|
||||
pjdlog_error("Unable to allocate memory for listen address.");
|
||||
yy_config_free(lconfig);
|
||||
if (exitonerror)
|
||||
exit(EX_TEMPFAIL);
|
||||
return (NULL);
|
||||
}
|
||||
(void)strlcpy(lst->hl_addr, depth0_listen_tcp6,
|
||||
sizeof(lst->hl_addr));
|
||||
TAILQ_INSERT_TAIL(&lconfig->hc_listen, lst, hl_next);
|
||||
} else {
|
||||
pjdlog_debug(1,
|
||||
"No IPv6 support in the kernel, not listening on IPv6 address.");
|
||||
}
|
||||
if (TAILQ_EMPTY(&lconfig->hc_listen)) {
|
||||
pjdlog_error("No address to listen on.");
|
||||
yy_config_free(lconfig);
|
||||
if (exitonerror)
|
||||
exit(EX_TEMPFAIL);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
TAILQ_FOREACH(curres, &lconfig->hc_resources, hr_next) {
|
||||
assert(curres->hr_provname[0] != '\0');
|
||||
@ -274,8 +337,17 @@ yy_config_parse(const char *config, bool exitonerror)
|
||||
void
|
||||
yy_config_free(struct hastd_config *config)
|
||||
{
|
||||
struct hastd_listen *lst;
|
||||
struct hast_resource *res;
|
||||
|
||||
while ((lst = TAILQ_FIRST(&depth0_listen)) != NULL) {
|
||||
TAILQ_REMOVE(&depth0_listen, lst, hl_next);
|
||||
free(lst);
|
||||
}
|
||||
while ((lst = TAILQ_FIRST(&config->hc_listen)) != NULL) {
|
||||
TAILQ_REMOVE(&config->hc_listen, lst, hl_next);
|
||||
free(lst);
|
||||
}
|
||||
while ((res = TAILQ_FIRST(&config->hc_resources)) != NULL) {
|
||||
TAILQ_REMOVE(&config->hc_resources, res, hr_next);
|
||||
free(res);
|
||||
@ -362,26 +434,30 @@ control_statement: CONTROL STR
|
||||
|
||||
listen_statement: LISTEN STR
|
||||
{
|
||||
struct hastd_listen *lst;
|
||||
|
||||
lst = calloc(1, sizeof(*lst));
|
||||
if (lst == NULL) {
|
||||
pjdlog_error("Unable to allocate memory for listen address.");
|
||||
free($2);
|
||||
return (1);
|
||||
}
|
||||
if (strlcpy(lst->hl_addr, $2, sizeof(lst->hl_addr)) >=
|
||||
sizeof(lst->hl_addr)) {
|
||||
pjdlog_error("listen argument is too long.");
|
||||
free($2);
|
||||
free(lst);
|
||||
return (1);
|
||||
}
|
||||
switch (depth) {
|
||||
case 0:
|
||||
if (strlcpy(depth0_listen, $2,
|
||||
sizeof(depth0_listen)) >=
|
||||
sizeof(depth0_listen)) {
|
||||
pjdlog_error("listen argument is too long.");
|
||||
free($2);
|
||||
return (1);
|
||||
}
|
||||
TAILQ_INSERT_TAIL(&depth0_listen, lst, hl_next);
|
||||
break;
|
||||
case 1:
|
||||
if (!mynode)
|
||||
break;
|
||||
if (strlcpy(lconfig->hc_listenaddr, $2,
|
||||
sizeof(lconfig->hc_listenaddr)) >=
|
||||
sizeof(lconfig->hc_listenaddr)) {
|
||||
pjdlog_error("listen argument is too long.");
|
||||
free($2);
|
||||
return (1);
|
||||
}
|
||||
if (mynode)
|
||||
TAILQ_INSERT_TAIL(&depth0_listen, lst, hl_next);
|
||||
else
|
||||
free(lst);
|
||||
break;
|
||||
default:
|
||||
assert(!"listen at wrong depth level");
|
||||
|
@ -31,8 +31,10 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
@ -103,22 +105,39 @@ pjdlog_printf_render_sockaddr(struct __printf_io *io,
|
||||
switch (ss->ss_family) {
|
||||
case AF_INET:
|
||||
{
|
||||
char addr[INET_ADDRSTRLEN];
|
||||
const struct sockaddr_in *sin;
|
||||
in_addr_t ip;
|
||||
unsigned int port;
|
||||
|
||||
sin = (const struct sockaddr_in *)ss;
|
||||
ip = ntohl(sin->sin_addr.s_addr);
|
||||
port = ntohs(sin->sin_port);
|
||||
if (inet_ntop(ss->ss_family, &sin->sin_addr, addr,
|
||||
sizeof(addr)) == NULL) {
|
||||
PJDLOG_ABORT("inet_ntop(AF_INET) failed: %s.",
|
||||
strerror(errno));
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s:%u", addr, port);
|
||||
break;
|
||||
}
|
||||
case AF_INET6:
|
||||
{
|
||||
char addr[INET6_ADDRSTRLEN];
|
||||
const struct sockaddr_in6 *sin;
|
||||
unsigned int port;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%u.%u.%u.%u:%u",
|
||||
((ip >> 24) & 0xff), ((ip >> 16) & 0xff),
|
||||
((ip >> 8) & 0xff), (ip & 0xff), port);
|
||||
sin = (const struct sockaddr_in6 *)ss;
|
||||
port = ntohs(sin->sin6_port);
|
||||
if (inet_ntop(ss->ss_family, &sin->sin6_addr, addr,
|
||||
sizeof(addr)) == NULL) {
|
||||
PJDLOG_ABORT("inet_ntop(AF_INET6) failed: %s.",
|
||||
strerror(errno));
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "[%s]:%u", addr, port);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
snprintf(buf, sizeof(buf), "[unsupported family %u]",
|
||||
(unsigned int)ss->ss_family);
|
||||
snprintf(buf, sizeof(buf), "[unsupported family %hhu]",
|
||||
ss->ss_family);
|
||||
break;
|
||||
}
|
||||
ret = __printf_out(io, pi, buf, strlen(buf));
|
||||
|
@ -1117,6 +1117,7 @@ ggate_recv_thread(void *arg)
|
||||
*/
|
||||
switch (ggio->gctl_cmd) {
|
||||
case BIO_READ:
|
||||
res->hr_stat_read++;
|
||||
pjdlog_debug(2,
|
||||
"ggate_recv: (%p) Moving request to the send queue.",
|
||||
hio);
|
||||
@ -1145,6 +1146,7 @@ ggate_recv_thread(void *arg)
|
||||
QUEUE_INSERT1(hio, send, ncomp);
|
||||
break;
|
||||
case BIO_WRITE:
|
||||
res->hr_stat_write++;
|
||||
if (res->hr_resuid == 0) {
|
||||
/*
|
||||
* This is first write, initialize localcnt and
|
||||
@ -1183,12 +1185,21 @@ ggate_recv_thread(void *arg)
|
||||
mtx_lock(&res->hr_amp_lock);
|
||||
if (activemap_write_start(res->hr_amp,
|
||||
ggio->gctl_offset, ggio->gctl_length)) {
|
||||
res->hr_stat_activemap_update++;
|
||||
(void)hast_activemap_flush(res);
|
||||
}
|
||||
mtx_unlock(&res->hr_amp_lock);
|
||||
/* FALLTHROUGH */
|
||||
case BIO_DELETE:
|
||||
case BIO_FLUSH:
|
||||
switch (ggio->gctl_cmd) {
|
||||
case BIO_DELETE:
|
||||
res->hr_stat_delete++;
|
||||
break;
|
||||
case BIO_FLUSH:
|
||||
res->hr_stat_flush++;
|
||||
break;
|
||||
}
|
||||
pjdlog_debug(2,
|
||||
"ggate_recv: (%p) Moving request to the send queues.",
|
||||
hio);
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*-
|
||||
* Copyright (c) 2009-2010 The FreeBSD Foundation
|
||||
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was developed by Pawel Jakub Dawidek under sponsorship from
|
||||
@ -51,37 +52,19 @@ __FBSDID("$FreeBSD$");
|
||||
#include "proto_impl.h"
|
||||
#include "subr.h"
|
||||
|
||||
#define TCP4_CTX_MAGIC 0x7c441c
|
||||
struct tcp4_ctx {
|
||||
#define TCP_CTX_MAGIC 0x7c41c
|
||||
struct tcp_ctx {
|
||||
int tc_magic;
|
||||
struct sockaddr_in tc_sin;
|
||||
struct sockaddr_storage tc_sa;
|
||||
int tc_fd;
|
||||
int tc_side;
|
||||
#define TCP4_SIDE_CLIENT 0
|
||||
#define TCP4_SIDE_SERVER_LISTEN 1
|
||||
#define TCP4_SIDE_SERVER_WORK 2
|
||||
#define TCP_SIDE_CLIENT 0
|
||||
#define TCP_SIDE_SERVER_LISTEN 1
|
||||
#define TCP_SIDE_SERVER_WORK 2
|
||||
};
|
||||
|
||||
static int tcp4_connect_wait(void *ctx, int timeout);
|
||||
static void tcp4_close(void *ctx);
|
||||
|
||||
static in_addr_t
|
||||
str2ip(const char *str)
|
||||
{
|
||||
struct hostent *hp;
|
||||
in_addr_t ip;
|
||||
|
||||
ip = inet_addr(str);
|
||||
if (ip != INADDR_NONE) {
|
||||
/* It is a valid IP address. */
|
||||
return (ip);
|
||||
}
|
||||
/* Check if it is a valid host name. */
|
||||
hp = gethostbyname(str);
|
||||
if (hp == NULL)
|
||||
return (INADDR_NONE);
|
||||
return (((struct in_addr *)(void *)hp->h_addr)->s_addr);
|
||||
}
|
||||
static int tcp_connect_wait(void *ctx, int timeout);
|
||||
static void tcp_close(void *ctx);
|
||||
|
||||
/*
|
||||
* Function converts the given string to unsigned number.
|
||||
@ -114,70 +97,106 @@ numfromstr(const char *str, intmax_t minnum, intmax_t maxnum, intmax_t *nump)
|
||||
}
|
||||
|
||||
static int
|
||||
tcp4_addr(const char *addr, int defport, struct sockaddr_in *sinp)
|
||||
tcp_addr(const char *addr, int defport, struct sockaddr_storage *sap)
|
||||
{
|
||||
char iporhost[MAXHOSTNAMELEN];
|
||||
char iporhost[MAXHOSTNAMELEN], portstr[6];
|
||||
struct addrinfo hints;
|
||||
struct addrinfo *res;
|
||||
const char *pp;
|
||||
intmax_t port;
|
||||
size_t size;
|
||||
in_addr_t ip;
|
||||
int error;
|
||||
|
||||
if (addr == NULL)
|
||||
return (-1);
|
||||
|
||||
if (strncasecmp(addr, "tcp4://", 7) == 0)
|
||||
bzero(&hints, sizeof(hints));
|
||||
hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICSERV;
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
|
||||
if (strncasecmp(addr, "tcp4://", 7) == 0) {
|
||||
addr += 7;
|
||||
else if (strncasecmp(addr, "tcp://", 6) == 0)
|
||||
hints.ai_family = PF_INET;
|
||||
} else if (strncasecmp(addr, "tcp6://", 7) == 0) {
|
||||
addr += 7;
|
||||
hints.ai_family = PF_INET6;
|
||||
} else if (strncasecmp(addr, "tcp://", 6) == 0) {
|
||||
addr += 6;
|
||||
else {
|
||||
} else {
|
||||
/*
|
||||
* Because TCP4 is the default assume IP or host is given without
|
||||
* Because TCP is the default assume IP or host is given without
|
||||
* prefix.
|
||||
*/
|
||||
}
|
||||
|
||||
sinp->sin_family = AF_INET;
|
||||
sinp->sin_len = sizeof(*sinp);
|
||||
/* Extract optional port. */
|
||||
pp = strrchr(addr, ':');
|
||||
/*
|
||||
* Extract optional port.
|
||||
* There are three cases to consider.
|
||||
* 1. hostname with port, eg. freefall.freebsd.org:8457
|
||||
* 2. IPv4 address with port, eg. 192.168.0.101:8457
|
||||
* 3. IPv6 address with port, eg. [fe80::1]:8457
|
||||
* We discover IPv6 address by checking for two colons and if port is
|
||||
* given, the address has to start with [.
|
||||
*/
|
||||
pp = NULL;
|
||||
if (strchr(addr, ':') != strrchr(addr, ':')) {
|
||||
if (addr[0] == '[')
|
||||
pp = strrchr(addr, ':');
|
||||
} else {
|
||||
pp = strrchr(addr, ':');
|
||||
}
|
||||
if (pp == NULL) {
|
||||
/* Port not given, use the default. */
|
||||
sinp->sin_port = htons(defport);
|
||||
port = defport;
|
||||
} else {
|
||||
intmax_t port;
|
||||
|
||||
if (numfromstr(pp + 1, 1, 65535, &port) < 0)
|
||||
return (errno);
|
||||
sinp->sin_port = htons(port);
|
||||
}
|
||||
(void)snprintf(portstr, sizeof(portstr), "%jd", (intmax_t)port);
|
||||
/* Extract host name or IP address. */
|
||||
if (pp == NULL) {
|
||||
size = sizeof(iporhost);
|
||||
if (strlcpy(iporhost, addr, size) >= size)
|
||||
return (ENAMETOOLONG);
|
||||
} else if (addr[0] == '[' && pp[-1] == ']') {
|
||||
size = (size_t)(pp - addr - 2 + 1);
|
||||
if (size > sizeof(iporhost))
|
||||
return (ENAMETOOLONG);
|
||||
(void)strlcpy(iporhost, addr + 1, size);
|
||||
} else {
|
||||
size = (size_t)(pp - addr + 1);
|
||||
if (size > sizeof(iporhost))
|
||||
return (ENAMETOOLONG);
|
||||
(void)strlcpy(iporhost, addr, size);
|
||||
}
|
||||
/* Convert string (IP address or host name) to in_addr_t. */
|
||||
ip = str2ip(iporhost);
|
||||
if (ip == INADDR_NONE)
|
||||
|
||||
error = getaddrinfo(iporhost, portstr, &hints, &res);
|
||||
if (error != 0) {
|
||||
pjdlog_debug(1, "getaddrinfo(%s, %s) failed: %s.", iporhost,
|
||||
portstr, gai_strerror(error));
|
||||
return (EINVAL);
|
||||
sinp->sin_addr.s_addr = ip;
|
||||
}
|
||||
if (res == NULL)
|
||||
return (ENOENT);
|
||||
|
||||
memcpy(sap, res->ai_addr, res->ai_addrlen);
|
||||
|
||||
freeaddrinfo(res);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
tcp4_setup_new(const char *addr, int side, void **ctxp)
|
||||
tcp_setup_new(const char *addr, int side, void **ctxp)
|
||||
{
|
||||
struct tcp4_ctx *tctx;
|
||||
struct tcp_ctx *tctx;
|
||||
int ret, nodelay;
|
||||
|
||||
PJDLOG_ASSERT(addr != NULL);
|
||||
PJDLOG_ASSERT(side == TCP4_SIDE_CLIENT ||
|
||||
side == TCP4_SIDE_SERVER_LISTEN);
|
||||
PJDLOG_ASSERT(side == TCP_SIDE_CLIENT ||
|
||||
side == TCP_SIDE_SERVER_LISTEN);
|
||||
PJDLOG_ASSERT(ctxp != NULL);
|
||||
|
||||
tctx = malloc(sizeof(*tctx));
|
||||
@ -185,22 +204,21 @@ tcp4_setup_new(const char *addr, int side, void **ctxp)
|
||||
return (errno);
|
||||
|
||||
/* Parse given address. */
|
||||
if ((ret = tcp4_addr(addr, PROTO_TCP4_DEFAULT_PORT,
|
||||
&tctx->tc_sin)) != 0) {
|
||||
if ((ret = tcp_addr(addr, PROTO_TCP_DEFAULT_PORT, &tctx->tc_sa)) != 0) {
|
||||
free(tctx);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
PJDLOG_ASSERT(tctx->tc_sin.sin_family != AF_UNSPEC);
|
||||
PJDLOG_ASSERT(tctx->tc_sa.ss_family != AF_UNSPEC);
|
||||
|
||||
tctx->tc_fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
tctx->tc_fd = socket(tctx->tc_sa.ss_family, SOCK_STREAM, 0);
|
||||
if (tctx->tc_fd == -1) {
|
||||
ret = errno;
|
||||
free(tctx);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
PJDLOG_ASSERT(tctx->tc_sin.sin_family != AF_UNSPEC);
|
||||
PJDLOG_ASSERT(tctx->tc_sa.ss_family != AF_UNSPEC);
|
||||
|
||||
/* Socket settings. */
|
||||
nodelay = 1;
|
||||
@ -210,20 +228,20 @@ tcp4_setup_new(const char *addr, int side, void **ctxp)
|
||||
}
|
||||
|
||||
tctx->tc_side = side;
|
||||
tctx->tc_magic = TCP4_CTX_MAGIC;
|
||||
tctx->tc_magic = TCP_CTX_MAGIC;
|
||||
*ctxp = tctx;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
tcp4_setup_wrap(int fd, int side, void **ctxp)
|
||||
tcp_setup_wrap(int fd, int side, void **ctxp)
|
||||
{
|
||||
struct tcp4_ctx *tctx;
|
||||
struct tcp_ctx *tctx;
|
||||
|
||||
PJDLOG_ASSERT(fd >= 0);
|
||||
PJDLOG_ASSERT(side == TCP4_SIDE_CLIENT ||
|
||||
side == TCP4_SIDE_SERVER_WORK);
|
||||
PJDLOG_ASSERT(side == TCP_SIDE_CLIENT ||
|
||||
side == TCP_SIDE_SERVER_WORK);
|
||||
PJDLOG_ASSERT(ctxp != NULL);
|
||||
|
||||
tctx = malloc(sizeof(*tctx));
|
||||
@ -231,51 +249,51 @@ tcp4_setup_wrap(int fd, int side, void **ctxp)
|
||||
return (errno);
|
||||
|
||||
tctx->tc_fd = fd;
|
||||
tctx->tc_sin.sin_family = AF_UNSPEC;
|
||||
tctx->tc_sa.ss_family = AF_UNSPEC;
|
||||
tctx->tc_side = side;
|
||||
tctx->tc_magic = TCP4_CTX_MAGIC;
|
||||
tctx->tc_magic = TCP_CTX_MAGIC;
|
||||
*ctxp = tctx;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
tcp4_client(const char *srcaddr, const char *dstaddr, void **ctxp)
|
||||
tcp_client(const char *srcaddr, const char *dstaddr, void **ctxp)
|
||||
{
|
||||
struct tcp4_ctx *tctx;
|
||||
struct sockaddr_in sin;
|
||||
struct tcp_ctx *tctx;
|
||||
struct sockaddr_storage sa;
|
||||
int ret;
|
||||
|
||||
ret = tcp4_setup_new(dstaddr, TCP4_SIDE_CLIENT, ctxp);
|
||||
ret = tcp_setup_new(dstaddr, TCP_SIDE_CLIENT, ctxp);
|
||||
if (ret != 0)
|
||||
return (ret);
|
||||
tctx = *ctxp;
|
||||
if (srcaddr == NULL)
|
||||
return (0);
|
||||
ret = tcp4_addr(srcaddr, 0, &sin);
|
||||
ret = tcp_addr(srcaddr, 0, &sa);
|
||||
if (ret != 0) {
|
||||
tcp4_close(tctx);
|
||||
tcp_close(tctx);
|
||||
return (ret);
|
||||
}
|
||||
if (bind(tctx->tc_fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
|
||||
if (bind(tctx->tc_fd, (struct sockaddr *)&sa, sa.ss_len) < 0) {
|
||||
ret = errno;
|
||||
tcp4_close(tctx);
|
||||
tcp_close(tctx);
|
||||
return (ret);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
tcp4_connect(void *ctx, int timeout)
|
||||
tcp_connect(void *ctx, int timeout)
|
||||
{
|
||||
struct tcp4_ctx *tctx = ctx;
|
||||
struct tcp_ctx *tctx = ctx;
|
||||
int error, flags;
|
||||
|
||||
PJDLOG_ASSERT(tctx != NULL);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
|
||||
PJDLOG_ASSERT(tctx->tc_side == TCP4_SIDE_CLIENT);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
|
||||
PJDLOG_ASSERT(tctx->tc_side == TCP_SIDE_CLIENT);
|
||||
PJDLOG_ASSERT(tctx->tc_fd >= 0);
|
||||
PJDLOG_ASSERT(tctx->tc_sin.sin_family != AF_UNSPEC);
|
||||
PJDLOG_ASSERT(tctx->tc_sa.ss_family != AF_UNSPEC);
|
||||
PJDLOG_ASSERT(timeout >= -1);
|
||||
|
||||
flags = fcntl(tctx->tc_fd, F_GETFL);
|
||||
@ -295,8 +313,8 @@ tcp4_connect(void *ctx, int timeout)
|
||||
return (errno);
|
||||
}
|
||||
|
||||
if (connect(tctx->tc_fd, (struct sockaddr *)&tctx->tc_sin,
|
||||
sizeof(tctx->tc_sin)) == 0) {
|
||||
if (connect(tctx->tc_fd, (struct sockaddr *)&tctx->tc_sa,
|
||||
tctx->tc_sa.ss_len) == 0) {
|
||||
if (timeout == -1)
|
||||
return (0);
|
||||
error = 0;
|
||||
@ -309,7 +327,7 @@ tcp4_connect(void *ctx, int timeout)
|
||||
}
|
||||
if (timeout == -1)
|
||||
return (0);
|
||||
return (tcp4_connect_wait(ctx, timeout));
|
||||
return (tcp_connect_wait(ctx, timeout));
|
||||
done:
|
||||
flags &= ~O_NONBLOCK;
|
||||
if (fcntl(tctx->tc_fd, F_SETFL, flags) == -1) {
|
||||
@ -322,17 +340,17 @@ tcp4_connect(void *ctx, int timeout)
|
||||
}
|
||||
|
||||
static int
|
||||
tcp4_connect_wait(void *ctx, int timeout)
|
||||
tcp_connect_wait(void *ctx, int timeout)
|
||||
{
|
||||
struct tcp4_ctx *tctx = ctx;
|
||||
struct tcp_ctx *tctx = ctx;
|
||||
struct timeval tv;
|
||||
fd_set fdset;
|
||||
socklen_t esize;
|
||||
int error, flags, ret;
|
||||
|
||||
PJDLOG_ASSERT(tctx != NULL);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
|
||||
PJDLOG_ASSERT(tctx->tc_side == TCP4_SIDE_CLIENT);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
|
||||
PJDLOG_ASSERT(tctx->tc_side == TCP_SIDE_CLIENT);
|
||||
PJDLOG_ASSERT(tctx->tc_fd >= 0);
|
||||
PJDLOG_ASSERT(timeout >= 0);
|
||||
|
||||
@ -387,12 +405,12 @@ tcp4_connect_wait(void *ctx, int timeout)
|
||||
}
|
||||
|
||||
static int
|
||||
tcp4_server(const char *addr, void **ctxp)
|
||||
tcp_server(const char *addr, void **ctxp)
|
||||
{
|
||||
struct tcp4_ctx *tctx;
|
||||
struct tcp_ctx *tctx;
|
||||
int ret, val;
|
||||
|
||||
ret = tcp4_setup_new(addr, TCP4_SIDE_SERVER_LISTEN, ctxp);
|
||||
ret = tcp_setup_new(addr, TCP_SIDE_SERVER_LISTEN, ctxp);
|
||||
if (ret != 0)
|
||||
return (ret);
|
||||
|
||||
@ -403,17 +421,17 @@ tcp4_server(const char *addr, void **ctxp)
|
||||
(void)setsockopt(tctx->tc_fd, SOL_SOCKET, SO_REUSEADDR, &val,
|
||||
sizeof(val));
|
||||
|
||||
PJDLOG_ASSERT(tctx->tc_sin.sin_family != AF_UNSPEC);
|
||||
PJDLOG_ASSERT(tctx->tc_sa.ss_family != AF_UNSPEC);
|
||||
|
||||
if (bind(tctx->tc_fd, (struct sockaddr *)&tctx->tc_sin,
|
||||
sizeof(tctx->tc_sin)) < 0) {
|
||||
if (bind(tctx->tc_fd, (struct sockaddr *)&tctx->tc_sa,
|
||||
tctx->tc_sa.ss_len) < 0) {
|
||||
ret = errno;
|
||||
tcp4_close(tctx);
|
||||
tcp_close(tctx);
|
||||
return (ret);
|
||||
}
|
||||
if (listen(tctx->tc_fd, 8) < 0) {
|
||||
ret = errno;
|
||||
tcp4_close(tctx);
|
||||
tcp_close(tctx);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -421,25 +439,25 @@ tcp4_server(const char *addr, void **ctxp)
|
||||
}
|
||||
|
||||
static int
|
||||
tcp4_accept(void *ctx, void **newctxp)
|
||||
tcp_accept(void *ctx, void **newctxp)
|
||||
{
|
||||
struct tcp4_ctx *tctx = ctx;
|
||||
struct tcp4_ctx *newtctx;
|
||||
struct tcp_ctx *tctx = ctx;
|
||||
struct tcp_ctx *newtctx;
|
||||
socklen_t fromlen;
|
||||
int ret;
|
||||
|
||||
PJDLOG_ASSERT(tctx != NULL);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
|
||||
PJDLOG_ASSERT(tctx->tc_side == TCP4_SIDE_SERVER_LISTEN);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
|
||||
PJDLOG_ASSERT(tctx->tc_side == TCP_SIDE_SERVER_LISTEN);
|
||||
PJDLOG_ASSERT(tctx->tc_fd >= 0);
|
||||
PJDLOG_ASSERT(tctx->tc_sin.sin_family != AF_UNSPEC);
|
||||
PJDLOG_ASSERT(tctx->tc_sa.ss_family != AF_UNSPEC);
|
||||
|
||||
newtctx = malloc(sizeof(*newtctx));
|
||||
if (newtctx == NULL)
|
||||
return (errno);
|
||||
|
||||
fromlen = sizeof(tctx->tc_sin);
|
||||
newtctx->tc_fd = accept(tctx->tc_fd, (struct sockaddr *)&tctx->tc_sin,
|
||||
fromlen = tctx->tc_sa.ss_len;
|
||||
newtctx->tc_fd = accept(tctx->tc_fd, (struct sockaddr *)&tctx->tc_sa,
|
||||
&fromlen);
|
||||
if (newtctx->tc_fd < 0) {
|
||||
ret = errno;
|
||||
@ -447,28 +465,28 @@ tcp4_accept(void *ctx, void **newctxp)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
newtctx->tc_side = TCP4_SIDE_SERVER_WORK;
|
||||
newtctx->tc_magic = TCP4_CTX_MAGIC;
|
||||
newtctx->tc_side = TCP_SIDE_SERVER_WORK;
|
||||
newtctx->tc_magic = TCP_CTX_MAGIC;
|
||||
*newctxp = newtctx;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
tcp4_wrap(int fd, bool client, void **ctxp)
|
||||
tcp_wrap(int fd, bool client, void **ctxp)
|
||||
{
|
||||
|
||||
return (tcp4_setup_wrap(fd,
|
||||
client ? TCP4_SIDE_CLIENT : TCP4_SIDE_SERVER_WORK, ctxp));
|
||||
return (tcp_setup_wrap(fd,
|
||||
client ? TCP_SIDE_CLIENT : TCP_SIDE_SERVER_WORK, ctxp));
|
||||
}
|
||||
|
||||
static int
|
||||
tcp4_send(void *ctx, const unsigned char *data, size_t size, int fd)
|
||||
tcp_send(void *ctx, const unsigned char *data, size_t size, int fd)
|
||||
{
|
||||
struct tcp4_ctx *tctx = ctx;
|
||||
struct tcp_ctx *tctx = ctx;
|
||||
|
||||
PJDLOG_ASSERT(tctx != NULL);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
|
||||
PJDLOG_ASSERT(tctx->tc_fd >= 0);
|
||||
PJDLOG_ASSERT(fd == -1);
|
||||
|
||||
@ -476,12 +494,12 @@ tcp4_send(void *ctx, const unsigned char *data, size_t size, int fd)
|
||||
}
|
||||
|
||||
static int
|
||||
tcp4_recv(void *ctx, unsigned char *data, size_t size, int *fdp)
|
||||
tcp_recv(void *ctx, unsigned char *data, size_t size, int *fdp)
|
||||
{
|
||||
struct tcp4_ctx *tctx = ctx;
|
||||
struct tcp_ctx *tctx = ctx;
|
||||
|
||||
PJDLOG_ASSERT(tctx != NULL);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
|
||||
PJDLOG_ASSERT(tctx->tc_fd >= 0);
|
||||
PJDLOG_ASSERT(fdp == NULL);
|
||||
|
||||
@ -489,82 +507,105 @@ tcp4_recv(void *ctx, unsigned char *data, size_t size, int *fdp)
|
||||
}
|
||||
|
||||
static int
|
||||
tcp4_descriptor(const void *ctx)
|
||||
tcp_descriptor(const void *ctx)
|
||||
{
|
||||
const struct tcp4_ctx *tctx = ctx;
|
||||
const struct tcp_ctx *tctx = ctx;
|
||||
|
||||
PJDLOG_ASSERT(tctx != NULL);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
|
||||
|
||||
return (tctx->tc_fd);
|
||||
}
|
||||
|
||||
static bool
|
||||
tcp4_address_match(const void *ctx, const char *addr)
|
||||
tcp_address_match(const void *ctx, const char *addr)
|
||||
{
|
||||
const struct tcp4_ctx *tctx = ctx;
|
||||
struct sockaddr_in sin;
|
||||
socklen_t sinlen;
|
||||
in_addr_t ip1, ip2;
|
||||
const struct tcp_ctx *tctx = ctx;
|
||||
struct sockaddr_storage sa1, sa2;
|
||||
socklen_t salen;
|
||||
|
||||
PJDLOG_ASSERT(tctx != NULL);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
|
||||
|
||||
if (tcp4_addr(addr, PROTO_TCP4_DEFAULT_PORT, &sin) != 0)
|
||||
if (tcp_addr(addr, PROTO_TCP_DEFAULT_PORT, &sa1) != 0)
|
||||
return (false);
|
||||
ip1 = sin.sin_addr.s_addr;
|
||||
|
||||
sinlen = sizeof(sin);
|
||||
if (getpeername(tctx->tc_fd, (struct sockaddr *)&sin, &sinlen) < 0)
|
||||
salen = sizeof(sa2);
|
||||
if (getpeername(tctx->tc_fd, (struct sockaddr *)&sa2, &salen) < 0)
|
||||
return (false);
|
||||
ip2 = sin.sin_addr.s_addr;
|
||||
|
||||
return (ip1 == ip2);
|
||||
if (sa1.ss_family != sa2.ss_family || sa1.ss_len != sa2.ss_len)
|
||||
return (false);
|
||||
|
||||
switch (sa1.ss_family) {
|
||||
case AF_INET:
|
||||
{
|
||||
struct sockaddr_in *sin1, *sin2;
|
||||
|
||||
sin1 = (struct sockaddr_in *)&sa1;
|
||||
sin2 = (struct sockaddr_in *)&sa2;
|
||||
|
||||
return (memcmp(&sin1->sin_addr, &sin2->sin_addr,
|
||||
sizeof(sin1->sin_addr)) == 0);
|
||||
}
|
||||
case AF_INET6:
|
||||
{
|
||||
struct sockaddr_in6 *sin1, *sin2;
|
||||
|
||||
sin1 = (struct sockaddr_in6 *)&sa1;
|
||||
sin2 = (struct sockaddr_in6 *)&sa2;
|
||||
|
||||
return (memcmp(&sin1->sin6_addr, &sin2->sin6_addr,
|
||||
sizeof(sin1->sin6_addr)) == 0);
|
||||
}
|
||||
default:
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tcp4_local_address(const void *ctx, char *addr, size_t size)
|
||||
tcp_local_address(const void *ctx, char *addr, size_t size)
|
||||
{
|
||||
const struct tcp4_ctx *tctx = ctx;
|
||||
struct sockaddr_in sin;
|
||||
socklen_t sinlen;
|
||||
const struct tcp_ctx *tctx = ctx;
|
||||
struct sockaddr_storage sa;
|
||||
socklen_t salen;
|
||||
|
||||
PJDLOG_ASSERT(tctx != NULL);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
|
||||
|
||||
sinlen = sizeof(sin);
|
||||
if (getsockname(tctx->tc_fd, (struct sockaddr *)&sin, &sinlen) < 0) {
|
||||
salen = sizeof(sa);
|
||||
if (getsockname(tctx->tc_fd, (struct sockaddr *)&sa, &salen) < 0) {
|
||||
PJDLOG_VERIFY(strlcpy(addr, "N/A", size) < size);
|
||||
return;
|
||||
}
|
||||
PJDLOG_VERIFY(snprintf(addr, size, "tcp4://%S", &sin) < (ssize_t)size);
|
||||
PJDLOG_VERIFY(snprintf(addr, size, "tcp://%S", &sa) < (ssize_t)size);
|
||||
}
|
||||
|
||||
static void
|
||||
tcp4_remote_address(const void *ctx, char *addr, size_t size)
|
||||
tcp_remote_address(const void *ctx, char *addr, size_t size)
|
||||
{
|
||||
const struct tcp4_ctx *tctx = ctx;
|
||||
struct sockaddr_in sin;
|
||||
socklen_t sinlen;
|
||||
const struct tcp_ctx *tctx = ctx;
|
||||
struct sockaddr_storage sa;
|
||||
socklen_t salen;
|
||||
|
||||
PJDLOG_ASSERT(tctx != NULL);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
|
||||
|
||||
sinlen = sizeof(sin);
|
||||
if (getpeername(tctx->tc_fd, (struct sockaddr *)&sin, &sinlen) < 0) {
|
||||
salen = sizeof(sa);
|
||||
if (getpeername(tctx->tc_fd, (struct sockaddr *)&sa, &salen) < 0) {
|
||||
PJDLOG_VERIFY(strlcpy(addr, "N/A", size) < size);
|
||||
return;
|
||||
}
|
||||
PJDLOG_VERIFY(snprintf(addr, size, "tcp4://%S", &sin) < (ssize_t)size);
|
||||
PJDLOG_VERIFY(snprintf(addr, size, "tcp://%S", &sa) < (ssize_t)size);
|
||||
}
|
||||
|
||||
static void
|
||||
tcp4_close(void *ctx)
|
||||
tcp_close(void *ctx)
|
||||
{
|
||||
struct tcp4_ctx *tctx = ctx;
|
||||
struct tcp_ctx *tctx = ctx;
|
||||
|
||||
PJDLOG_ASSERT(tctx != NULL);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP4_CTX_MAGIC);
|
||||
PJDLOG_ASSERT(tctx->tc_magic == TCP_CTX_MAGIC);
|
||||
|
||||
if (tctx->tc_fd >= 0)
|
||||
close(tctx->tc_fd);
|
||||
@ -572,26 +613,26 @@ tcp4_close(void *ctx)
|
||||
free(tctx);
|
||||
}
|
||||
|
||||
static struct proto tcp4_proto = {
|
||||
.prt_name = "tcp4",
|
||||
.prt_client = tcp4_client,
|
||||
.prt_connect = tcp4_connect,
|
||||
.prt_connect_wait = tcp4_connect_wait,
|
||||
.prt_server = tcp4_server,
|
||||
.prt_accept = tcp4_accept,
|
||||
.prt_wrap = tcp4_wrap,
|
||||
.prt_send = tcp4_send,
|
||||
.prt_recv = tcp4_recv,
|
||||
.prt_descriptor = tcp4_descriptor,
|
||||
.prt_address_match = tcp4_address_match,
|
||||
.prt_local_address = tcp4_local_address,
|
||||
.prt_remote_address = tcp4_remote_address,
|
||||
.prt_close = tcp4_close
|
||||
static struct proto tcp_proto = {
|
||||
.prt_name = "tcp",
|
||||
.prt_client = tcp_client,
|
||||
.prt_connect = tcp_connect,
|
||||
.prt_connect_wait = tcp_connect_wait,
|
||||
.prt_server = tcp_server,
|
||||
.prt_accept = tcp_accept,
|
||||
.prt_wrap = tcp_wrap,
|
||||
.prt_send = tcp_send,
|
||||
.prt_recv = tcp_recv,
|
||||
.prt_descriptor = tcp_descriptor,
|
||||
.prt_address_match = tcp_address_match,
|
||||
.prt_local_address = tcp_local_address,
|
||||
.prt_remote_address = tcp_remote_address,
|
||||
.prt_close = tcp_close
|
||||
};
|
||||
|
||||
static __constructor void
|
||||
tcp4_ctor(void)
|
||||
tcp_ctor(void)
|
||||
{
|
||||
|
||||
proto_register(&tcp4_proto, true);
|
||||
proto_register(&tcp_proto, true);
|
||||
}
|
@ -514,6 +514,7 @@ requnpack(struct hast_resource *res, struct hio *hio)
|
||||
goto end;
|
||||
}
|
||||
switch (hio->hio_cmd) {
|
||||
case HIO_FLUSH:
|
||||
case HIO_KEEPALIVE:
|
||||
break;
|
||||
case HIO_READ:
|
||||
@ -611,6 +612,20 @@ recv_thread(void *arg)
|
||||
QUEUE_INSERT(send, hio);
|
||||
continue;
|
||||
}
|
||||
switch (hio->hio_cmd) {
|
||||
case HIO_READ:
|
||||
res->hr_stat_read++;
|
||||
break;
|
||||
case HIO_WRITE:
|
||||
res->hr_stat_write++;
|
||||
break;
|
||||
case HIO_DELETE:
|
||||
res->hr_stat_delete++;
|
||||
break;
|
||||
case HIO_FLUSH:
|
||||
res->hr_stat_flush++;
|
||||
break;
|
||||
}
|
||||
reqlog(LOG_DEBUG, 2, -1, hio,
|
||||
"recv: (%p) Got request header: ", hio);
|
||||
if (hio->hio_cmd == HIO_KEEPALIVE) {
|
||||
|
@ -224,7 +224,13 @@ drop_privs(struct hast_resource *res)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (res == NULL || res->hr_role != HAST_ROLE_PRIMARY)
|
||||
/*
|
||||
* Until capsicum doesn't allow ioctl(2) we cannot use it to sandbox
|
||||
* primary and secondary worker processes, as primary uses GGATE
|
||||
* ioctls and secondary uses ioctls to handle BIO_DELETE and BIO_FLUSH.
|
||||
* For now capsicum is only used to sandbox hastctl.
|
||||
*/
|
||||
if (res == NULL)
|
||||
capsicum = (cap_enter() == 0);
|
||||
else
|
||||
capsicum = false;
|
||||
|
@ -68,7 +68,7 @@ sha256 { DP; return SHA256; }
|
||||
hole { DP; return HOLE; }
|
||||
lzf { DP; return LZF; }
|
||||
[0-9]+ { DP; yylval.num = atoi(yytext); return NUM; }
|
||||
[a-zA-Z0-9\.\-_/\:]+ { DP; yylval.str = strdup(yytext); return STR; }
|
||||
[a-zA-Z0-9\.\-_/\:\[\]]+ { DP; yylval.str = strdup(yytext); return STR; }
|
||||
\{ { DP; depth++; return OB; }
|
||||
\} { DP; depth--; return CB; }
|
||||
#.*$ /* ignore comments */;
|
||||
|
@ -268,13 +268,9 @@ setmedia(const char *val, int d, int s, const struct afswtch *afp)
|
||||
subtype = get_media_subtype(IFM_TYPE(ifmr->ifm_ulist[0]), val);
|
||||
|
||||
strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
|
||||
ifr.ifr_media = (ifmr->ifm_current & ~(IFM_NMASK|IFM_TMASK)) |
|
||||
ifr.ifr_media = (ifmr->ifm_current & IFM_IMASK) |
|
||||
IFM_TYPE(ifmr->ifm_ulist[0]) | subtype;
|
||||
|
||||
if ((ifr.ifr_media & IFM_TMASK) == 0) {
|
||||
ifr.ifr_media &= ~(IFM_GMASK | IFM_OMASK);
|
||||
}
|
||||
|
||||
ifmr->ifm_current = ifr.ifr_media;
|
||||
callback_register(setifmediacallback, (void *)ifmr);
|
||||
}
|
||||
|
@ -565,9 +565,9 @@ if the sysctl variable
|
||||
is set to 0 (default), one can use
|
||||
.Xr bpf 4
|
||||
attached to the
|
||||
.Xr ipfw0
|
||||
.Li ipfw0
|
||||
pseudo interface. There is no overhead if no
|
||||
.Xr bpf
|
||||
.Xr bpf 4
|
||||
is attached to the pseudo interface.
|
||||
.Pp
|
||||
If
|
||||
|
@ -1,7 +1,7 @@
|
||||
.\"
|
||||
.\" Copyright (c) 1993,1994 Christopher G. Demetriou
|
||||
.\" Copyright (c) 1999 Semen Ustimenko
|
||||
.\" Copyright (c) 2005 Jean-Sébastien Pédron
|
||||
.\" Copyright (c) 2005 Jean-Sébastien Pédron
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2005 Jean-Sébastien Pédron
|
||||
* Copyright (c) 2005 Jean-Sébastien Pédron
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user