Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1368866 > unrolled thread
| Started by | Richard Weinberger <richard@nod.at> |
|---|---|
| First post | 2016-04-01 00:40 +0200 |
| Last post | 2016-04-01 10:10 +0200 |
| Articles | 11 — 8 participants |
Back to article view | Back to linux.kernel
New syscall: leftpad() Richard Weinberger <richard@nod.at> - 2016-04-01 00:40 +0200
[PATCH] Implement leftpad syscall Richard Weinberger <richard@nod.at> - 2016-04-01 00:40 +0200
Re: [PATCH] Implement leftpad syscall "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> - 2016-04-01 00:50 +0200
Re: [PATCH] Implement leftpad syscall Greg KH <gregkh@linuxfoundation.org> - 2016-04-01 01:10 +0200
Re: [PATCH] Implement leftpad syscall Frederic Weisbecker <fweisbec@gmail.com> - 2016-04-01 03:40 +0200
Re: [PATCH] Implement leftpad syscall kbuild test robot <lkp@intel.com> - 2016-04-01 05:30 +0200
Re: [PATCH] Implement leftpad syscall Richard Cochran <richardcochran@gmail.com> - 2016-04-01 09:00 +0200
Re: [PATCH] Implement leftpad syscall Scotty Bauer <sbauer@eng.utah.edu> - 2016-04-01 09:20 +0200
[PATCH] leftpad.2: Document new syscall Richard Weinberger <richard@nod.at> - 2016-04-01 00:40 +0200
Re: New syscall: leftpad() Randy Dunlap <rdunlap@infradead.org> - 2016-04-01 01:40 +0200
Re: New syscall: leftpad() Richard Weinberger <richard@nod.at> - 2016-04-01 10:10 +0200
| From | Richard Weinberger <richard@nod.at> |
|---|---|
| Date | 2016-04-01 00:40 +0200 |
| Subject | New syscall: leftpad() |
| Message-ID | <riTpT-3gZ-3@gated-at.bofh.it> |
Recent happenings in the node.js community showed how fragile software is when it comes to dependencies of fundamental algorithms like leftpad[1]. A node.js package which provided ledpad vanished and broke a lot of software. This raised our attention and we came to the conclusion that it is the kernel's job to provide such functionality such that node.js based applications can in future rely in Linux's "don't break userspace" rule. We hope that glibc and Andoid's bionic will soon offer wrapper functions for this new leftpad system call. We put leftpad into the kernel not only because of Linux's stable ABI, also for performance reasons. As everyone knows, within the kernel everything is faster and better. Leftpad has millions of users, so it has to be as fast as possible. This new system call will also help making services like left-pad.io[2] faster and more reliable. If the leftpad() system call gets adopted by a wider user base it might also make sense to add a generic npm() system call which acts like ioctl() where kernel modules can register new functions that are often used by node.js. Such functions might be, is_array(), is_int(), etc. Enjoy, //richard [1] http://www.theregister.co.uk/2016/03/23/npm_left_pad_chaos/ [2] http://left-pad.io/ [PATCH] Implement leftpad syscall [PATCH] leftpad.2: Document new syscall
[toc] | [next] | [standalone]
| From | Richard Weinberger <richard@nod.at> |
|---|---|
| Date | 2016-04-01 00:40 +0200 |
| Subject | [PATCH] Implement leftpad syscall |
| Message-ID | <riTpU-3gZ-9@gated-at.bofh.it> |
| In reply to | #1368866 |
From: David Gstir <david@sigma-star.at>
Implement the leftpad() system call such that userspace,
especially node.js applications, can in the near future directly
use it and no longer depend on fragile npm packages.
Signed-off-by: David Gstir <david@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
---
arch/x86/entry/syscalls/syscall_64.tbl | 1 +
include/linux/syscalls.h | 1 +
kernel/sys.c | 35 ++++++++++++++++++++++++++++++++++
kernel/sys_ni.c | 1 +
4 files changed, 38 insertions(+)
diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl
index cac6d17..f287712 100644
--- a/arch/x86/entry/syscalls/syscall_64.tbl
+++ b/arch/x86/entry/syscalls/syscall_64.tbl
@@ -335,6 +335,7 @@
326 common copy_file_range sys_copy_file_range
327 64 preadv2 sys_preadv2
328 64 pwritev2 sys_pwritev2
+329 common leftpad sys_leftpad
#
# x32-specific system call numbers start at 512 to avoid cache impact
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index d795472..a0850bb 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -898,4 +898,5 @@ asmlinkage long sys_copy_file_range(int fd_in, loff_t __user *off_in,
asmlinkage long sys_mlock2(unsigned long start, size_t len, int flags);
+asmlinkage long sys_leftpad(char *str, char pad, char *dst, size_t dst_len);
#endif
diff --git a/kernel/sys.c b/kernel/sys.c
index cf8ba54..e42d972 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2432,3 +2432,38 @@ COMPAT_SYSCALL_DEFINE1(sysinfo, struct compat_sysinfo __user *, info)
return 0;
}
#endif /* CONFIG_COMPAT */
+
+
+SYSCALL_DEFINE4(leftpad, char *, src, char, pad, char *, dst, size_t, dst_len)
+{
+ char *buf;
+ long ret;
+ size_t len = strlen_user(src);
+ size_t pad_len = dst_len - len;
+
+ if (dst_len <= len || dst_len > 4096) {
+ return -EINVAL;
+ }
+
+ buf = kmalloc(dst_len, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
+
+ memset(buf, pad, pad_len);
+ ret = copy_from_user(buf + pad_len, src, len);
+ if (ret) {
+ ret = -EFAULT;
+ goto out;
+ }
+
+ ret = copy_to_user(dst, buf, dst_len);
+ if (ret) {
+ ret = -EFAULT;
+ goto out;
+ }
+
+ ret = pad_len;
+out:
+ kfree(buf);
+ return ret;
+}
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 2c5e3a8..262608d 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -175,6 +175,7 @@ cond_syscall(sys_setfsgid);
cond_syscall(sys_capget);
cond_syscall(sys_capset);
cond_syscall(sys_copy_file_range);
+cond_syscall(sys_leftpad);
/* arch-specific weak syscall entries */
cond_syscall(sys_pciconfig_read);
--
1.8.4.5
[toc] | [prev] | [next] | [standalone]
| From | "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> |
|---|---|
| Date | 2016-04-01 00:50 +0200 |
| Subject | Re: [PATCH] Implement leftpad syscall |
| Message-ID | <riTzA-3m3-9@gated-at.bofh.it> |
| In reply to | #1368868 |
On 04/01/2016 11:33 AM, Richard Weinberger wrote:
> From: David Gstir <david@sigma-star.at>
>
> Implement the leftpad() system call such that userspace,
> especially node.js applications, can in the near future directly
> use it and no longer depend on fragile npm packages.
Works can't express the importance of adding this system call!
Thanks so much for proposing and implementing it!
Acked-by: Michael Kerrisk <mtk.manpages@gmail.com>
Cheers,
Michael
> Signed-off-by: David Gstir <david@sigma-star.at>
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
> arch/x86/entry/syscalls/syscall_64.tbl | 1 +
> include/linux/syscalls.h | 1 +
> kernel/sys.c | 35 ++++++++++++++++++++++++++++++++++
> kernel/sys_ni.c | 1 +
> 4 files changed, 38 insertions(+)
>
> diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl
> index cac6d17..f287712 100644
> --- a/arch/x86/entry/syscalls/syscall_64.tbl
> +++ b/arch/x86/entry/syscalls/syscall_64.tbl
> @@ -335,6 +335,7 @@
> 326 common copy_file_range sys_copy_file_range
> 327 64 preadv2 sys_preadv2
> 328 64 pwritev2 sys_pwritev2
> +329 common leftpad sys_leftpad
>
> #
> # x32-specific system call numbers start at 512 to avoid cache impact
> diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
> index d795472..a0850bb 100644
> --- a/include/linux/syscalls.h
> +++ b/include/linux/syscalls.h
> @@ -898,4 +898,5 @@ asmlinkage long sys_copy_file_range(int fd_in, loff_t __user *off_in,
>
> asmlinkage long sys_mlock2(unsigned long start, size_t len, int flags);
>
> +asmlinkage long sys_leftpad(char *str, char pad, char *dst, size_t dst_len);
> #endif
> diff --git a/kernel/sys.c b/kernel/sys.c
> index cf8ba54..e42d972 100644
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -2432,3 +2432,38 @@ COMPAT_SYSCALL_DEFINE1(sysinfo, struct compat_sysinfo __user *, info)
> return 0;
> }
> #endif /* CONFIG_COMPAT */
> +
> +
> +SYSCALL_DEFINE4(leftpad, char *, src, char, pad, char *, dst, size_t, dst_len)
> +{
> + char *buf;
> + long ret;
> + size_t len = strlen_user(src);
> + size_t pad_len = dst_len - len;
> +
> + if (dst_len <= len || dst_len > 4096) {
> + return -EINVAL;
> + }
> +
> + buf = kmalloc(dst_len, GFP_KERNEL);
> + if (!buf)
> + return -ENOMEM;
> +
> + memset(buf, pad, pad_len);
> + ret = copy_from_user(buf + pad_len, src, len);
> + if (ret) {
> + ret = -EFAULT;
> + goto out;
> + }
> +
> + ret = copy_to_user(dst, buf, dst_len);
> + if (ret) {
> + ret = -EFAULT;
> + goto out;
> + }
> +
> + ret = pad_len;
> +out:
> + kfree(buf);
> + return ret;
> +}
> diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
> index 2c5e3a8..262608d 100644
> --- a/kernel/sys_ni.c
> +++ b/kernel/sys_ni.c
> @@ -175,6 +175,7 @@ cond_syscall(sys_setfsgid);
> cond_syscall(sys_capget);
> cond_syscall(sys_capset);
> cond_syscall(sys_copy_file_range);
> +cond_syscall(sys_leftpad);
>
> /* arch-specific weak syscall entries */
> cond_syscall(sys_pciconfig_read);
>
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
[toc] | [prev] | [next] | [standalone]
| From | Greg KH <gregkh@linuxfoundation.org> |
|---|---|
| Date | 2016-04-01 01:10 +0200 |
| Subject | Re: [PATCH] Implement leftpad syscall |
| Message-ID | <riTSV-3JP-7@gated-at.bofh.it> |
| In reply to | #1368868 |
On Fri, Apr 01, 2016 at 12:33:32AM +0200, Richard Weinberger wrote:
> + if (dst_len <= len || dst_len > 4096) {
> + return -EINVAL;
> + }
Please always use checkpatch.pl when submitting patches.
thanks,
greg k-h
[toc] | [prev] | [next] | [standalone]
| From | Frederic Weisbecker <fweisbec@gmail.com> |
|---|---|
| Date | 2016-04-01 03:40 +0200 |
| Subject | Re: [PATCH] Implement leftpad syscall |
| Message-ID | <riWe6-5kF-7@gated-at.bofh.it> |
| In reply to | #1368868 |
On Fri, Apr 01, 2016 at 12:33:32AM +0200, Richard Weinberger wrote: > From: David Gstir <david@sigma-star.at> > > Implement the leftpad() system call such that userspace, > especially node.js applications, can in the near future directly > use it and no longer depend on fragile npm packages. > > Signed-off-by: David Gstir <david@sigma-star.at> > Signed-off-by: Richard Weinberger <richard@nod.at> > --- > arch/x86/entry/syscalls/syscall_64.tbl | 1 + > include/linux/syscalls.h | 1 + > kernel/sys.c | 35 ++++++++++++++++++++++++++++++++++ > kernel/sys_ni.c | 1 + > 4 files changed, 38 insertions(+) > > diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl > index cac6d17..f287712 100644 > --- a/arch/x86/entry/syscalls/syscall_64.tbl > +++ b/arch/x86/entry/syscalls/syscall_64.tbl > @@ -335,6 +335,7 @@ > 326 common copy_file_range sys_copy_file_range > 327 64 preadv2 sys_preadv2 > 328 64 pwritev2 sys_pwritev2 > +329 common leftpad sys_leftpad > > # > # x32-specific system call numbers start at 512 to avoid cache impact > diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h > index d795472..a0850bb 100644 > --- a/include/linux/syscalls.h > +++ b/include/linux/syscalls.h > @@ -898,4 +898,5 @@ asmlinkage long sys_copy_file_range(int fd_in, loff_t __user *off_in, > > asmlinkage long sys_mlock2(unsigned long start, size_t len, int flags); > > +asmlinkage long sys_leftpad(char *str, char pad, char *dst, size_t dst_len); > #endif > diff --git a/kernel/sys.c b/kernel/sys.c > index cf8ba54..e42d972 100644 > --- a/kernel/sys.c > +++ b/kernel/sys.c > @@ -2432,3 +2432,38 @@ COMPAT_SYSCALL_DEFINE1(sysinfo, struct compat_sysinfo __user *, info) > return 0; > } > #endif /* CONFIG_COMPAT */ > + > + > +SYSCALL_DEFINE4(leftpad, char *, src, char, pad, char *, dst, size_t, dst_len) Have you considered /dev/leftpad instead?
[toc] | [prev] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2016-04-01 05:30 +0200 |
| Subject | Re: [PATCH] Implement leftpad syscall |
| Message-ID | <riXWy-6Md-11@gated-at.bofh.it> |
| In reply to | #1368868 |
[Multipart message — attachments visible in raw view] — view raw
Hi David,
[auto build test ERROR on v4.6-rc1]
[also build test ERROR on next-20160331]
[cannot apply to tip/x86/core]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Richard-Weinberger/Implement-leftpad-syscall/20160401-063620
config: microblaze-mmu_defconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=microblaze
All errors (new ones prefixed by >>):
kernel/sys.c: In function 'SYSC_leftpad':
>> kernel/sys.c:2441:2: error: implicit declaration of function 'strlen_user' [-Werror=implicit-function-declaration]
size_t len = strlen_user(src);
^
cc1: some warnings being treated as errors
vim +/strlen_user +2441 kernel/sys.c
2435
2436
2437 SYSCALL_DEFINE4(leftpad, char *, src, char, pad, char *, dst, size_t, dst_len)
2438 {
2439 char *buf;
2440 long ret;
> 2441 size_t len = strlen_user(src);
2442 size_t pad_len = dst_len - len;
2443
2444 if (dst_len <= len || dst_len > 4096) {
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [next] | [standalone]
| From | Richard Cochran <richardcochran@gmail.com> |
|---|---|
| Date | 2016-04-01 09:00 +0200 |
| Subject | Re: [PATCH] Implement leftpad syscall |
| Message-ID | <rj1dL-zj-1@gated-at.bofh.it> |
| In reply to | #1368868 |
On Fri, Apr 01, 2016 at 12:33:32AM +0200, Richard Weinberger wrote: > From: David Gstir <david@sigma-star.at> > > Implement the leftpad() system call such that userspace, > especially node.js applications, can in the near future directly > use it and no longer depend on fragile npm packages. > > Signed-off-by: David Gstir <david@sigma-star.at> > Signed-off-by: Richard Weinberger <richard@nod.at> > --- > arch/x86/entry/syscalls/syscall_64.tbl | 1 + > include/linux/syscalls.h | 1 + > kernel/sys.c | 35 ++++++++++++++++++++++++++++++++++ > kernel/sys_ni.c | 1 + > 4 files changed, 38 insertions(+) This is okay as far as it goes, but you need to add the other archs and put the relevant maintainers onto CC. Thanks, Richard
[toc] | [prev] | [next] | [standalone]
| From | Scotty Bauer <sbauer@eng.utah.edu> |
|---|---|
| Date | 2016-04-01 09:20 +0200 |
| Subject | Re: [PATCH] Implement leftpad syscall |
| Message-ID | <rj1x8-Xr-25@gated-at.bofh.it> |
| In reply to | #1368868 |
On 03/31/2016 04:33 PM, Richard Weinberger wrote:
> From: David Gstir <david@sigma-star.at>
>
> Implement the leftpad() system call such that userspace,
> especially node.js applications, can in the near future directly
> use it and no longer depend on fragile npm packages.
>
> Signed-off-by: David Gstir <david@sigma-star.at>
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
> arch/x86/entry/syscalls/syscall_64.tbl | 1 +
> include/linux/syscalls.h | 1 +
> kernel/sys.c | 35 ++++++++++++++++++++++++++++++++++
> kernel/sys_ni.c | 1 +
> 4 files changed, 38 insertions(+)
>
> diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl
> index cac6d17..f287712 100644
> --- a/arch/x86/entry/syscalls/syscall_64.tbl
> +++ b/arch/x86/entry/syscalls/syscall_64.tbl
> @@ -335,6 +335,7 @@
> 326 common copy_file_range sys_copy_file_range
> 327 64 preadv2 sys_preadv2
> 328 64 pwritev2 sys_pwritev2
> +329 common leftpad sys_leftpad
>
> #
> # x32-specific system call numbers start at 512 to avoid cache impact
> diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
> index d795472..a0850bb 100644
> --- a/include/linux/syscalls.h
> +++ b/include/linux/syscalls.h
> @@ -898,4 +898,5 @@ asmlinkage long sys_copy_file_range(int fd_in, loff_t __user *off_in,
>
> asmlinkage long sys_mlock2(unsigned long start, size_t len, int flags);
>
> +asmlinkage long sys_leftpad(char *str, char pad, char *dst, size_t dst_len);
> #endif
> diff --git a/kernel/sys.c b/kernel/sys.c
> index cf8ba54..e42d972 100644
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -2432,3 +2432,38 @@ COMPAT_SYSCALL_DEFINE1(sysinfo, struct compat_sysinfo __user *, info)
> return 0;
> }
> #endif /* CONFIG_COMPAT */
> +
> +
> +SYSCALL_DEFINE4(leftpad, char *, src, char, pad, char *, dst, size_t, dst_len)
> +{
> + char *buf;
> + long ret;
> + size_t len = strlen_user(src);
> + size_t pad_len = dst_len - len;
> +
> + if (dst_len <= len || dst_len > 4096) {
> + return -EINVAL;
> + }
> +
> + buf = kmalloc(dst_len, GFP_KERNEL);
> + if (!buf)
> + return -ENOMEM;
> +
> + memset(buf, pad, pad_len);
> + ret = copy_from_user(buf + pad_len, src, len);
> + if (ret) {
> + ret = -EFAULT;
> + goto out;
> + }
> +
> + ret = copy_to_user(dst, buf, dst_len);
> + if (ret) {
> + ret = -EFAULT;
> + goto out;
> + }
> +
> + ret = pad_len;
> +out:
> + kfree(buf);
> + return ret;
> +}
This looks good, but since we want this to be as fast as possible we might just want to eliminate all
branches (Pesky bounds checks), and write directly into user memory to eliminate the pesky copy_from/copy_to. The second
idea would eliminate that slow kmalloc as well.
What do you think?
> diff --git a/kernel/sys_ni.c b/kernel/sys_ni.
> index 2c5e3a8..262608d 100644
> --- a/kernel/sys_ni.c
> +++ b/kernel/sys_ni.c
> @@ -175,6 +175,7 @@ cond_syscall(sys_setfsgid);
> cond_syscall(sys_capget);
> cond_syscall(sys_capset);
> cond_syscall(sys_copy_file_range);
> +cond_syscall(sys_leftpad);
>
> /* arch-specific weak syscall entries */
> cond_syscall(sys_pciconfig_read);
>
[toc] | [prev] | [next] | [standalone]
| From | Richard Weinberger <richard@nod.at> |
|---|---|
| Date | 2016-04-01 00:40 +0200 |
| Subject | [PATCH] leftpad.2: Document new syscall |
| Message-ID | <riTpU-3gZ-15@gated-at.bofh.it> |
| In reply to | #1368866 |
From: Daniel Walter <dwalter@sigma-star.at> Signed-off-by: Daniel Walter <dwalter@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at> --- man2/leftpad.2 | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 man2/leftpad.2 diff --git a/man2/leftpad.2 b/man2/leftpad.2 new file mode 100644 index 0000000..ff5f401 --- /dev/null +++ b/man2/leftpad.2 @@ -0,0 +1,55 @@ +.\" Copyright (c) 2016 sigma-star gmbh +.\" (office@sigma-star.at) +.\" +.\" %%%LICENSE_START(GPLv2+_DOC_FULL) +.\" This is free documentation; you can redistribute it and/or +.\" modify it under the terms of the GNU General Public License as +.\" published by the Free Software Foundation; either version 2 of +.\" the License, or (at your option) any later version. +.\" +.\" The GNU General Public License's references to "object code" +.\" and "executables" are to be interpreted as the output of any +.\" document formatting or typesetting system, including +.\" intermediate and printed output. +.\" +.\" This manual is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" GNU General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public +.\" License along with this manual; if not, see +.\" <http://www.gnu.org/licenses/>. +.\" %%%LICENSE_END +.\" +.TH LEFTPAD 2 2016-04-01 "Linux" "Linux Programmer's Manual" +.SH NAME +leftpad +.SH SYNOPSIS +.nf +.B #include <sys/types.h> + +.BI "int leftpad(char *src, char pad, char *dst, size_t dst_len); +.fi +.SH DESCRIPTION +This function provides left padding for strings. +.LP +The string in +.I src +will be left padded with the chosen padding character +.I pad +and stored in +.I dst + . +.SH RETURN VALUE +On success, returns the number of padding characters added. +.SH ERRORS +.TP +.B EINVAL +The size of the destination buffer +.I dst +is shorter than the source string +.I src + . Or the destination string is longer than 4096 bytes. +.SH SEE ALSO +.BR snprintf (3) -- 2.7.3
[toc] | [prev] | [next] | [standalone]
| From | Randy Dunlap <rdunlap@infradead.org> |
|---|---|
| Date | 2016-04-01 01:40 +0200 |
| Message-ID | <riUlX-3W5-9@gated-at.bofh.it> |
| In reply to | #1368866 |
Please be more careful in your description...
On 03/31/16 15:33, Richard Weinberger wrote:
> Recent happenings in the node.js community showed how fragile software is when
> it comes to dependencies of fundamental algorithms like leftpad[1].
> A node.js package which provided ledpad vanished and broke a lot of software.
leftpad
> This raised our attention and we came to the conclusion that it is the kernel's
> job to provide such functionality such that node.js based applications can in future
> rely in Linux's "don't break userspace" rule.
> We hope that glibc and Andoid's bionic will soon offer wrapper functions for this
Android's
> new leftpad system call.
> We put leftpad into the kernel not only because of Linux's stable ABI,
> also for performance reasons.
> As everyone knows, within the kernel everything is faster and better.
> Leftpad has millions of users, so it has to be as fast as possible.
> This new system call will also help making services like left-pad.io[2]
> faster and more reliable. If the leftpad() system call gets adopted by a wider user base
> it might also make sense to add a generic npm() system call which acts like ioctl()
> where kernel modules can register new functions that are often used by node.js.
> Such functions might be, is_array(), is_int(), etc.
--
~Randy
[toc] | [prev] | [next] | [standalone]
| From | Richard Weinberger <richard@nod.at> |
|---|---|
| Date | 2016-04-01 10:10 +0200 |
| Message-ID | <rj2jv-1v4-3@gated-at.bofh.it> |
| In reply to | #1368885 |
Am 01.04.2016 um 01:36 schrieb Randy Dunlap: > Please be more careful in your description... I'm very sorry. Will do a v2 soon. ;-) > On 03/31/16 15:33, Richard Weinberger wrote: >> Recent happenings in the node.js community showed how fragile software is when >> it comes to dependencies of fundamental algorithms like leftpad[1]. >> A node.js package which provided ledpad vanished and broke a lot of software. > > leftpad > >> This raised our attention and we came to the conclusion that it is the kernel's >> job to provide such functionality such that node.js based applications can in future >> rely in Linux's "don't break userspace" rule. >> We hope that glibc and Andoid's bionic will soon offer wrapper functions for this > > Android's > >> new leftpad system call. >> We put leftpad into the kernel not only because of Linux's stable ABI, >> also for performance reasons. >> As everyone knows, within the kernel everything is faster and better. >> Leftpad has millions of users, so it has to be as fast as possible. >> This new system call will also help making services like left-pad.io[2] >> faster and more reliable. If the leftpad() system call gets adopted by a wider user base >> it might also make sense to add a generic npm() system call which acts like ioctl() >> where kernel modules can register new functions that are often used by node.js. >> Such functions might be, is_array(), is_int(), etc. > > Thanks, //richard
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web