Commit Graph

6487 Commits

Author SHA1 Message Date
Ulrich Spörlein
1cc06c674e Remove bsdlabel.5, which hasn't been installed in over 7 years
and contains little more than an out-dated copy of <sys/disklabel.h>
2011-03-10 08:23:58 +00:00
Pawel Jakub Dawidek
7a9611bf5e Change example to not be controversial.
I'm sorry to anyone who felt offended by this.

PR:		docs/155385
Reported by:	maga_lena <mirto@riseup.net>
MFC after:	1 week
2011-03-09 07:43:51 +00:00
Andrey V. Elsukov
bd727a6884 It is better to sometimes have not aligned columns than
often have wrapped lines.

MFC after:	2 weeks
2011-03-08 22:01:47 +00:00
Andrey V. Elsukov
acefd268d6 Add -p option to gpart show command to show provider's names of
partitions instead of partition's indexes. This may be useful with
GPT partitioning scheme or EBR without GEOM_PART_EBR_COMPAT option.

MFC after:	2 weeks
2011-03-08 21:36:42 +00:00
Pawel Jakub Dawidek
a98bce2941 Unbreak the build.
MFC after:	2 weeks
2011-03-07 19:54:51 +00:00
Pawel Jakub Dawidek
dd5759bf72 Print some of the numbers in human readable form (using %N).
MFC after:	2 weeks
2011-03-07 10:42:28 +00:00
Pawel Jakub Dawidek
fa356f6cfe - Log size of data to synchronize in human readable form (using %N).
- Log synchronization time (using %T).
- Log synchronization speed in human readable form (using %N).

MFC after:	2 weeks
2011-03-07 10:41:12 +00:00
Pawel Jakub Dawidek
1c151458c6 Use %S to print IP address and port number.
MFC after:	2 weeks
2011-03-07 10:39:26 +00:00
Pawel Jakub Dawidek
9e5bdc9d83 - Turn on printf extentions.
- Load support for %T for pritning time.
- Add support for %N for printing number in human readable form.
- Add support for %S for printing sockaddr structure (currently only AF_INET
  family is supported, as this is all we need in HAST).
- Disable gcc compile-time format checking as this will no longer work.

MFC after:	2 weeks
2011-03-07 10:38:18 +00:00
Pawel Jakub Dawidek
a61f579394 Provides three states for pjdlog_initialized, so we can also tell that
this is fist initialization ever.

MFC after:	2 weeks
2011-03-07 10:33:52 +00:00
Pawel Jakub Dawidek
8cd3d45ad9 Allow to compress on-the-wire data using two algorithms:
- HOLE - it simply turns all-zero blocks into few bytes header;
	it is extremely fast, so it is turned on by default;
	it is mostly intended to speed up initial synchronization
	where we expect many zeros;
- LZF - very fast algorithm by Marc Alexander Lehmann, which shows
	very decent compression ratio and has BSD license.

MFC after:	2 weeks
2011-03-06 23:09:33 +00:00
Pawel Jakub Dawidek
1fee97b01f Allow to checksum on-the-wire data using either CRC32 or SHA256.
MFC after:	2 weeks
2011-03-06 22:56:14 +00:00
Doug Barton
2960733f48 Revert r217871. 2011-02-25 20:49:07 +00:00
Rebecca Cran
974206cf70 Fix typos - remove duplicate "is".
PR:		docs/154934
Submitted by:	Eitan Adler <lists at eitanadler.com>
MFC after:	3 days
2011-02-23 09:22:33 +00:00
Jaakko Heinonen
75297f6e48 Xref makefs(8).
PR:		154708
Submitted by:	jhs
2011-02-22 15:31:40 +00:00
Kirk McKusick
d92f0739ab Add the -j option to enable soft updates journaling when creating
a new file system.

Reviewed by: Kostik Belousov <kostikbel@gmail.com>
2011-02-16 06:00:27 +00:00
Giorgos Keramidas
c43728a230 Note that a UFS filesystem can have up to 20 active snapshots.
PR:		docs/151104
Submitted by:	Aldis Berjoza <aldis@bsdroot.lv>
MFC after:	3 days
2011-02-15 07:25:54 +00:00
Rebecca Cran
c3e257a9e7 Add a check to make sure the provider name is "mdN" before printing the
unit number.

Suggested by: 	jh
MFC after:	3 days
2011-02-14 09:58:47 +00:00
Rebecca Cran
6992d350af Only print the unit number when invoked with the -n flag.
PR:	bin/144300
Submitted by:	arundel
MFC after:	3 days
2011-02-13 18:30:17 +00:00
Konstantin Belousov
0947d19a09 In checker, read journal by sectors.
Due to UFS insistence to pretend that device sector size is 512 bytes,
sector size is obtained from ioctl(DIOCGSECTORSIZE) for real devices,
and from the label otherwise. The file images without label have to
be made with 512 sector size.

In collaboration with:	pho
Reviewed by:	jeff
Tested by:	bz, pho
2011-02-12 13:17:14 +00:00
Konstantin Belousov
e605011a00 When creating a directory entry for the journal, always read at least
the fragment, and write the full block. Reading less might not work
due to device sector size bigger then size of direntries in the
last directory fragment.

Reported by:	bz
In collaboration with:	pho
Reviewed by:	jeff
Tested by:	bz, pho
2011-02-12 13:12:45 +00:00
Pawel Jakub Dawidek
493812ee6e When we decide to unlink socket file, sun_path must be set. If it is set,
but there is problem unlinking the file, log a warning.

MFC after:	1 week
2011-02-09 08:01:10 +00:00
Pawel Jakub Dawidek
0d8d37212b Explicitly include <sys/types.h> as suggested by getpid(2) and don't rely on
<sys/un.h> including what's needed.

MFC after:	1 week
2011-02-08 23:16:19 +00:00
Pawel Jakub Dawidek
f431ab182a Unlink UNIX domain socket file only if:
1. The descriptor is the one we are listening on (not the one when we connect
   as a client and not the one which is created on accept(2)).
2. Descriptor was created by us (PID matches with the PID stored on bind(2)).

Reported by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	1 week
2011-02-08 23:08:20 +00:00
Pawel Jakub Dawidek
e84a29b629 Now that we break the loop on fstat(2) failure we no longer need to satisfy
gcc's imperfections.

MFC after:	1 week
2011-02-06 14:17:08 +00:00
Pawel Jakub Dawidek
207ee3cdea Add (void) cast before snprintf(3)s for which we are not interested in return
values.

MFC after:	1 week
2011-02-06 14:09:19 +00:00
Pawel Jakub Dawidek
ee3a876c18 Treat fstat(2) failure (different than EBADF) as fatal error.
Reported by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	1 week
2011-02-06 14:07:58 +00:00
Pawel Jakub Dawidek
18d6e1a5f6 Open syslog when logging sysconf(3) failure.
Reported by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	1 week
2011-02-06 14:06:37 +00:00
Pawel Jakub Dawidek
5aa85abd1d Close more descriptors that can be open if the worker process for the given
resource is already running.

Submitted by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	1 week
2011-02-06 12:21:29 +00:00
Pawel Jakub Dawidek
32ecf62028 Setup another socketpair between parent and child, so that primary sandboxed
worker can ask the main privileged process to connect in worker's behalf
and then we can migrate descriptor using this socketpair to worker.
This is not really needed now, but will be needed once we start to use
capsicum for sandboxing.

MFC after:	1 week
2011-02-03 11:39:49 +00:00
Pawel Jakub Dawidek
21e7bc5e52 Add missing locking after moving keepalive_send() to remote send thread
in r214692.

MFC after:	1 week
2011-02-03 11:33:32 +00:00
Pawel Jakub Dawidek
7cf48ac8c8 Drop privileges after connecting to hastd, but before sending or receiving
anything.

MFC after:	1 week
2011-02-03 10:44:40 +00:00
Pawel Jakub Dawidek
f4c96f944c Let the caller log info about successful privilege drop.
We don't want to log this in hastctl.

MFC after:	1 week
2011-02-03 10:37:44 +00:00
Bjoern A. Zeeb
5a1caf9a5d Add missing argument after r218192. 2011-02-02 20:00:35 +00:00
Pawel Jakub Dawidek
01ab52c021 - Rename proto_descriptor_{send,recv}() functions to
proto_connection_{send,recv} and change them to return proto_conn
  structure. We don't operate directly on descriptors, but on
  proto_conns.
- Add wrap method to wrap descriptor with proto_conn.
- Remove methods to send and receive descriptors and implement this
  functionality as additional argument to send and receive methods.

MFC after:	1 week
2011-02-02 15:53:09 +00:00
Pawel Jakub Dawidek
1c1933226f Add proto_connect_wait() to wait for connection to finish.
If timeout argument to proto_connect() is -1, then the caller needs to use
this new function to wait for connection.

This change is in preparation for capsicum, where sandboxed worker wants
to ask main process to connect in worker's behalf and pass descriptor
to the worker. Because we don't want the main process to wait for the
connection, it will start async connection and pass descriptor to the
worker who will be responsible for waiting for the connection to finish.

MFC after:	1 week
2011-02-02 15:46:28 +00:00
Pawel Jakub Dawidek
9d70b24b93 Allow to specify connection timeout by the caller.
MFC after:	1 week
2011-02-02 15:42:00 +00:00
Pawel Jakub Dawidek
5ee1703532 Move protocol allocation and deallocation to separate functions.
MFC after:	1 week
2011-02-02 15:23:07 +00:00
Pawel Jakub Dawidek
8dd94e231b Be prepared that hp_client or hp_server might be NULL now.
MFC after:	1 week
2011-02-02 08:24:26 +00:00
Pawel Jakub Dawidek
292c424d6e Do not set socket send and receive buffer. It will be auto-tuned.
Confirmed by:	rwatson
MFC after:	1 week
2011-02-01 07:58:43 +00:00
Pawel Jakub Dawidek
94486ae22d Fix build on ia64.
I found no way how to use CMSG_NXTHDR() macro on ia64 without alignment
warnings.

MFC after:	1 week
2011-01-31 23:46:36 +00:00
Pawel Jakub Dawidek
2c450cb873 Until I fix the build on ia64 comment out problematic lines.
Those lines are part of the (for now) unused functions.
2011-01-31 23:08:26 +00:00
Pawel Jakub Dawidek
8046c499ab Implement two new functions for sending descriptor and receving descriptor
over UNIX domain sockets and socket pairs.
This is in preparation for capsicum.

MFC after:	1 week
2011-01-31 18:35:17 +00:00
Pawel Jakub Dawidek
2ec483c58e - Use pjdlog for assertions and aborts as this will log assert/abort message
to syslog if we run in background.
- Asserts in proto.c that method we want to call is implemented and remove
  dummy methods from protocols implementation that are only there to abort
  the program with nice message.

MFC after:	1 week
2011-01-31 18:32:17 +00:00
Pawel Jakub Dawidek
05a6b8de87 Rename pjdlog_verify() to pjdlog_abort() as it better describes what the
the function does and mark it with __dead2.

MFC after:	1 week
2011-01-31 15:52:00 +00:00
Bernhard Schmidt
90e0ec14c1 Fix the 'scan hang' issue.
When requesting a scan and one is already in progess, e.g. while in scan
state, we happily wait for a scan done notification. Though, this
notification might never be sent, e.g. if we are trying to find a network
to associate to and there is none. Instead of always waiting for a
notification just do so if a new scan has been started. For both cases the
scan cache is used to report available networks even if the content might
not be fresh.

MFC after:	1 month
2011-01-30 14:22:45 +00:00
Bernhard Schmidt
a272741053 When doing a scan while being associated it is possible that the scan
is deferred for the time it takes to flush the TX queue. This work being
done the scan then is continued, but only if it is marked to do so. As
the 'ifconfig scan' request is meant to be used after the interface is
brought up, request a background scan by default. This behaviour is
already documented in manual page.

This fixes on possible case where 'ifconfig scan' hangs infinitely.

MFC after:	1 month
2011-01-30 13:17:45 +00:00
Pawel Jakub Dawidek
6d7967de8a Drop privileges in worker processes.
Accepting connections and handshaking in secondary is still done before
dropping privileges. It should be implemented by only accepting connections in
privileged main process and passing connection descriptors to the worker, but
is not implemented yet.

MFC after:	1 week
2011-01-28 22:35:46 +00:00
Pawel Jakub Dawidek
49499e981e Implement function that drops privileges by:
- chrooting to /var/empty (user hast home directory),
- setting groups to 'hast' (user hast primary group),
- setting real group id, effective group id and saved group id to 'hast',
- setting real user id, effective user id and saved user id to 'hast'.
At the end verify that those operations where successfull.

MFC after:	1 week
2011-01-28 22:33:47 +00:00
Pawel Jakub Dawidek
f463896e5e Use newly added descriptors_assert() function to ensure only expected
descriptors are open.

MFC after:	1 week
2011-01-28 21:57:42 +00:00