From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/480 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: minor fixes Date: Sun, 25 Sep 2011 15:47:25 +0200 Message-ID: <20110925134725.GA24939@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="NzB8fVQJ5HfG6fxh" X-Trace: dough.gmane.org 1316958464 24162 80.91.229.12 (25 Sep 2011 13:47:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 25 Sep 2011 13:47:44 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-481-gllmg-musl=m.gmane.org@lists.openwall.com Sun Sep 25 15:47:40 2011 Return-path: Envelope-to: gllmg-musl@lo.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by lo.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1R7p3T-0003y8-Hg for gllmg-musl@lo.gmane.org; Sun, 25 Sep 2011 15:47:39 +0200 Original-Received: (qmail 20427 invoked by uid 550); 25 Sep 2011 13:47:38 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 20419 invoked from network); 25 Sep 2011 13:47:37 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Xref: news.gmane.org gmane.linux.lib.musl.general:480 Archived-At: --NzB8fVQJ5HfG6fxh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline attached a few lines of small changes * if the time.h fixme is because of the sigevent struct declaration, then it can go away as posix says "The tag sigevent shall be declared as naming an incomplete structure type, the contents of which are described in the header." actually there is a much stronger statement as well: "Inclusion of the header may make visible all symbols from the header." * __syscall_ret: declaration should be consistent with the function definition (argument is signed long) i think one of the (unsigned long) casts is unnecessary due to conversion rules but it probably makes things more clear * sbrk: changed prototype here as well to be consistent with the standard actually semantically ptrdiff_t is better (sbrk does p+arg, not p=arg) but the standard uses intptr_t this change should not hurt as sbrk should not be used anyway.. (i guess there is no architecture where intptr_t != ptrdiff_t) * __asctime: use new crash (i assume the *0=0 crash is deprecated now) * setpgid: pid_t return type is wrong (return value is an error code) --NzB8fVQJ5HfG6fxh Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="minor.diff" diff --git a/include/time.h b/include/time.h index 5b1ea91..557c8f4 100644 --- a/include/time.h +++ b/include/time.h @@ -85,7 +85,6 @@ int clock_settime (clockid_t, const struct timespec *); int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec *); int clock_getcpuclockid (pid_t, clockid_t *); -/* FIXME..?? */ struct sigevent; int timer_create (clockid_t, struct sigevent *, timer_t *); int timer_delete (timer_t); diff --git a/src/internal/syscall_ret.c b/src/internal/syscall_ret.c index 4f159e0..4949a9c 100644 --- a/src/internal/syscall_ret.c +++ b/src/internal/syscall_ret.c @@ -1,11 +1,11 @@ #include #include -long __syscall_ret(unsigned long r) +long __syscall_ret(long r) { - if (r >= (unsigned long)-1 - 4096) { - errno = -(long)r; + if ((unsigned long)r >= (unsigned long)-1 - 4096) { + errno = -r; return -1; } - return (long)r; + return r; } diff --git a/src/linux/sbrk.c b/src/linux/sbrk.c index 5fab74b..3643765 100644 --- a/src/linux/sbrk.c +++ b/src/linux/sbrk.c @@ -1,7 +1,7 @@ -#include +#include #include "syscall.h" -void *sbrk(ptrdiff_t inc) +void *sbrk(intptr_t inc) { unsigned long cur = syscall(SYS_brk, 0); if (inc && syscall(SYS_brk, cur+inc) != cur+inc) return (void *)-1; diff --git a/src/time/__asctime.c b/src/time/__asctime.c index d31f634..7cc4f50 100644 --- a/src/time/__asctime.c +++ b/src/time/__asctime.c @@ -1,6 +1,7 @@ #include #include #include +#include "atomic.h" const char *__langinfo(nl_item); @@ -21,7 +22,7 @@ char *__asctime(const struct tm *tm, char *buf) * application developers that they may not be so lucky * on other implementations (e.g. stack smashing..). */ - *(volatile int*)0 = 0; + a_crash(); } return buf; } diff --git a/src/unistd/setpgid.c b/src/unistd/setpgid.c index 4a5a3d6..0616069 100644 --- a/src/unistd/setpgid.c +++ b/src/unistd/setpgid.c @@ -1,7 +1,7 @@ #include #include "syscall.h" -pid_t setpgid(pid_t pid, pid_t pgid) +int setpgid(pid_t pid, pid_t pgid) { return syscall(SYS_setpgid, pid, pgid); } --NzB8fVQJ5HfG6fxh--