Drop suid privileges after opening the channel

1. Drop suid privileges after opening the channel.
2. Move opening the channel as early as possible (once all of the
   channel related options have been parsed / extracted).
3. Remove unnecessary chown calls now that permissions have been
   revoked.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Fix object and program directory for VS2010

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Replace ioctl calls with channel functions

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Add missing header
Remove references to non existing header files
Remove lastbuildstate files

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Merge remote-tracking branch 'origin/master' into drop_suid

Conflicts:
	plc/Makefile

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>