Fix socket calls on error post-r243965

Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
Fix creating a user and adding it to a group

Reported by:	"Sam Fourman Jr." <sfourman@gmail.com>, dim
In case of the deletion of a user those whole database has to be regenerated,
otherwise the user planned to be deleted remain in the pwd.db while removed from
the plain text password file.
Use the correct USB interface macros instead of USB_IF_CSI.

As pointed out by hselasky@, USB_IF_CSI is the wrong macro here since we want
to declare the device's interface class, subclass and protocol, not class,
subclass and driver info.

Follow-up to r244704.

PR:		kern/174707
Approved by:	glebius
MFC after:	1 week
Use DEVMETHOD_END, as suggested by hselasky@.

Approved by:	glebius
Reset provider-specific fields when resending I/O request in low memory
conditions. This fixes assertion which checks those fields when kernel is
compiled with DIAGNOSTIC.

Reported by:	kib, pho
MFC after:	1 week
Add the NO_SYNC_CACHE quirk for all Apple USB MSC devices, as they
typically do not handle the SYNCHRONIZE_CACHE command - they either
return an error or the firmware enters a reset loop.

Reviewed by:	hselasky
Approved by:	rstone (co-mentor)
MFC after:	2 weeks
Fix off-by-one error in memory allocation: j entries, one new and a null
terminator is j + 2.

Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
Simplify copying of group members by using memcpy

Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
Comments and fit to 80-columns.
Fix a copy and paste error.

MFC after: 3 days
Minor cleanups of debug messages.

MFC after: 3 days
Some cleanups.

MFC after: 3 days
use nanosecond resolution, make sure gettimeofday
is called at most every 100 packets.
br_prod_tail and br_cons_tail members are used as barrier to
signal bug_ring ownership. However, instructions can be reordered
around members write leading to stale values for ie. br_prod_bufs.

Use correct memory barriers to ensure proper ordering of the
ownership tokens updates.

Sponsored by:	EMC / Isilon storage division
MFC after:	2 weeks
Remove an unused var.

Sponsored by:	EMC / Isilon storage division
MFC after:	3 days
test(1): Document == alias for =.

Reviewed by:	gjb
Requested by:	gjb
MFC after:	1 week
Use flopen(3) instead of open(2) + flock(2)
New gr_add function to provide a clean and safe method to append a new member
into an existing group.

Submitted by:	db
Simplify the code by using the new gr_add function