svn commit: r255665 - in head: usr.bin/iscsictl usr.sbin/ctld usr.sbin/iscsid

2013-09-18 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Sep 18 08:37:14 2013
New Revision: 255665
URL: http://svnweb.freebsd.org/changeset/base/255665

Log:
  Make iscsictl(8) automatically try to load the iscsi module.  While here,
  improve module loading in iscsid(8) and ctld(8).
  
  Approved by:  re (delphij)

Modified:
  head/usr.bin/iscsictl/iscsictl.c
  head/usr.sbin/ctld/kernel.c
  head/usr.sbin/iscsid/iscsid.c

Modified: head/usr.bin/iscsictl/iscsictl.c
==
--- head/usr.bin/iscsictl/iscsictl.cWed Sep 18 06:40:47 2013
(r255664)
+++ head/usr.bin/iscsictl/iscsictl.cWed Sep 18 08:37:14 2013
(r255665)
@@ -30,6 +30,8 @@
  */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -512,7 +514,7 @@ main(int argc, char **argv)
const char *conf_path = DEFAULT_CONFIG_PATH;
char *nickname = NULL, *discovery_host = NULL, *host = NULL,
 *target = NULL, *user = NULL, *secret = NULL;
-   int ch, error, iscsi_fd;
+   int ch, error, iscsi_fd, retval, saved_errno;
int failed = 0;
struct conf *conf;
struct target *targ;
@@ -672,6 +674,14 @@ main(int argc, char **argv)
}
 
iscsi_fd = open(ISCSI_PATH, O_RDWR);
+   if (iscsi_fd < 0 && errno == ENOENT) {
+   saved_errno = errno;
+   retval = kldload("iscsi");
+   if (retval != -1)
+   iscsi_fd = open(ISCSI_PATH, O_RDWR);
+   else
+   errno = saved_errno;
+   }
if (iscsi_fd < 0)
err(1, "failed to open %s", ISCSI_PATH);
 

Modified: head/usr.sbin/ctld/kernel.c
==
--- head/usr.sbin/ctld/kernel.c Wed Sep 18 06:40:47 2013(r255664)
+++ head/usr.sbin/ctld/kernel.c Wed Sep 18 08:37:14 2013(r255665)
@@ -79,7 +79,7 @@ kernel_init(void)
int retval, saved_errno;
 
ctl_fd = open(CTL_DEFAULT_DEV, O_RDWR);
-   if (ctl_fd < 0) {
+   if (ctl_fd < 0 && errno == ENOENT) {
saved_errno = errno;
retval = kldload("ctl");
if (retval != -1)

Modified: head/usr.sbin/iscsid/iscsid.c
==
--- head/usr.sbin/iscsid/iscsid.c   Wed Sep 18 06:40:47 2013
(r255664)
+++ head/usr.sbin/iscsid/iscsid.c   Wed Sep 18 08:37:14 2013
(r255665)
@@ -509,7 +509,7 @@ main(int argc, char **argv)
}
 
iscsi_fd = open(ISCSI_PATH, O_RDWR);
-   if (iscsi_fd < 0) {
+   if (iscsi_fd < 0 && errno == ENOENT) {
saved_errno = errno;
retval = kldload("iscsi");
if (retval != -1)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r255634 - head

2013-09-18 Thread Dag-Erling Smørgrav
Bryan Drewery  writes:
> Hm, I know you noticed this, but by making this conditional, it will not
> check if building WITHOUT_UNBOUND, but the passwd and mtree files are
> still using it and will blow up.

Partly true:

 - 'make installworld' will succeed (except, I think, in the NO_ROOT
   case), because it doesn't run mtree.

 - 'make distributeworld' will fail, but that's a bug: it should use
   DB_FROM_SRC.

 - mergemaster will also fail, but in an exceedingly strange manner.

The fact that neither 'make installworld' nor mergemaster create missing
directories is probably a bug.  We should, at the very least, document
the need to run 'make hierarchy' before 'make installworld'.

> All of these conditions should probably be removed until a better
> mechanism for passwd/mtree can be thought up.

Yep, but for now I decided to follow precedent.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r255634 - head

2013-09-18 Thread Dag-Erling Smørgrav
Dag-Erling Smørgrav  writes:
>  - 'make installworld' will succeed (except, I think, in the NO_ROOT
>case), because it doesn't run mtree.
> [...]
> The fact that neither 'make installworld' nor mergemaster create missing
> directories is probably a bug.  We should, at the very least, document
> the need to run 'make hierarchy' before 'make installworld'.

I spoke too soon: 'make installworld' does indeed run mtree.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r254703 - in head: share/man/man9 sys/sys

2013-09-18 Thread Davide Italiano
On Thu, Sep 12, 2013 at 4:08 PM, John Baldwin  wrote:
> Hmm, I think I had envisioned something a bit simpler.  Namely, I would
> change lc_lock/lc_unlock to return a uintptr_t instead of an int, and
> I would then change lc_unlock for an rm lock to return a pointer to the
> current thread's tracker as the 'how' and 0 for a write lock.  Note
> that you have to use the existing tracker to make this work correctly
> for the sleep case where you unlock/lock.
>

Well, your solution is indeed a lot simpler :)
Here's a patch that implements it:
http://people.freebsd.org/~davide/review/rmshared.diff

Some (more or less relevant) observations:
-> I realized that before this change lc_unlock() for rmlocks, i.e.
unlock_rm(), returned 1 for exclusive lock and panic'ed otherwise,
while all the other primitives returned 0 for exclusive lock. Not sure
if this was intentional or just an oversight, but I changed it to
return what other primitive did mostly (0 for excl,
(uintptr_t)rm_tracker for shared).
-> In order to get the rm_priotracker structure for curthread (which I
think is unique as long as we assert curthread is not recursively
acquiring this lock) I just traversed the pc->pc_rm_queue. Maybe it's
not the most efficient solution here, but I think is correct.
-> I think that only lc_unlock() return type need to be changed from
'int' to 'uintptr_t'. lc_lock() type can stay void as it is right now.
But I think you were talking about "how" argument of lc_lock() and not
return type, probably.

> However, if you make my suggested change to make the 'how' a uintptr_t
> that passes the tracker you can actually do this in the callout case:
>
> struct rm_priotracker tracker;
> uintptr_t how;
>
> how = 0;
> if (flags & CALLOUT_SHAREDLOCK)
> how = 1;
> else if (flags & CALLOUT_SHAREDRM)
> how = (uintptr_t)&tracker;
> ...
>
> class->lc_lock(lock, how);
>
> Now, it would be even nicer to make prevent footshooting perhaps by
> checking the lock class directly:
>
> how = 0;
> if (flags & CALLOUT_SHAREDLOCK) {
> if (class == &lock_class_rm || class == 
> &lock_class_rm_sleepable)
> how = (uintptr_t)&tracker;
> else
> how = 1;
> }
>
> --
> John Baldwin

This other patch just puts your code into kern_timeout.c
I also removed the check for lock_class_rm_sleepable as callout_init()
should catch this earlier.
http://people.freebsd.org/~davide/review/callout_sharedrm.diff


Thanks for the guidance on this. I probably commit this in the next
days if you don't have objections.

-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255672 - in head/sys: amd64/linux32 compat/linux conf i386/linux kern modules/linux sys

2013-09-18 Thread Roman Divacky
Author: rdivacky
Date: Wed Sep 18 17:56:04 2013
New Revision: 255672
URL: http://svnweb.freebsd.org/changeset/base/255672

Log:
  Implement epoll support in Linuxulator. This is a tiny wrapper around kqueue
  to implement epoll subset of functionality. The kqueue user data are 32bit
  on i386 which is not enough for epoll user data so this patch overrides
  kqueue fileops to maintain enough space in struct file.
  
  Initial patch developed by me in 2007 and then extended and finished
  by Yuri Victorovich.
  
  Approved by:re (delphij)
  Sponsored by:   Google Summer of Code
  Submitted by:   Yuri Victorovich 
  Tested by:  Yuri Victorovich 

Added:
  head/sys/compat/linux/linux_epoll.c   (contents, props changed)
  head/sys/compat/linux/linux_epoll.h   (contents, props changed)
Modified:
  head/sys/amd64/linux32/linux32_dummy.c
  head/sys/amd64/linux32/syscalls.master
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/conf/files.pc98
  head/sys/i386/linux/linux_dummy.c
  head/sys/i386/linux/syscalls.master
  head/sys/kern/kern_event.c
  head/sys/modules/linux/Makefile
  head/sys/sys/event.h
  head/sys/sys/file.h
  head/sys/sys/syscallsubr.h

Modified: head/sys/amd64/linux32/linux32_dummy.c
==
--- head/sys/amd64/linux32/linux32_dummy.c  Wed Sep 18 17:28:19 2013
(r255671)
+++ head/sys/amd64/linux32/linux32_dummy.c  Wed Sep 18 17:56:04 2013
(r255672)
@@ -70,9 +70,6 @@ DUMMY(pivot_root);
 DUMMY(mincore);
 DUMMY(ptrace);
 DUMMY(lookup_dcookie);
-DUMMY(epoll_create);
-DUMMY(epoll_ctl);
-DUMMY(epoll_wait);
 DUMMY(remap_file_pages);
 DUMMY(timer_create);
 DUMMY(timer_settime);
@@ -129,7 +126,6 @@ DUMMY(timerfd_gettime);
 /* linux 2.6.27: */
 DUMMY(signalfd4);
 DUMMY(eventfd2);
-DUMMY(epoll_create1);
 DUMMY(dup3);
 DUMMY(inotify_init1);
 /* linux 2.6.30: */

Modified: head/sys/amd64/linux32/syscalls.master
==
--- head/sys/amd64/linux32/syscalls.master  Wed Sep 18 17:28:19 2013
(r255671)
+++ head/sys/amd64/linux32/syscalls.master  Wed Sep 18 17:56:04 2013
(r255672)
@@ -430,9 +430,11 @@
 251AUE_NULLUNIMPL
 252AUE_EXITSTD { int linux_exit_group(int error_code); }
 253AUE_NULLSTD { int linux_lookup_dcookie(void); }
-254AUE_NULLSTD { int linux_epoll_create(void); }
-255AUE_NULLSTD { int linux_epoll_ctl(void); }
-256AUE_NULLSTD { int linux_epoll_wait(void); }
+254AUE_NULLSTD { int linux_epoll_create(l_int size); }
+255AUE_NULLSTD { int linux_epoll_ctl(l_int epfd, l_int op, 
l_int fd, \
+   struct linux_epoll_event *event); }
+256AUE_NULLSTD { int linux_epoll_wait(l_int epfd, struct 
linux_epoll_event *events, \
+   l_int maxevents, l_int timeout); }
 257AUE_NULLSTD { int linux_remap_file_pages(void); }
 258AUE_NULLSTD { int linux_set_tid_address(int *tidptr); }
 259AUE_NULLSTD { int linux_timer_create(void); }
@@ -534,7 +536,7 @@
 ; linux 2.6.27:
 327AUE_NULLSTD { int linux_signalfd4(void); }
 328AUE_NULLSTD { int linux_eventfd2(void); }
-329AUE_NULLSTD { int linux_epoll_create1(void); }
+329AUE_NULLSTD { int linux_epoll_create1(l_int flags); }
 330AUE_NULLSTD { int linux_dup3(void); }
 331AUE_NULLSTD { int linux_pipe2(l_int *pipefds, l_int flags); 
}
 332AUE_NULLSTD { int linux_inotify_init1(void); }

Added: head/sys/compat/linux/linux_epoll.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/compat/linux/linux_epoll.c Wed Sep 18 17:56:04 2013
(r255672)
@@ -0,0 +1,554 @@
+/*-
+ * Copyright (c) 2007 Roman Divacky
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CON

svn commit: r255673 - in head/sys: amd64/linux32 i386/linux

2013-09-18 Thread Roman Divacky
Author: rdivacky
Date: Wed Sep 18 17:58:03 2013
New Revision: 255673
URL: http://svnweb.freebsd.org/changeset/base/255673

Log:
  Regen.
  
  Approved by:re (delphij)

Modified:
  head/sys/amd64/linux32/linux32_proto.h
  head/sys/amd64/linux32/linux32_syscall.h
  head/sys/amd64/linux32/linux32_syscalls.c
  head/sys/amd64/linux32/linux32_sysent.c
  head/sys/amd64/linux32/linux32_systrace_args.c
  head/sys/i386/linux/linux_proto.h
  head/sys/i386/linux/linux_syscall.h
  head/sys/i386/linux/linux_syscalls.c
  head/sys/i386/linux/linux_sysent.c
  head/sys/i386/linux/linux_systrace_args.c

Modified: head/sys/amd64/linux32/linux32_proto.h
==
--- head/sys/amd64/linux32/linux32_proto.h  Wed Sep 18 17:56:04 2013
(r255672)
+++ head/sys/amd64/linux32/linux32_proto.h  Wed Sep 18 17:58:03 2013
(r255673)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 236026 
2012-05-25 21:50:48Z ed 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 255672 
2013-09-18 17:56:04Z rdivacky 
  */
 
 #ifndef _LINUX_SYSPROTO_H_
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -765,13 +766,19 @@ struct linux_lookup_dcookie_args {
register_t dummy;
 };
 struct linux_epoll_create_args {
-   register_t dummy;
+   char size_l_[PADL_(l_int)]; l_int size; char size_r_[PADR_(l_int)];
 };
 struct linux_epoll_ctl_args {
-   register_t dummy;
+   char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)];
+   char op_l_[PADL_(l_int)]; l_int op; char op_r_[PADR_(l_int)];
+   char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
+   char event_l_[PADL_(struct linux_epoll_event *)]; struct 
linux_epoll_event * event; char event_r_[PADR_(struct linux_epoll_event *)];
 };
 struct linux_epoll_wait_args {
-   register_t dummy;
+   char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)];
+   char events_l_[PADL_(struct linux_epoll_event *)]; struct 
linux_epoll_event * events; char events_r_[PADR_(struct linux_epoll_event *)];
+   char maxevents_l_[PADL_(l_int)]; l_int maxevents; char 
maxevents_r_[PADR_(l_int)];
+   char timeout_l_[PADL_(l_int)]; l_int timeout; char 
timeout_r_[PADR_(l_int)];
 };
 struct linux_remap_file_pages_args {
register_t dummy;
@@ -1037,7 +1044,7 @@ struct linux_eventfd2_args {
register_t dummy;
 };
 struct linux_epoll_create1_args {
-   register_t dummy;
+   char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
 };
 struct linux_dup3_args {
register_t dummy;

Modified: head/sys/amd64/linux32/linux32_syscall.h
==
--- head/sys/amd64/linux32/linux32_syscall.hWed Sep 18 17:56:04 2013
(r255672)
+++ head/sys/amd64/linux32/linux32_syscall.hWed Sep 18 17:58:03 2013
(r255673)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 236026 
2012-05-25 21:50:48Z ed 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 255672 
2013-09-18 17:56:04Z rdivacky 
  */
 
 #defineLINUX_SYS_exit  1

Modified: head/sys/amd64/linux32/linux32_syscalls.c
==
--- head/sys/amd64/linux32/linux32_syscalls.c   Wed Sep 18 17:56:04 2013
(r255672)
+++ head/sys/amd64/linux32/linux32_syscalls.c   Wed Sep 18 17:58:03 2013
(r255673)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 236026 
2012-05-25 21:50:48Z ed 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 255672 
2013-09-18 17:56:04Z rdivacky 
  */
 
 const char *linux_syscallnames[] = {

Modified: head/sys/amd64/linux32/linux32_sysent.c
==
--- head/sys/amd64/linux32/linux32_sysent.c Wed Sep 18 17:56:04 2013
(r255672)
+++ head/sys/amd64/linux32/linux32_sysent.c Wed Sep 18 17:58:03 2013
(r255673)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 236026 
2012-05-25 21:50:48Z ed 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 255672 
2013-09-18 17:56:04Z rdivacky 
  */
 
 #include "opt_compat.h"
@@ -273,9 +273,9 @@ struct sysent linux_sysent[] = {
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },  
/* 251 =  */
{ AS(linux_exit_group_args), (sy_call_t *)linux_exit_group, AUE_EXIT, 
NULL, 0, 0, 0, SY_THR_STATIC },   /* 252 = linux_exit_group */
 

Re: svn commit: r255672 - in head/sys: amd64/linux32 compat/linux conf i386/linux kern modules/linux sys

2013-09-18 Thread Mateusz Guzik
On Wed, Sep 18, 2013 at 05:56:04PM +, Roman Divacky wrote:
> Author: rdivacky
> Date: Wed Sep 18 17:56:04 2013
> New Revision: 255672
> URL: http://svnweb.freebsd.org/changeset/base/255672
> 
> Log:
>   Implement epoll support in Linuxulator. This is a tiny wrapper around kqueue
>   to implement epoll subset of functionality. The kqueue user data are 32bit
>   on i386 which is not enough for epoll user data so this patch overrides
>   kqueue fileops to maintain enough space in struct file.
>   
>   Initial patch developed by me in 2007 and then extended and finished
>   by Yuri Victorovich.
>   

First of all thank you both for doing this work.

I have some important though (I didn't spend too much on this, so maybe
I missed some stuff or what I write here is incorrect).

In general some lines are longer than 80 characters and simple stile
violations are present ("if (!error)").

> +/* Create a new epoll file descriptor. */
> +
> +static int
> +linux_epoll_create_common(struct thread *td)
> +{
> + struct file *fp;
> + int error;
> +
> + error = kern_kqueue_locked(td, &fp);
> +#if EPOLL_WIDE_USER_DATA
> + if (error == 0) {
> + epoll_init_user_data(td, fp);
> + fdrop(fp, td);
> + }
> +#endif
> + return (error);
> +}

This leaks fd reference if EPOLL_WIDE_USER_DATA is not defined.

> +int
> +linux_epoll_create1(struct thread *td, struct linux_epoll_create1_args *args)
> +{
> + int error;
> +
> + error = linux_epoll_create_common(td);
> +
> + if (!error) {
> + if (args->flags & LINUX_EPOLL_CLOEXEC)
> + 
> td->td_proc->p_fd->fd_ofiles[td->td_retval[0]].fde_flags |= UF_EXCLOSE;

This is very racy for no good reason. This should be passed down to
kqueue and be set on fd creation.

> + if (args->flags & LINUX_EPOLL_NONBLOCK)
> + linux_msg(td, "epoll_create1 doesn't yet support 
> EPOLL_NONBLOCK flag\n");
> + }
> +
> + return (error);
> +}
> +
> +
> +static void
> +epoll_init_user_data(struct thread *td, struct file *epfp)
> +{
> + struct epoll_user_data *udv;
> +
> + /* override file ops to have our close operation */
> + atomic_store_rel_ptr((volatile uintptr_t *)&epfp->f_ops, 
> (uintptr_t)&epollops);
> +
> + /* allocate epoll_user_data initially for up to 16 file descriptor 
> values */
> + udv = malloc(EPOLL_USER_DATA_SIZE(EPOLL_USER_DATA_MARGIN), 
> M_LINUX_EPOLL, M_WAITOK);
> + udv->sz = EPOLL_USER_DATA_MARGIN;
> + EPOLL_USER_DATA_SET(epfp, udv);
> +}

Is not this racy? There is a window when fd is installed with epoll ops,
yet no userdata is allocated.

> +/*ARGSUSED*/
> +static int
> +epoll_close(struct file *epfp, struct thread *td)
> +{
> + /* free user data vector */
> + free(EPOLL_USER_DATA_GET(epfp), M_LINUX_EPOLL);
> + /* over to kqueue parent */
> + return (kqueue_close(epfp, td));
> +}
> +#endif

Unnecessary comments.

> +
> +static struct file*
> +epoll_fget(struct thread *td, int epfd)
> +{
> + struct file *fp;
> + cap_rights_t rights;
> +
> + if (fget(td, epfd, cap_rights_init(&rights, CAP_POLL_EVENT), &fp) != 0)
> + panic("epoll: no file object found for kqueue descriptor");
> +
> + return (fp);
> +}
> +

Callers pass arbitrary fd here (provided by the user), yet this panics
if fd is bad.

>  int
> +kern_kqueue(struct thread *td)
> +{
> + struct file *fp;
> + int error;
> +
> + error = kern_kqueue_locked(td, &fp);
> +

Why is this _locked? Typically such naming is used when some locks are
held around the call.

> + fdrop(fp, td);

If there was an error, fdrop is called even though there is nothing to
fdrop.

> + return (error);
> +}


-- 
Mateusz Guzik 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255675 - in head/sys: amd64/linux32 compat/linux conf i386/linux kern modules/linux sys

2013-09-18 Thread Roman Divacky
Author: rdivacky
Date: Wed Sep 18 18:48:33 2013
New Revision: 255675
URL: http://svnweb.freebsd.org/changeset/base/255675

Log:
  Revert r255672, it has some serious flaws, leaking file references etc.
  
  Approved by:  re (delphij)

Deleted:
  head/sys/compat/linux/linux_epoll.c
  head/sys/compat/linux/linux_epoll.h
Modified:
  head/sys/amd64/linux32/linux32_dummy.c
  head/sys/amd64/linux32/syscalls.master
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/conf/files.pc98
  head/sys/i386/linux/linux_dummy.c
  head/sys/i386/linux/syscalls.master
  head/sys/kern/kern_event.c
  head/sys/modules/linux/Makefile
  head/sys/sys/event.h
  head/sys/sys/file.h
  head/sys/sys/syscallsubr.h

Modified: head/sys/amd64/linux32/linux32_dummy.c
==
--- head/sys/amd64/linux32/linux32_dummy.c  Wed Sep 18 18:02:01 2013
(r255674)
+++ head/sys/amd64/linux32/linux32_dummy.c  Wed Sep 18 18:48:33 2013
(r255675)
@@ -70,6 +70,9 @@ DUMMY(pivot_root);
 DUMMY(mincore);
 DUMMY(ptrace);
 DUMMY(lookup_dcookie);
+DUMMY(epoll_create);
+DUMMY(epoll_ctl);
+DUMMY(epoll_wait);
 DUMMY(remap_file_pages);
 DUMMY(timer_create);
 DUMMY(timer_settime);
@@ -126,6 +129,7 @@ DUMMY(timerfd_gettime);
 /* linux 2.6.27: */
 DUMMY(signalfd4);
 DUMMY(eventfd2);
+DUMMY(epoll_create1);
 DUMMY(dup3);
 DUMMY(inotify_init1);
 /* linux 2.6.30: */

Modified: head/sys/amd64/linux32/syscalls.master
==
--- head/sys/amd64/linux32/syscalls.master  Wed Sep 18 18:02:01 2013
(r255674)
+++ head/sys/amd64/linux32/syscalls.master  Wed Sep 18 18:48:33 2013
(r255675)
@@ -430,11 +430,9 @@
 251AUE_NULLUNIMPL
 252AUE_EXITSTD { int linux_exit_group(int error_code); }
 253AUE_NULLSTD { int linux_lookup_dcookie(void); }
-254AUE_NULLSTD { int linux_epoll_create(l_int size); }
-255AUE_NULLSTD { int linux_epoll_ctl(l_int epfd, l_int op, 
l_int fd, \
-   struct linux_epoll_event *event); }
-256AUE_NULLSTD { int linux_epoll_wait(l_int epfd, struct 
linux_epoll_event *events, \
-   l_int maxevents, l_int timeout); }
+254AUE_NULLSTD { int linux_epoll_create(void); }
+255AUE_NULLSTD { int linux_epoll_ctl(void); }
+256AUE_NULLSTD { int linux_epoll_wait(void); }
 257AUE_NULLSTD { int linux_remap_file_pages(void); }
 258AUE_NULLSTD { int linux_set_tid_address(int *tidptr); }
 259AUE_NULLSTD { int linux_timer_create(void); }
@@ -536,7 +534,7 @@
 ; linux 2.6.27:
 327AUE_NULLSTD { int linux_signalfd4(void); }
 328AUE_NULLSTD { int linux_eventfd2(void); }
-329AUE_NULLSTD { int linux_epoll_create1(l_int flags); }
+329AUE_NULLSTD { int linux_epoll_create1(void); }
 330AUE_NULLSTD { int linux_dup3(void); }
 331AUE_NULLSTD { int linux_pipe2(l_int *pipefds, l_int flags); 
}
 332AUE_NULLSTD { int linux_inotify_init1(void); }

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Wed Sep 18 18:02:01 2013(r255674)
+++ head/sys/conf/files.amd64   Wed Sep 18 18:48:33 2013(r255675)
@@ -467,7 +467,6 @@ amd64/linux32/linux32_support.s optional
dependency  "linux32_assym.h"
 amd64/linux32/linux32_sysent.c optionalcompat_linux32
 amd64/linux32/linux32_sysvec.c optionalcompat_linux32
-compat/linux/linux_epoll.c optionalcompat_linux32
 compat/linux/linux_emul.c  optionalcompat_linux32
 compat/linux/linux_file.c  optionalcompat_linux32
 compat/linux/linux_fork.c  optionalcompat_linux32

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Wed Sep 18 18:02:01 2013(r255674)
+++ head/sys/conf/files.i386Wed Sep 18 18:48:33 2013(r255675)
@@ -80,7 +80,6 @@ hptrr_lib.o   optionalhptrr   
\
 cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S   
optional zfs compile-with "${ZFS_S}"
 compat/linprocfs/linprocfs.c   optional linprocfs
 compat/linsysfs/linsysfs.c optional linsysfs
-compat/linux/linux_epoll.c optional compat_linux
 compat/linux/linux_emul.c  optional compat_linux
 compat/linux/linux_file.c  optional compat_linux
 compat/linux/linux_fork.c  optional compat_linux

Modified: head/sys/conf/files.pc98
==
--- head/sys/conf/files.pc98Wed Sep 18 18:02:01 2013(r255674)
+++ head/sys/conf/

svn commit: r255676 - in head/sys: amd64/linux32 i386/linux

2013-09-18 Thread Roman Divacky
Author: rdivacky
Date: Wed Sep 18 18:49:26 2013
New Revision: 255676
URL: http://svnweb.freebsd.org/changeset/base/255676

Log:
  Regen.
  
  Approved by:  re (delphij)

Modified:
  head/sys/amd64/linux32/linux32_proto.h
  head/sys/amd64/linux32/linux32_syscall.h
  head/sys/amd64/linux32/linux32_syscalls.c
  head/sys/amd64/linux32/linux32_sysent.c
  head/sys/amd64/linux32/linux32_systrace_args.c
  head/sys/i386/linux/linux_proto.h
  head/sys/i386/linux/linux_syscall.h
  head/sys/i386/linux/linux_syscalls.c
  head/sys/i386/linux/linux_sysent.c
  head/sys/i386/linux/linux_systrace_args.c

Modified: head/sys/amd64/linux32/linux32_proto.h
==
--- head/sys/amd64/linux32/linux32_proto.h  Wed Sep 18 18:48:33 2013
(r255675)
+++ head/sys/amd64/linux32/linux32_proto.h  Wed Sep 18 18:49:26 2013
(r255676)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 255672 
2013-09-18 17:56:04Z rdivacky 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 255675 
2013-09-18 18:48:33Z rdivacky 
  */
 
 #ifndef _LINUX_SYSPROTO_H_
@@ -766,19 +766,13 @@ struct linux_lookup_dcookie_args {
register_t dummy;
 };
 struct linux_epoll_create_args {
-   char size_l_[PADL_(l_int)]; l_int size; char size_r_[PADR_(l_int)];
+   register_t dummy;
 };
 struct linux_epoll_ctl_args {
-   char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)];
-   char op_l_[PADL_(l_int)]; l_int op; char op_r_[PADR_(l_int)];
-   char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
-   char event_l_[PADL_(struct linux_epoll_event *)]; struct 
linux_epoll_event * event; char event_r_[PADR_(struct linux_epoll_event *)];
+   register_t dummy;
 };
 struct linux_epoll_wait_args {
-   char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)];
-   char events_l_[PADL_(struct linux_epoll_event *)]; struct 
linux_epoll_event * events; char events_r_[PADR_(struct linux_epoll_event *)];
-   char maxevents_l_[PADL_(l_int)]; l_int maxevents; char 
maxevents_r_[PADR_(l_int)];
-   char timeout_l_[PADL_(l_int)]; l_int timeout; char 
timeout_r_[PADR_(l_int)];
+   register_t dummy;
 };
 struct linux_remap_file_pages_args {
register_t dummy;
@@ -1044,7 +1038,7 @@ struct linux_eventfd2_args {
register_t dummy;
 };
 struct linux_epoll_create1_args {
-   char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
+   register_t dummy;
 };
 struct linux_dup3_args {
register_t dummy;

Modified: head/sys/amd64/linux32/linux32_syscall.h
==
--- head/sys/amd64/linux32/linux32_syscall.hWed Sep 18 18:48:33 2013
(r255675)
+++ head/sys/amd64/linux32/linux32_syscall.hWed Sep 18 18:49:26 2013
(r255676)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 255672 
2013-09-18 17:56:04Z rdivacky 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 255675 
2013-09-18 18:48:33Z rdivacky 
  */
 
 #defineLINUX_SYS_exit  1

Modified: head/sys/amd64/linux32/linux32_syscalls.c
==
--- head/sys/amd64/linux32/linux32_syscalls.c   Wed Sep 18 18:48:33 2013
(r255675)
+++ head/sys/amd64/linux32/linux32_syscalls.c   Wed Sep 18 18:49:26 2013
(r255676)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 255672 
2013-09-18 17:56:04Z rdivacky 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 255675 
2013-09-18 18:48:33Z rdivacky 
  */
 
 const char *linux_syscallnames[] = {

Modified: head/sys/amd64/linux32/linux32_sysent.c
==
--- head/sys/amd64/linux32/linux32_sysent.c Wed Sep 18 18:48:33 2013
(r255675)
+++ head/sys/amd64/linux32/linux32_sysent.c Wed Sep 18 18:49:26 2013
(r255676)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 255672 
2013-09-18 17:56:04Z rdivacky 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 255675 
2013-09-18 18:48:33Z rdivacky 
  */
 
 #include "opt_compat.h"
@@ -273,9 +273,9 @@ struct sysent linux_sysent[] = {
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },  
/* 251 =  */
{ AS(linux_exit_group_args), (sy_call_t *)linux_exit_group, AUE_EXIT, 
NULL, 0, 0, 0, SY_THR_STATIC },   /* 252 = linux_exit_group */
{ 0, (sy_call_t *)linux_lookup_dcookie, AUE_NULL

svn commit: r255677 - in head/sys: amd64/amd64 arm/arm i386/i386 kern sparc64/sparc64

2013-09-18 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Sep 18 19:26:08 2013
New Revision: 255677
URL: http://svnweb.freebsd.org/changeset/base/255677

Log:
  Fix panic in ktrcapfail() when no capability rights are passed.
  While here, correct all consumers to pass NULL instead of 0 as we pass
  capability rights as pointers now, not uint64_t.
  
  Reported by:  Daniel Peyrolon
  Tested by:Daniel Peyrolon
  Approved by:  re (marius)

Modified:
  head/sys/amd64/amd64/sys_machdep.c
  head/sys/arm/arm/sys_machdep.c
  head/sys/i386/i386/sys_machdep.c
  head/sys/kern/kern_ktrace.c
  head/sys/kern/vfs_lookup.c
  head/sys/sparc64/sparc64/sys_machdep.c

Modified: head/sys/amd64/amd64/sys_machdep.c
==
--- head/sys/amd64/amd64/sys_machdep.c  Wed Sep 18 18:49:26 2013
(r255676)
+++ head/sys/amd64/amd64/sys_machdep.c  Wed Sep 18 19:26:08 2013
(r255677)
@@ -209,7 +209,7 @@ sysarch(td, uap)
default:
 #ifdef KTRACE
if (KTRPOINT(td, KTR_CAPFAIL))
-   ktrcapfail(CAPFAIL_SYSCALL, 0, 0);
+   ktrcapfail(CAPFAIL_SYSCALL, NULL, NULL);
 #endif
return (ECAPMODE);
}

Modified: head/sys/arm/arm/sys_machdep.c
==
--- head/sys/arm/arm/sys_machdep.c  Wed Sep 18 18:49:26 2013
(r255676)
+++ head/sys/arm/arm/sys_machdep.c  Wed Sep 18 19:26:08 2013
(r255677)
@@ -138,7 +138,7 @@ sysarch(td, uap)
default:
 #ifdef KTRACE
if (KTRPOINT(td, KTR_CAPFAIL))
-   ktrcapfail(CAPFAIL_SYSCALL, 0, 0);
+   ktrcapfail(CAPFAIL_SYSCALL, NULL, NULL);
 #endif
return (ECAPMODE);
}

Modified: head/sys/i386/i386/sys_machdep.c
==
--- head/sys/i386/i386/sys_machdep.cWed Sep 18 18:49:26 2013
(r255676)
+++ head/sys/i386/i386/sys_machdep.cWed Sep 18 19:26:08 2013
(r255677)
@@ -132,7 +132,7 @@ sysarch(td, uap)
default:
 #ifdef KTRACE
if (KTRPOINT(td, KTR_CAPFAIL))
-   ktrcapfail(CAPFAIL_SYSCALL, 0, 0);
+   ktrcapfail(CAPFAIL_SYSCALL, NULL, NULL);
 #endif
return (ECAPMODE);
}

Modified: head/sys/kern/kern_ktrace.c
==
--- head/sys/kern/kern_ktrace.c Wed Sep 18 18:49:26 2013(r255676)
+++ head/sys/kern/kern_ktrace.c Wed Sep 18 19:26:08 2013(r255677)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include "opt_ktrace.h"
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -791,8 +792,14 @@ ktrcapfail(type, needed, held)
return;
kcf = &req->ktr_data.ktr_cap_fail;
kcf->cap_type = type;
-   kcf->cap_needed = *needed;
-   kcf->cap_held = *held;
+   if (needed != NULL)
+   kcf->cap_needed = *needed;
+   else
+   cap_rights_init(&kcf->cap_needed);
+   if (held != NULL)
+   kcf->cap_held = *held;
+   else
+   cap_rights_init(&kcf->cap_held);
ktr_enqueuerequest(td, req);
ktrace_exit(td);
 }

Modified: head/sys/kern/vfs_lookup.c
==
--- head/sys/kern/vfs_lookup.c  Wed Sep 18 18:49:26 2013(r255676)
+++ head/sys/kern/vfs_lookup.c  Wed Sep 18 19:26:08 2013(r255677)
@@ -178,7 +178,7 @@ namei(struct nameidata *ndp)
if (ndp->ni_dirfd == AT_FDCWD) {
 #ifdef KTRACE
if (KTRPOINT(td, KTR_CAPFAIL))
-   ktrcapfail(CAPFAIL_LOOKUP, 0, 0);
+   ktrcapfail(CAPFAIL_LOOKUP, NULL, NULL);
 #endif
error = ECAPMODE;
}
@@ -284,7 +284,7 @@ namei(struct nameidata *ndp)
if (ndp->ni_strictrelative != 0) {
 #ifdef KTRACE
if (KTRPOINT(curthread, KTR_CAPFAIL))
-   ktrcapfail(CAPFAIL_LOOKUP, 0, 0);
+   ktrcapfail(CAPFAIL_LOOKUP, NULL, NULL);
 #endif
return (ENOTCAPABLE);
}
@@ -640,7 +640,7 @@ dirloop:
if (ndp->ni_strictrelative != 0) {
 #ifdef KTRACE
if (KTRPOINT(curthread, KTR_CAPFAIL))
-   ktrcapfail(CAPFAIL_LOOKUP, 0, 0);
+   ktrcapfail(CAPFAIL_LOOKUP, NULL, NULL);
 #endif
error = ENOTCAPABLE;
goto bad;

Modified: head/sys/sparc64/sparc64/sys_machdep.c

svn commit: r255678 - in head: sys/dev/iscsi usr.sbin/ctld usr.sbin/iscsid

2013-09-18 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Sep 18 21:15:21 2013
New Revision: 255678
URL: http://svnweb.freebsd.org/changeset/base/255678

Log:
  Fix several problems in the new iSCSI stack; this includes interoperability
  fix for LIO (Linux target), removing possibility for the target to avoid 
mutual
  CHAP by choosing to skip authentication altogether, and fixing truncated error
  messages in iscsictl(8) output.  This also fixes several of the problems found
  with Coverity.
  
  Note that this change requires world rebuild.
  
  Coverity CID: 1088038, 1087998, 1087990, 1088004, 1088044, 1088041, 1088040
  Approved by:  re (blanket)
  Sponsored by: FreeBSD Foundation

Modified:
  head/sys/dev/iscsi/iscsi.c
  head/sys/dev/iscsi/iscsi_ioctl.h
  head/usr.sbin/ctld/ctld.c
  head/usr.sbin/ctld/kernel.c
  head/usr.sbin/iscsid/iscsid.c
  head/usr.sbin/iscsid/login.c

Modified: head/sys/dev/iscsi/iscsi.c
==
--- head/sys/dev/iscsi/iscsi.c  Wed Sep 18 19:26:08 2013(r255677)
+++ head/sys/dev/iscsi/iscsi.c  Wed Sep 18 21:15:21 2013(r255678)
@@ -1513,8 +1513,13 @@ iscsi_ioctl_session_add(struct iscsi_sof
memcpy(&is->is_conf, &isa->isa_conf, sizeof(is->is_conf));
 
if (is->is_conf.isc_initiator[0] == '\0' ||
-   is->is_conf.isc_target == '\0' ||
-   is->is_conf.isc_target_addr == '\0') {
+   is->is_conf.isc_target_addr[0] == '\0') {
+   free(is, M_ISCSI);
+   return (EINVAL);
+   }
+
+   if ((is->is_conf.isc_discovery != 0 && is->is_conf.isc_target[0] != 0) 
||
+   (is->is_conf.isc_discovery == 0 && is->is_conf.isc_target[0] == 0)) 
{
free(is, M_ISCSI);
return (EINVAL);
}
@@ -1525,11 +1530,22 @@ iscsi_ioctl_session_add(struct iscsi_sof
 * Prevent duplicates.
 */
TAILQ_FOREACH(is2, &sc->sc_sessions, is_next) {
-   if (strcmp(is2->is_conf.isc_target,
-   is->is_conf.isc_target) == 0) {
-   sx_xunlock(&sc->sc_lock);
-   return (EBUSY);
-   }
+   if (!!is->is_conf.isc_discovery !=
+   !!is2->is_conf.isc_discovery)
+   continue;
+
+   if (strcmp(is->is_conf.isc_target_addr,
+   is2->is_conf.isc_target_addr) != 0)
+   continue;
+
+   if (is->is_conf.isc_discovery == 0 &&
+   strcmp(is->is_conf.isc_target,
+   is2->is_conf.isc_target) != 0)
+   continue;
+
+   sx_xunlock(&sc->sc_lock);
+   free(is, M_ISCSI);
+   return (EBUSY);
}
 
is->is_conn = icl_conn_new();
@@ -1936,9 +1952,9 @@ iscsi_action(struct cam_sim *sim, union 
cpi->max_lun = 255;
//cpi->initiator_id = 0; /* XXX */
cpi->initiator_id = 64; /* XXX */
-   strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-   strncpy(cpi->hba_vid, "iSCSI", HBA_IDLEN);
-   strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+   strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+   strlcpy(cpi->hba_vid, "iSCSI", HBA_IDLEN);
+   strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
cpi->unit_number = cam_sim_unit(sim);
cpi->bus_id = cam_sim_bus(sim);
cpi->base_transfer_speed = 15; /* XXX */

Modified: head/sys/dev/iscsi/iscsi_ioctl.h
==
--- head/sys/dev/iscsi/iscsi_ioctl.hWed Sep 18 19:26:08 2013
(r255677)
+++ head/sys/dev/iscsi/iscsi_ioctl.hWed Sep 18 21:15:21 2013
(r255678)
@@ -43,7 +43,7 @@
 #defineISCSI_ADDR_LEN  47  /* INET6_ADDRSTRLEN + '\0' */
 #defineISCSI_ALIAS_LEN 256 /* XXX: Where did it come from? 
*/
 #defineISCSI_SECRET_LEN17  /* 16 + '\0' */
-#defineISCSI_REASON_LEN32
+#defineISCSI_REASON_LEN64
 
 #defineISCSI_DIGEST_NONE   0
 #defineISCSI_DIGEST_CRC32C 1

Modified: head/usr.sbin/ctld/ctld.c
==
--- head/usr.sbin/ctld/ctld.c   Wed Sep 18 19:26:08 2013(r255677)
+++ head/usr.sbin/ctld/ctld.c   Wed Sep 18 21:15:21 2013(r255678)
@@ -348,12 +348,10 @@ portal_group_new(struct conf *conf, cons
 {
struct portal_group *pg;
 
-   if (name != NULL) {
-   pg = portal_group_find(conf, name);
-   if (pg != NULL) {
-   log_warnx("duplicated portal-group \"%s\"", name);
-   return (NULL);
-   }
+   pg = portal_group_find(conf, name);
+   if (pg != NULL) {
+   log_warnx("duplicated portal-group \"%s\"", name);
+

svn commit: r255682 - head/contrib/llvm/tools/lldb/docs

2013-09-18 Thread Ed Maste
Author: emaste
Date: Thu Sep 19 00:32:07 2013
New Revision: 255682
URL: http://svnweb.freebsd.org/changeset/base/255682

Log:
  Merge lldb man page from r188801 to contrib/llvm/tools/lldb/docs/
  
  Approved by:  re (gjb)

Added:
  head/contrib/llvm/tools/lldb/docs/
 - copied from r255671, vendor/lldb/dist/docs/
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255685 - head/sys/dev/hyperv/stordisengage

2013-09-18 Thread Peter Grehan
Author: grehan
Date: Thu Sep 19 02:02:15 2013
New Revision: 255685
URL: http://svnweb.freebsd.org/changeset/base/255685

Log:
  Fix missing SVN properties.
  
  Approved by:  re@ (hrs)

Modified:
Directory Properties:
  head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c   (props changed)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255686 - head/sys/dev/hyperv/stordisengage

2013-09-18 Thread Peter Grehan
Author: grehan
Date: Thu Sep 19 02:34:52 2013
New Revision: 255686
URL: http://svnweb.freebsd.org/changeset/base/255686

Log:
  Reorder the hypervisor presence test to avoid claiming ATA disks
  on non hyperv systems.
  
  Reviewed by:  neel, abgupta at microsoft dot com
  Approved by:  re@ (hrs)

Modified:
  head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c

Modified: head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c
==
--- head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.cThu Sep 19 
02:02:15 2013(r255685)
+++ head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.cThu Sep 19 
02:34:52 2013(r255686)
@@ -92,8 +92,17 @@ static int hv_check_for_hyper_v(void);
 static int
 hv_ata_pci_probe(device_t dev)
 {
-   int ata_disk_enable = 0;
-   if(bootverbose)
+   int ata_disk_enable;
+
+   ata_disk_enable = 0;
+
+   /*
+* Don't probe if not running in a Hyper-V environment
+*/
+   if (!hv_check_for_hyper_v())
+   return (ENXIO);
+
+   if (bootverbose)
device_printf(dev,
"hv_ata_pci_probe dev_class/subslcass = %d, %d\n",
pci_get_class(dev), pci_get_subclass(dev));
@@ -116,18 +125,15 @@ hv_ata_pci_probe(device_t dev)
 * ATA driver, the environment variable
 * hw_ata.disk_enable must be explicitly set to 1.
 */
-   if (hv_check_for_hyper_v()) {
-   if (getenv_int("hw.ata.disk_enable", &ata_disk_enable)) {
-   if(bootverbose)
-   device_printf(dev,
-   "hw.ata.disk_enable flag is disabling Hyper-V"
-   " ATA driver support\n");
+   if (getenv_int("hw.ata.disk_enable", &ata_disk_enable)) {
+   if(bootverbose)
+   device_printf(dev,
+   "hw.ata.disk_enable flag is disabling Hyper-V"
+   " ATA driver support\n");
return (ENXIO);
-   }
-
}
 
-   if(bootverbose)
+   if (bootverbose)
device_printf(dev, "Hyper-V ATA storage driver enabled.\n");
 
return (BUS_PROBE_VENDOR);
@@ -136,13 +142,15 @@ hv_ata_pci_probe(device_t dev)
 static int
 hv_ata_pci_attach(device_t dev)
 {
-   return 0;
+
+   return (0);
 }
 
 static int
 hv_ata_pci_detach(device_t dev)
 {
-   return 0;
+
+   return (0);
 }
 
 /**
@@ -153,42 +161,44 @@ static int
 hv_check_for_hyper_v(void)
 {
u_int regs[4];
-   int hyper_v_detected = 0;
+   int hyper_v_detected;
+
+   hyper_v_detected = 0;
do_cpuid(1, regs);
if (regs[2] & 0x8000) {
-   /* if(a hypervisor is detected) */
-   /* make sure this really is Hyper-V */
-   /* we look at the CPUID info */
+   /*
+* if(a hypervisor is detected)
+*  make sure this really is Hyper-V
+*/
do_cpuid(HV_X64_MSR_GUEST_OS_ID, regs);
hyper_v_detected =
regs[0] >= HV_X64_CPUID_MIN &&
regs[0] <= HV_X64_CPUID_MAX &&
!memcmp("Microsoft Hv", ®s[1], 12);
}
+
return (hyper_v_detected);
 }
 
 static device_method_t hv_ata_pci_methods[] = {
-/* device interface */
-DEVMETHOD(device_probe,hv_ata_pci_probe),
-DEVMETHOD(device_attach,   hv_ata_pci_attach),
-DEVMETHOD(device_detach,   hv_ata_pci_detach),
-DEVMETHOD(device_shutdown, bus_generic_shutdown),
+   /* device interface */
+   DEVMETHOD(device_probe, hv_ata_pci_probe),
+   DEVMETHOD(device_attach,hv_ata_pci_attach),
+   DEVMETHOD(device_detach,hv_ata_pci_detach),
+   DEVMETHOD(device_shutdown,  bus_generic_shutdown),
 
-DEVMETHOD_END
+   DEVMETHOD_END
 };
 
 devclass_t hv_ata_pci_devclass;
 
 static driver_t hv_ata_pci_disengage_driver = {
-"pciata-disable",
-hv_ata_pci_methods,
-sizeof(struct ata_pci_controller),
+   "pciata-disable",
+   hv_ata_pci_methods,
+   sizeof(struct ata_pci_controller),
 };
 
 DRIVER_MODULE(atapci_dis, pci, hv_ata_pci_disengage_driver,
hv_ata_pci_devclass, NULL, NULL);
 MODULE_VERSION(atapci_dis, 1);
 MODULE_DEPEND(atapci_dis, ata, 1, 1, 1);
-
-
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255688 - head/usr.sbin/bhyve

2013-09-18 Thread Peter Grehan
Author: grehan
Date: Thu Sep 19 04:20:18 2013
New Revision: 255688
URL: http://svnweb.freebsd.org/changeset/base/255688

Log:
  Use correct offset for the high byte of high memory written to
  RTC NVRAM.
  
  Submitted by: Bela Lubkin   bela dot lubkin at tidalscale dot com
  Approved by:  re@ (blanket)

Modified:
  head/usr.sbin/bhyve/rtc.c

Modified: head/usr.sbin/bhyve/rtc.c
==
--- head/usr.sbin/bhyve/rtc.c   Thu Sep 19 02:41:00 2013(r255687)
+++ head/usr.sbin/bhyve/rtc.c   Thu Sep 19 04:20:18 2013(r255688)
@@ -322,7 +322,7 @@ rtc_init(struct vmctx *ctx)
himem /= m_64KB;
rtc_nvram[nvoff(RTC_HMEM_LSB)] = himem;
rtc_nvram[nvoff(RTC_HMEM_SB)]  = himem >> 8;
-   rtc_nvram[nvoff(RTC_NVRAM_START)] = himem >> 16;
+   rtc_nvram[nvoff(RTC_HMEM_MSB)] = himem >> 16;
}
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255689 - head/usr.sbin/bhyve

2013-09-18 Thread Peter Grehan
Author: grehan
Date: Thu Sep 19 04:29:03 2013
New Revision: 255689
URL: http://svnweb.freebsd.org/changeset/base/255689

Log:
  Allow the alarm hours/mins/seconds registers to be read/written,
  though without any action. This avoids a hypervisor exit when
  o/s's access these regs (Linux).
  
  Reviewed by:  neel
  Approved by:  re@ (blanket)

Modified:
  head/usr.sbin/bhyve/rtc.c

Modified: head/usr.sbin/bhyve/rtc.c
==
--- head/usr.sbin/bhyve/rtc.c   Thu Sep 19 04:20:18 2013(r255688)
+++ head/usr.sbin/bhyve/rtc.c   Thu Sep 19 04:29:03 2013(r255689)
@@ -46,8 +46,11 @@ __FBSDID("$FreeBSD$");
 #defineIO_RTC  0x70
 
 #define RTC_SEC0x00/* seconds */
+#defineRTC_SEC_ALARM   0x01
 #defineRTC_MIN 0x02
+#defineRTC_MIN_ALARM   0x03
 #defineRTC_HRS 0x04
+#defineRTC_HRS_ALARM   0x05
 #defineRTC_WDAY0x06
 #defineRTC_DAY 0x07
 #defineRTC_MONTH   0x08
@@ -94,6 +97,12 @@ static uint8_t rtc_nvram[RTC_NVRAM_SZ];
 /* XXX initialize these to default values as they would be from BIOS */
 static uint8_t status_a, status_b;
 
+static struct {
+   uint8_t  hours;
+   uint8_t  mins;
+   uint8_t  secs;
+} rtc_alarm;
+
 static u_char const bin2bcd_data[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
@@ -148,8 +157,11 @@ rtc_addr_handler(struct vmctx *ctx, int 
 
switch (*eax & 0x7f) {
case RTC_SEC:
+   case RTC_SEC_ALARM:
case RTC_MIN:
+   case RTC_MIN_ALARM:
case RTC_HRS:
+   case RTC_HRS_ALARM:
case RTC_WDAY:
case RTC_DAY:
case RTC_MONTH:
@@ -199,6 +211,15 @@ rtc_data_handler(struct vmctx *ctx, int 
 
if (in) {
switch (addr) {
+   case RTC_SEC_ALARM:
+   *eax = rtc_alarm.secs;
+   break;
+   case RTC_MIN_ALARM:
+   *eax = rtc_alarm.mins;
+   break;
+   case RTC_HRS_ALARM:
+   *eax = rtc_alarm.hours;
+   break;
case RTC_SEC:
*eax = rtcout(tm.tm_sec);
return (0);
@@ -266,6 +287,15 @@ rtc_data_handler(struct vmctx *ctx, int 
case RTC_STATUSD:
/* ignore write */
break;
+   case RTC_SEC_ALARM:
+   rtc_alarm.secs = *eax;
+   break;
+   case RTC_MIN_ALARM:
+   rtc_alarm.mins = *eax;
+   break;
+   case RTC_HRS_ALARM:
+   rtc_alarm.hours = *eax;
+   break;
case RTC_SEC:
case RTC_MIN:
case RTC_HRS:
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255690 - head/usr.sbin/bhyve

2013-09-18 Thread Peter Grehan
Author: grehan
Date: Thu Sep 19 04:48:26 2013
New Revision: 255690
URL: http://svnweb.freebsd.org/changeset/base/255690

Log:
  Add simplistic periodic timer support to mevent using kqueue's
  timer support. This should be enough for the emulation of
  h/w periodic timers (and no more) e.g. some of the 8254's
  more esoteric modes that happen to be used by non-FreeBSD o/s's.
  
  Approved by:  re@ (blanket)

Modified:
  head/usr.sbin/bhyve/mevent.c
  head/usr.sbin/bhyve/mevent.h
  head/usr.sbin/bhyve/mevent_test.c

Modified: head/usr.sbin/bhyve/mevent.c
==
--- head/usr.sbin/bhyve/mevent.cThu Sep 19 04:29:03 2013
(r255689)
+++ head/usr.sbin/bhyve/mevent.cThu Sep 19 04:48:26 2013
(r255690)
@@ -59,12 +59,15 @@ __FBSDID("$FreeBSD$");
 extern char *vmname;
 
 static pthread_t mevent_tid;
+static int mevent_timid = 43;
 static int mevent_pipefd[2];
 static pthread_mutex_t mevent_lmutex = PTHREAD_MUTEX_INITIALIZER;
 
 struct mevent {
void(*me_func)(int, enum ev_type, void *);
+#define me_msecs me_fd
int me_fd;
+   int me_timid;
enum ev_type me_type;
void*me_param;
int me_cq;
@@ -129,6 +132,9 @@ mevent_kq_filter(struct mevent *mevp)
if (mevp->me_type == EVF_WRITE)
retval = EVFILT_WRITE;
 
+   if (mevp->me_type == EVF_TIMER)
+   retval = EVFILT_TIMER;
+
return (retval);
 }
 
@@ -140,6 +146,8 @@ mevent_kq_flags(struct mevent *mevp)
switch (mevp->me_state) {
case MEV_ENABLE:
ret = EV_ADD;
+   if (mevp->me_type == EVF_TIMER)
+   ret |= EV_ENABLE;
break;
case MEV_DISABLE:
ret = EV_DISABLE;
@@ -177,11 +185,16 @@ mevent_build(int mfd, struct kevent *kev
 */
close(mevp->me_fd);
} else {
-   kev[i].ident = mevp->me_fd;
+   if (mevp->me_type == EVF_TIMER) {
+   kev[i].ident = mevp->me_timid;
+   kev[i].data = mevp->me_msecs;
+   } else {
+   kev[i].ident = mevp->me_fd;
+   kev[i].data = 0;
+   }
kev[i].filter = mevent_kq_filter(mevp);
kev[i].flags = mevent_kq_flags(mevp);
kev[i].fflags = mevent_kq_fflags(mevp);
-   kev[i].data = 0;
kev[i].udata = mevp;
i++;
}
@@ -219,12 +232,12 @@ mevent_handle(struct kevent *kev, int nu
 }
 
 struct mevent *
-mevent_add(int fd, enum ev_type type,
+mevent_add(int tfd, enum ev_type type,
   void (*func)(int, enum ev_type, void *), void *param)
 {
struct mevent *lp, *mevp;
 
-   if (fd < 0 || func == NULL) {
+   if (tfd < 0 || func == NULL) {
return (NULL);
}
 
@@ -236,13 +249,15 @@ mevent_add(int fd, enum ev_type type,
 * Verify that the fd/type tuple is not present in any list
 */
LIST_FOREACH(lp, &global_head, me_list) {
-   if (lp->me_fd == fd && lp->me_type == type) {
+   if (type != EVF_TIMER && lp->me_fd == tfd &&
+   lp->me_type == type) {
goto exit;
}
}
 
LIST_FOREACH(lp, &change_head, me_list) {
-   if (lp->me_fd == fd && lp->me_type == type) {
+   if (type != EVF_TIMER && lp->me_fd == tfd &&
+   lp->me_type == type) {
goto exit;
}
}
@@ -256,7 +271,11 @@ mevent_add(int fd, enum ev_type type,
}
 
memset(mevp, 0, sizeof(struct mevent));
-   mevp->me_fd = fd;
+   if (type == EVF_TIMER) {
+   mevp->me_msecs = tfd;
+   mevp->me_timid = mevent_timid++;
+   } else
+   mevp->me_fd = tfd;
mevp->me_type = type;
mevp->me_func = func;
mevp->me_param = param;

Modified: head/usr.sbin/bhyve/mevent.h
==
--- head/usr.sbin/bhyve/mevent.hThu Sep 19 04:29:03 2013
(r255689)
+++ head/usr.sbin/bhyve/mevent.hThu Sep 19 04:48:26 2013
(r255690)
@@ -31,7 +31,8 @@
 
 enum ev_type {
EVF_READ,
-   EVF_WRITE
+   EVF_WRITE,
+   EVF_TIMER
 };
 
 struct mevent;

Modified: head/usr.sbin/bhyve/mevent_test.c
==
--- head/usr.sbin/bhyve/mevent_test.c   Thu Sep 19 04:29:03 2013
(r255689)
+++ head/usr.sbin/bhyve/mevent_test.c   Thu Sep 19 04:48:26 2013
(r255690)
@@ -34,12 +34,16 @@
  */
 
 #include 
+#include 
+#include 
 #include 
 #inclu

svn commit: r255691 - head/usr.sbin/bhyve

2013-09-18 Thread Peter Grehan
Author: grehan
Date: Thu Sep 19 04:59:44 2013
New Revision: 255691
URL: http://svnweb.freebsd.org/changeset/base/255691

Log:
  Implement support for the interrupt-on-terminal-count and
  s/w-strobe timer modes. These are commonly used by non-FreeBSD
  o/s's.
  
  Approved by:  re@ (blanket)

Modified:
  head/usr.sbin/bhyve/pit_8254.c

Modified: head/usr.sbin/bhyve/pit_8254.c
==
--- head/usr.sbin/bhyve/pit_8254.c  Thu Sep 19 04:48:26 2013
(r255690)
+++ head/usr.sbin/bhyve/pit_8254.c  Thu Sep 19 04:59:44 2013
(r255691)
@@ -29,15 +29,23 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
 #include 
+#include 
 
 #include 
 
-#include 
 #include 
+#include 
+#include 
+#include 
+
+#include 
 
 #include "bhyverun.h"
 #include "inout.h"
+#include "ioapic.h"
+#include "mevent.h"
 #include "pit_8254.h"
 
 #defineTIMER_SEL_MASK  0xc0
@@ -51,14 +59,19 @@ __FBSDID("$FreeBSD$");
 static const int nsecs_per_tick = 10 / PIT_8254_FREQ;
 
 struct counter {
+   struct vmctx*ctx;
+   struct mevent   *tevp;  
struct timeval  tv; /* uptime when counter was loaded */
+   int mode;
uint16_tinitial;/* initial counter value */
uint8_t cr[2];
uint8_t ol[2];
int crbyte;
int olbyte;
+   int frbyte;
 };
 
+
 static void
 timevalfix(struct timeval *t1)
 {
@@ -82,16 +95,55 @@ timevalsub(struct timeval *t1, const str
timevalfix(t1);
 }
 
+static uint64_t pit_mev_count;
+
 static void
-latch(struct counter *c)
+pit_mevent_cb(int fd, enum ev_type type, void *param)
+{
+   struct counter *c;
+
+   c = param;
+
+   pit_mev_count++;
+
+   ioapic_assert_pin(c->ctx, 0);
+   ioapic_deassert_pin(c->ctx, 0);
+
+   /*
+* Delete the timer for one-shots
+*/
+   if (c->mode != TIMER_RATEGEN) {
+   mevent_delete(c->tevp);
+   c->tevp = NULL;
+   }
+}
+
+static void
+pit_timer_start(struct vmctx *ctx, struct counter *c)
+{
+   int msecs;
+
+   if (c->initial != 0) {
+   msecs = c->initial * nsecs_per_tick / 100;
+   if (msecs == 0)
+   msecs = 1;
+
+   if (c->tevp == NULL)
+   c->tevp = mevent_add(msecs, EVF_TIMER, pit_mevent_cb,
+   c);
+   }
+}
+
+static uint16_t
+pit_update_counter(struct counter *c, int latch)
 {
struct timeval tv2;
uint16_t lval;
uint64_t delta_nsecs, delta_ticks;
 
/* cannot latch a new value until the old one has been consumed */
-   if (c->olbyte != 0)
-   return;
+   if (latch && c->olbyte != 0)
+   return (0);
 
if (c->initial == 0 || c->initial == 1) {
/*
@@ -114,9 +166,14 @@ latch(struct counter *c)
delta_ticks = delta_nsecs / nsecs_per_tick;
 
lval = c->initial - delta_ticks % c->initial;
-   c->olbyte = 2;
-   c->ol[1] = lval;/* LSB */
-   c->ol[0] = lval >> 8;   /* MSB */
+
+   if (latch) {
+   c->olbyte = 2;
+   c->ol[1] = lval;/* LSB */
+   c->ol[0] = lval >> 8;   /* MSB */
+   }
+
+   return (lval);
 }
 
 static int
@@ -150,13 +207,18 @@ pit_8254_handler(struct vmctx *ctx, int 
 * Counter mode is not affected when issuing a
 * latch command.
 */
-   if (mode != TIMER_RATEGEN && mode != TIMER_SQWAVE)
+   if (mode != TIMER_INTTC &&
+   mode != TIMER_RATEGEN &&
+   mode != TIMER_SQWAVE &&
+   mode != TIMER_SWSTROBE)
return (-1);
}

c = &counter[sel >> 6];
+   c->ctx = ctx;
+   c->mode = mode;
if (rw == TIMER_LATCH)
-   latch(c);
+   pit_update_counter(c, 1);
else
c->olbyte = 0;  /* reset latch after reprogramming */

@@ -169,20 +231,32 @@ pit_8254_handler(struct vmctx *ctx, int 
 
if (in) {
/*
-* XXX
 * The spec says that once the output latch is completely
-* read it should revert to "following" the counter. We don't
-* do this because it is hard and any reasonable OS should
-* always latch the counter before trying to read it.
+* read it should revert to "following" the counter. Use
+* the free running counter for this case (i.e. Linux
+* TSC calibration). Assuming the access mode is 16-bit,
+ 

svn commit: r255692 - head/sys/amd64/conf

2013-09-18 Thread Peter Grehan
Author: grehan
Date: Thu Sep 19 05:07:51 2013
New Revision: 255692
URL: http://svnweb.freebsd.org/changeset/base/255692

Log:
  Reconnect the hyperv drivers back into GENERIC now that the
  disengage driver issue has been resolved.
  
  Approved by:  re@ (gjb)

Modified:
  head/sys/amd64/conf/GENERIC

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Thu Sep 19 04:59:44 2013(r255691)
+++ head/sys/amd64/conf/GENERIC Thu Sep 19 05:07:51 2013(r255692)
@@ -341,5 +341,8 @@ device  virtio_blk  # VirtIO Block device
 device virtio_scsi # VirtIO SCSI device
 device virtio_balloon  # VirtIO Memory Balloon device
 
+# HyperV drivers
+device hyperv  # HyperV drivers 
+
 # VMware support
 device vmx # VMware VMXNET3 Ethernet
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255695 - head/lib/libc/net

2013-09-18 Thread Michael Tuexen
Author: tuexen
Date: Thu Sep 19 06:19:24 2013
New Revision: 255695
URL: http://svnweb.freebsd.org/changeset/base/255695

Log:
  Remove an unused variable and fix a memory leak in sctp_connectx().
  
  Approved by:  re (gjb)
  MFC after:3 days

Modified:
  head/lib/libc/net/sctp_sys_calls.c

Modified: head/lib/libc/net/sctp_sys_calls.c
==
--- head/lib/libc/net/sctp_sys_calls.c  Thu Sep 19 05:43:23 2013
(r255694)
+++ head/lib/libc/net/sctp_sys_calls.c  Thu Sep 19 06:19:24 2013
(r255695)
@@ -101,10 +101,10 @@ sctp_connectx(int sd, const struct socka
 sctp_assoc_t * id)
 {
char *buf;
-   int i, ret, cnt, *aa;
+   int i, ret, *aa;
char *cpto;
const struct sockaddr *at;
-   size_t len = sizeof(int);
+   size_t len;
 
/* validate the address count and list */
if ((addrs == NULL) || (addrcnt <= 0)) {
@@ -115,8 +115,8 @@ sctp_connectx(int sd, const struct socka
errno = E2BIG;
return (-1);
}
+   len = sizeof(int);
at = addrs;
-   cnt = 0;
cpto = buf + sizeof(int);
/* validate all the addresses and get the size */
for (i = 0; i < addrcnt; i++) {
@@ -161,6 +161,7 @@ sctp_connectx(int sd, const struct socka
if ((ret == 0) && (id != NULL)) {
*id = *(sctp_assoc_t *) buf;
}
+   free(buf);
return (ret);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255696 - head/usr.bin/svn/lib/libapr

2013-09-18 Thread Dimitry Andric
Author: dim
Date: Thu Sep 19 06:31:03 2013
New Revision: 255696
URL: http://svnweb.freebsd.org/changeset/base/255696

Log:
  Make svnlite (actually libapr) work correctly on big-endian arches.
  Otherwise, you would get errors similar to:
  
  $ svn co svn://svn.freebsd.org/base/head test
  Atest/lib
  Atest/lib/libutil
  svn: E200014: Checksum mismatch for
  '/home/dim/test/lib/libutil/kinfo_getproc.3':
 expected:  0882097a545210d88edff8f63b328602
   actual:  b378eb08a0f4d4c97c513c4b17207f59
  
  Approved by:  re (gjb, marius)

Modified:
  head/usr.bin/svn/lib/libapr/apr.h

Modified: head/usr.bin/svn/lib/libapr/apr.h
==
--- head/usr.bin/svn/lib/libapr/apr.h   Thu Sep 19 06:19:24 2013
(r255695)
+++ head/usr.bin/svn/lib/libapr/apr.h   Thu Sep 19 06:31:03 2013
(r255696)
@@ -373,7 +373,13 @@ typedef  apr_uint32_tapr_uin
 #endif
 
 /* Are we big endian? */
+#if _BYTE_ORDER == _LITTLE_ENDIAN
 #define APR_IS_BIGENDIAN   0
+#elif _BYTE_ORDER == _BIG_ENDIAN
+#define APR_IS_BIGENDIAN   1
+#else
+#error Unknown byte order.
+#endif
 
 /* Mechanisms to properly type numeric literals */
 #define APR_INT64_C(val) INT64_C(val)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"