ALT Linux Bugzilla
– Attachment 5202 Details for
Bug 24760
Поле адреса в выводе ss не соответствует ширине терминала
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
Makes ss to mimic netstat -p behaviour for tcp and udp sockets.
iproute2-2.6.39-ss-users.patch (text/plain), 1.81 KB, created by
Дмитрий Державин
on 2011-11-14 11:46:59 MSK
(
hide
)
Description:
Makes ss to mimic netstat -p behaviour for tcp and udp sockets.
Filename:
MIME Type:
Creator:
Дмитрий Державин
Created:
2011-11-14 11:46:59 MSK
Size:
1.81 KB
patch
obsolete
>--- misc/ss.c.orig 2011-06-30 03:01:48.000000000 +0400 >+++ misc/ss.c 2011-11-14 10:57:57.000000000 +0400 >@@ -320,13 +320,14 @@ > if (ptr - buf >= buflen - 1) > break; > >- snprintf(ptr, buflen - (ptr - buf), >- "(\"%s\",%d,%d),", >- p->process, p->pid, p->fd); >- ptr += strlen(ptr); >- cnt++; >- > next: >+ if (!p->next) { >+ snprintf(ptr, buflen - (ptr - buf), >+ "%*s,%d\n", >+ 12, p->process, p->pid); >+ ptr += strlen(ptr); >+ cnt++; >+ } > p = p->next; > } > >@@ -1444,7 +1445,7 @@ > if (show_users) { > char ubuf[4096]; > if (find_users(r->idiag_inode, ubuf, sizeof(ubuf)) > 0) >- printf(" users:(%s)", ubuf); >+ printf("%30s", ubuf); > } > if (show_details) { > if (r->idiag_uid) >@@ -1813,7 +1814,7 @@ > if (show_users) { > char ubuf[4096]; > if (find_users(s.ino, ubuf, sizeof(ubuf)) > 0) >- printf(" users:(%s)", ubuf); >+ printf("%30s", ubuf); > } > > if (show_details) { >@@ -2801,11 +2802,17 @@ > } > } > >+ int users_width = 30; >+ > addrp_width = screen_width; > addrp_width -= netid_width+1; > addrp_width -= state_width+1; > addrp_width -= 14; > >+ if (show_users) { >+ addrp_width -= users_width; >+ } >+ > if (addrp_width&1) { > if (netid_width) > netid_width++; >@@ -2816,7 +2823,7 @@ > addrp_width /= 2; > addrp_width--; > >- serv_width = resolve_services ? 7 : 5; >+ serv_width = resolve_services ? 15 : 5; > > if (addrp_width < 15+serv_width+1) > addrp_width = 15+serv_width+1; >@@ -2829,10 +2836,12 @@ > printf("%-*s ", state_width, "State"); > printf("%-6s %-6s ", "Recv-Q", "Send-Q"); > >- printf("%*s:%-*s %*s:%-*s\n", >+ printf("%*s:%-*s %*s:%-*s", > addr_width, "Local Address", serv_width, "Port", > addr_width, "Peer Address", serv_width, "Port"); >- >+ if (show_users) >+ printf("%*s", users_width, "Users"); >+ printf("\n"); > fflush(stdout); > > if (current_filter.dbs & (1<<NETLINK_DB))
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 24760
: 5202